<commit_before>
from bs4 import BeautifulSoup

import urllib.parse
import urllib.request

import re


class AllRecipes(object):

	@staticmethod
	def search(query_dict):
		"""
		Search recipes parsing the returned html data.
		"""
		base_url = "https://allrecipes.com/search/results/?"
		query_url = urllib.parse.urlencode(query_dict)

		url = base_url + query_url

		html_content = urllib.request.urlopen(url).read()
		soup = BeautifulSoup(html_content, 'html.parser')

		search_data = []
		articles = soup.findAll("article", {"class": "grid-col--fixed-tiles"})

		iterarticles = iter(articles)
		next(iterarticles)
		for article in iterarticles:
			data = {}
			try:
				data["name"] = article.find("h3", {"class": "grid-col__h3 grid-col__h3--recipe-grid"}).get_text().strip(' \t\n\r')
				data["description"] = article.find("div", {"class": "rec-card__description"}).get_text()
				data["url"] = article.find("a", href=re.compile('^/recipe/'))['href']
				try:
					data["image"] = article.find("a", href=re.compile('^/recipe/')).find("img")["data-original-src"]
				except Exception as e1:
					pass
			except Exception as e2:
				pass
			search_data.append(data)

		return search_data

	@staticmethod
	def get(uri):
		"""
		'url' from 'search' method.
		 ex. "/recipe/106349/beef-and-spinach-curry/"
		"""
		base_url = "https://allrecipes.com/"
		url = base_url + uri
<commit_msg>Update __init__.py<commit_after>
from bs4 import BeautifulSoup

import urllib.parse
import urllib.request

import re


class AllRecipes(object):

	@staticmethod
	def search(query_dict):
		"""
		Search recipes parsing the returned html data.
		"""
		base_url = "https://allrecipes.com/search/results/?"
		query_url = urllib.parse.urlencode(query_dict)

		url = base_url + query_url

		html_content = urllib.request.urlopen(url).read()
		soup = BeautifulSoup(html_content, 'html.parser')

		search_data = []
		articles = soup.findAll("article", {"class": "grid-col--fixed-tiles"})

		iterarticles = iter(articles)
		next(iterarticles)
		for article in iterarticles:
			data = {}
			try:
				data["name"] = article.find("h3", {"class": "grid-col__h3 grid-col__h3--recipe-grid"}).get_text().strip(' \t\n\r')
				data["description"] = article.find("div", {"class": "rec-card__description"}).get_text()
				data["url"] = article.find("a", href=re.compile('^/recipe/'))['href']
				try:
					data["image"] = article.find("a", href=re.compile('^/recipe/')).find("img")["data-original-src"]
				except Exception as e1:
					pass
			except Exception as e2:
				pass
			if data:
				search_data.append(data)

		return search_data

	@staticmethod
	def get(uri):
		"""
		'url' from 'search' method.
		 ex. "/recipe/106349/beef-and-spinach-curry/"
		"""
		base_url = "https://allrecipes.com/"
		url = base_url + uri

{'fraction_non_alphanumeric': 0.16941852117731515, 'fraction_numerical': 0.008614501076812634, 'mean_word_length': 3.950266429840142, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1740981', 'n_tokens_mistral': 1131, 'n_tokens_neox': 971, 'n_words': 189}