Нормализация данных, привидение к общему json
This commit is contained in:
29
parser.py
29
parser.py
@@ -59,18 +59,33 @@ def pars_recipie(link='https://povar.ru/recipes/slivochnaya_karbonara-73186.html
|
||||
|
||||
main_container = soup.find(class_='cont_area hrecipe')
|
||||
|
||||
#detailed_tags = main_container.find(class_='detailed_tags') #Собираем теги
|
||||
#detailed_tags = f.extract_tags_from_detailed_tags(detailed_tags)
|
||||
name = main_container.find(class_='detailed fn').get_text()
|
||||
|
||||
#ingredients = f.extr_ingredient(main_container) #Собираем ингредиенты
|
||||
#print(ingredients)
|
||||
|
||||
#calories_info = f.extract_nutrition(main_container.find_all(class_='circle')) #БЖУ
|
||||
#print(calories_info)
|
||||
recipies = {'recipes': {}}
|
||||
|
||||
steps = f.extr_steps(main_container)
|
||||
detailed_tags = f.extract_tags_from_detailed_tags(main_container) #Собираем теги
|
||||
print(detailed_tags)
|
||||
|
||||
ingredients = f.extr_ingredient(main_container) #Собираем ингредиенты
|
||||
print(ingredients)
|
||||
|
||||
calories_info = f.extract_nutrition(main_container.find_all(class_='circle')) #БЖУ
|
||||
print(calories_info)
|
||||
|
||||
steps = f.extr_steps(main_container) #Сборка шагов
|
||||
print(steps)
|
||||
|
||||
preview_img = steps[-1]['img']
|
||||
|
||||
recipies['recipes'] = { 'name':name,
|
||||
'preview_img':preview_img,
|
||||
'tags':detailed_tags,
|
||||
'ingredients':ingredients,
|
||||
'nutritional_value':calories_info,
|
||||
'steps':steps}
|
||||
print(recipies)
|
||||
|
||||
|
||||
|
||||
#pars_group(link)
|
||||
|
||||
Reference in New Issue
Block a user