Skip to content

Latest commit

 

History

History
132 lines (97 loc) · 4.37 KB

README.rst

File metadata and controls

132 lines (97 loc) · 4.37 KB

recipe-scrapers

Github Version PyPI - Python Version Downloads GitHub Actions Unittests Coveralls License

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.

Quick Links

Installing

pip install recipe-scrapers

Basic Usage

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)

HTTP Clients

Some Python HTTP clients you can use to retrieve HTML include:

Please refer to their documentation to find out what options (timeout configuration, proxy support, etc) are available.

Supported Sites

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()

Documentation

For detailed usage instructions, examples, and API reference, visit our documentation.

Contributing

We welcome contributions! Please read our contribution guide to get started.

Special Thanks

To all the contributors who help make this project better!

https://contrib.rocks/image?repo=hhursev/recipe-scrapers

Share Your Project

Have an idea for using recipe-scrapers? Check out our project ideas wall for inspiration or to share your own project!