interval number of persons for all cookboob backends
This commit is contained in:
parent
aed9a8a511
commit
358881dd48
4 changed files with 5 additions and 5 deletions
|
|
@ -96,7 +96,7 @@ class RecipePage(BasePage):
|
||||||
cooking_time = 60*cooking_time
|
cooking_time = 60*cooking_time
|
||||||
if 'Nombre de personnes' in info_title.text:
|
if 'Nombre de personnes' in info_title.text:
|
||||||
if info_title.tail.strip() != '':
|
if info_title.tail.strip() != '':
|
||||||
nb_person = int(info_title.tail)
|
nb_person = [int(info_title.tail)]
|
||||||
|
|
||||||
ingredients = []
|
ingredients = []
|
||||||
p_ing = self.parser.select(main, 'div.data.top.left > div.content p')
|
p_ing = self.parser.select(main, 'div.data.top.left > div.content p')
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ class RecipePage(BasePage):
|
||||||
cooking_time = cookmin
|
cooking_time = cookmin
|
||||||
l_nbpers = self.parser.select(self.document.getroot(), 'span#lblYield[itemprop=recipeYield]')
|
l_nbpers = self.parser.select(self.document.getroot(), 'span#lblYield[itemprop=recipeYield]')
|
||||||
if len(l_nbpers) > 0:
|
if len(l_nbpers) > 0:
|
||||||
nb_person = int(l_nbpers[0].text.split()[0])
|
nb_person = [int(l_nbpers[0].text.split()[0])]
|
||||||
|
|
||||||
recipe = Recipe(id, title)
|
recipe = Recipe(id, title)
|
||||||
recipe.preparation_time = preparation_time
|
recipe.preparation_time = preparation_time
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,9 @@ class RecipePage(BasePage):
|
||||||
rawnb = l_nbpers[0].text.split()[0]
|
rawnb = l_nbpers[0].text.split()[0]
|
||||||
if '/' in rawnb:
|
if '/' in rawnb:
|
||||||
nbs = rawnb.split('/')
|
nbs = rawnb.split('/')
|
||||||
nb_person = (int(nbs[0]) + int(nbs[1])) / 2
|
nb_person = [int(nbs[0]), int(nbs[1])]
|
||||||
else:
|
else:
|
||||||
nb_person = int(rawnb)
|
nb_person = [int(rawnb)]
|
||||||
|
|
||||||
ingredients = []
|
ingredients = []
|
||||||
l_ing = self.parser.select(main, 'div#ingredients li.ingredient')
|
l_ing = self.parser.select(main, 'div#ingredients li.ingredient')
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ class RecipePage(BasePage):
|
||||||
cooking_time = int(self.parser.select(main, 'p.m_content_recette_info span.cooktime', 1).text_content())
|
cooking_time = int(self.parser.select(main, 'p.m_content_recette_info span.cooktime', 1).text_content())
|
||||||
ing_header_line = self.parser.select(main, 'p.m_content_recette_ingredients span', 1).text_content()
|
ing_header_line = self.parser.select(main, 'p.m_content_recette_ingredients span', 1).text_content()
|
||||||
if '(pour' in ing_header_line and ')' in ing_header_line:
|
if '(pour' in ing_header_line and ')' in ing_header_line:
|
||||||
nb_person = int(ing_header_line.split('pour ')[-1].split('personnes)')[0].split()[0])
|
nb_person = [int(ing_header_line.split('pour ')[-1].split('personnes)')[0].split()[0])]
|
||||||
ingredients = self.parser.select(main, 'p.m_content_recette_ingredients', 1).text_content().strip().split('- ')
|
ingredients = self.parser.select(main, 'p.m_content_recette_ingredients', 1).text_content().strip().split('- ')
|
||||||
ingredients = ingredients[1:]
|
ingredients = ingredients[1:]
|
||||||
rinstructions = self.parser.select(main, 'div.m_content_recette_todo', 1).text_content().strip()
|
rinstructions = self.parser.select(main, 'div.m_content_recette_todo', 1).text_content().strip()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue