Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from recipe_scrapers import scrape_me, SCRAPERS
- from urllib.parse import urlparse
- # site = 'https://www.allrecipes.com/recipe/61024/asian-orange-chicken/'
- site = input('Please enter the website URL to scrape (blank line to quit) ->')
- if site != '':
- # Now check to see if the domain is in the SCRAPERS dictionary...
- domain = urlparse(site).netloc
- domain = domain.replace("www.", "")
- if domain in SCRAPERS:
- scraper = scrape_me(site)
- title = scraper.title()
- total_time = scraper.total_time()
- yields = scraper.yields()
- ingredients = scraper.ingredients()
- instructions = scraper.instructions()
- image = scraper.image()
- print(f'Title: {title}')
- print(f'Total Time: {total_time}')
- print(f'Servings: {yields}')
- # print(f'Ingredients: {ingredients}')
- print('Ingredients:\n')
- for ing in ingredients:
- print(f' {ing}')
- print(f'\nInstructions: {instructions}')
- print(f'Image URL: {image}')
- else:
- print('\nSorry, that website is not currently supported.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement