Skip to content

Instantly share code, notes, and snippets.

@Galina-Blokh
Last active January 10, 2021 20:18
Show Gist options
  • Save Galina-Blokh/5457feb40ba41bfaac266b642599cf4d to your computer and use it in GitHub Desktop.
Save Galina-Blokh/5457feb40ba41bfaac266b642599cf4d to your computer and use it in GitHub Desktop.
Data search in each response with bs4
for res in response:
try:
soup = BeautifulSoup(res.content, 'html.parser')
except AttributeError:
continue
recipe_ingredients_lines = soup.find_all(attrs={'class': ['wprm-recipe-ingredient',
'ingredient']})
recipe_instructions_lines = soup.find_all(attrs={'class': ['wprm-recipe-instruction-text',
'instruction']})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment