12345678910111213141516171819202122232425 |
- def get_recipes():
- recipies = []
- salad_url = 'https://www.allrecipes.com/recipes/96/salad/'
- url = 'https://www.allrecipes.com/recipes/96/salad/'
- print('Accessing list')
- try:
- r = requests.get(url, headers=headers)
- if r.status_code == 200:
- html = r.text
- soup = BeautifulSoup(html, 'lxml')
- links = soup.select('.fixed-recipe-card__h3 a')
- idx = 0
- for link in links:
- sleep(2)
- recipe = fetch_raw(link['href'])
- recipies.append(recipe)
- idx += 1
- except Exception as ex:
- print('Exception in get_recipes')
- print(str(ex))
- finally:
- return recipies
|