A reliable python tool for scraping recipe data from popular cooking websites. Extract structured recipe information including ingredients, instructions, cooking times, and nutritional data with ease. Supports 400+ major recipe websites out of the box.
pip install recipe-scrapers
from urllib.request import urlopen
from recipe_scrapers import scrape_html
# Example recipe URL
url = "https://www.allrecipes.com/recipe/158968/spinach-and-feta-turkey-burgers/"
# retrieve the recipe webpage HTML
html = urlopen(url).read().decode("utf-8")
# pass the html alongside the url to our scrape_html function
scraper = scrape_html(html, org_url=url)
# Extract recipe information
print(scraper.title()) # "Spinach and Feta Turkey Burgers"
print(scraper.total_time()) # 35
print(scraper.yields()) # "4 servings"
print(scraper.ingredients()) # ['1 pound ground turkey', '1 cup fresh spinach...']
print(scraper.instructions()) # 'Step 1: In a large bowl...'
# For a complete list of available methods:
help(scraper)
Some Python HTTP clients you can use to retrieve HTML include:
- requests: Popular and feature-rich
- httpx: Modern, supports async/await
- urllib.request: Included in Python's standard library
Please refer to their documentation to find out what options (timeout configuration, proxy support, etc) are available.
We support a wide range of recipe websites out of the box. Check our supported sites list for the full list.
You can also get the full list programmatically with:
from recipe_scrapers import SCRAPERS
SCRAPERS.keys()
For detailed usage instructions, examples, and API reference, visit our documentation.
We welcome contributions! Please read our contribution guide to get started.
To all the contributors who help make this project better!
Have an idea for using recipe-scrapers? Check out our project ideas wall for inspiration or to share your own project!