Project description
A simple scraping tool for recipe webpages.
Netiquette
If you’re using this library to collect large numbers of recipes from the web, please use the software responsibly and try to avoid creating high volumes of network traffic.
Python’s standard library provides a robots.txt parser that may be helpful to automatically follow common instructions specified by websites for web crawlers.
Another parser option – particularly if you find that many web requests from urllib.robotparser are blocked – is the robotexclusionrulesparser library.
Getting Started
Start by using Python’s built-in package installer , pip , to install the library:
python -m pip install recipe-scrapers
This should produce output about the installation process, with the final line reading: Successfully installed recipe-scrapers-<version-number> .
To learn what the library can do, you can open a Python interpreter session , and then begin typing – and/or modifying – the statements below (on the lines containing the >>> prompt):
Python 4.0.4 (main, Oct 26 1985, 09:00:32) [GCC 22.3.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from recipe_scrapers import scrape_html
>>> url = "https://www.allrecipes.com/recipe/158968/spinach-and-feta-turkey-burgers/"
>>> name = input ( 'What is your name, burger seeker? \n ' )
>>> html = requests . get ( url , headers = { "User-Agent" : f "Burger Seeker { name } " }) . content
>>> scraper = scrape_html ( html , org_url = url )
>>> help ( scraper )
Some Python HTTP clients that you can use to retrieve HTML include requests , httpx , and the urllib.request module included in Python’s standard library. Please refer to their documentation to find out what options (timeout configuration, proxy support, etc) are available.
Scrapers available for:
https://101cookbooks.com/
https://15gram.be
https://www.750g.com
https://abeautifulmess.com/
https://aberlehome.com/
https://abuelascounter.com/
https://www.acouplecooks.com
https://addapinch.com/
http://www.afghankitchenrecipes.com/
https://aflavorjournal.com/
https://ah.nl/
https://akispetretzikis.com/
https://aldi-nord.de/
https://aldi-sued.de/
https://aldi-suisse.ch
https://aldi.com.au/
https://alexandracooks.com/
https://alittlebityummy.com/
https://allrecipes.com/
https://allthehealthythings.com/
https://alltommat.se/
https://altonbrown.com/
https://amazingribs.com/
https://ambitiouskitchen.com/
https://archanaskitchen.com/
https://www.argiro.gr/
https://www.arla.se/
https://www.atelierdeschefs.fr/
https://averiecooks.com/
https://www.bakels.com.au/
https://baking-sense.com/
https://bakingmischief.com/
https://barefeetinthekitchen.com/
https://barefootcontessa.com/
https://barefootinthepines.com/
https://bbc.com/
https://bbcgoodfood.com/
https://bestrecipes.com.au/
https://betterfoodguru.com/
https://bettybossi.ch/
https://bettycrocker.com/
https://beyondfrosting.com/
https://biancazapatka.com/
https://bigoven.com/
https://bitsofcarey.com/
https://blueapron.com/
https://bluejeanchef.com/
https://www.bodybuilding.com/
https://bonappetit.com/
https://bongeats.com/
https://books.ottolenghi.co.uk (*)
https://bowlofdelicious.com/
https://breadtopia.com/
https://briceletbaklava.ch/
https://brokenovenbaking.com/
https://budgetbytes.com/
https://cafedelites.com/
https://cakemehometonight.com/
https://cambreabakes.com/
https://carlsbadcravings.com/
https://castironketo.net/
https://cdkitchen.com/
https://celebratingsweets.com/
https://chefkoch.de/
https://www.chefnini.com/
https://chefsavvy.com/
https://claudia.abril.com.br/
https://closetcooking.com/
https://colleenchristensennutrition.com/
https://comidinhasdochef.com/
https://cook-talk.com/
https://cookeatshare.com/
https://cookieandkate.com/
https://cookiesandcups.com/
https://cooking.nytimes.com/
https://cookingcircle.com/
https://cookinglight.com/
https://cookomix.com/
https://cookpad.com/
https://cookwell.com/
https://www.coop.se/
https://copykat.com/
https://www.costco.com/
https://countryliving.com/
https://creativecanning.com/
https://cucchiaio.it/
https://cuisineaz.com/
https://cybercook.com.br/
https://damndelicious.net/
https://www.davidlebovitz.com/
https://delish.com/
https://dinneratthezoo.com/
https://dinnerthendessert.com/
https://dish.co.nz/
https://dobruchut.aktuality.sk/
https://domesticate-me.com/
https://donalskehan.com/
https://downshiftology.com/
https://www.dr.dk/
https://www.eatingbirdfood.com/
https://www.eatingwell.com/
https://www.eatliverun.com/
https://eatsmarter.com/
https://eatthismuch.com/
https://eattolerant.de/
https://www.eatwell101.com
https://eatwhattonight.com/
https://elavegan.com/
https://emmikochteinfach.de/
https://en.wikibooks.org/
https://epicurious.com/
https://www.errenskitchen.com/
https://ethanchlebowski.com/
https://www.evolvingtable.com/
https://www.familyfoodonthetable.com/
https://www.farmhouseonboone.com/
https://www.fattoincasadabenedetta.it/
https://felix.kitchen
https://fifteenspatulas.com/
https://finedininglovers.com/
https://fitmencook.com/
https://fitslowcookerqueen.com
https://food.com/
https://food52.com/
https://foodandwine.com/
https://foodfidelity.com/
https://foodnetwork.co.uk/
https://foodrepublic.com/
https://www.forksoverknives.com/
https://forktospoon.com/
https://franzoesischkochen.de/
https://www.gesund-aktiv.com/
https://gimmesomeoven.com/
https://glutenfreeonashoestring.com/
https://godt.no/
https://gonnawantseconds.com/
https://goodfooddiscoveries.com/
https://goodhousekeeping.com/
https://gourmettraveller.com.au/
https://gousto.co.uk/
https://www.grandfrais.com/
https://greatbritishchefs.com/
https://grimgrains.com/
http://www.grouprecipes.com/
https://halfbakedharvest.com/
https://handletheheat.com/
https://www.hassanchef.com/
https://headbangerskitchen.com/
https://healthyeating.nhlbi.nih.gov/
https://heatherchristo.com/
https://www.heb.com/
https://hellofresh.com/
.at , .be , .ca , .ch , .co.nz , .co.uk , .com.au , .de , .dk , .es , .fr , .ie , .it , .lu , .nl , .no , .se
https://www.hersheyland.com/
https://hofer.at/
https://www.homechef.com/
https://hostthetoast.com/
https://hungryhappens.net/
https://www.ica.se/
https://www.im-worthy.com/
https://inbloombakery.com/
https://indianhealthyrecipes.com
https://ingoodflavor.com
https://www.innit.com/
https://insanelygoodrecipes.com
https://inspiralized.com/
https://izzycooking.com/
https://jamieoliver.com/
https://jimcooksfoodgood.com/
https://www.jocooks.com/
https://joshuaweissman.com/
https://joyfoodsunshine.com/
https://joythebaker.com/
https://juliegoodwin.com.au/
https://justataste.com/
https://justbento.com/
https://www.justonecookbook.com/
https://kalejunkie.com/
https://kennymcgovern.com/
https://keukenliefde.nl/
https://www.kingarthurbaking.com
https://kitchenaid.com.au/
https://kitchendivas.com
https://www.kitchendreaming.com
https://www.kitchensanctuary.com/
https://www.kitchenstories.com/
https://kochbar.de/
https://kochbucher.com/
http://koket.se/
https://kristineskitchenblog.com/
https://krollskorner.com/
https://kuchnia-domowa.pl/
https://kuchynalidla.sk/
https://www.kwestiasmaku.com/
https://www.latelierderoxane.com
https://leanandgreenrecipes.net
https://www.lecker.de
https://lecremedelacrumb.com/
https://leitesculinaria.com
https://lekkerensimpel.com
https://leukerecepten.nl/
https://lifestyleofafoodie.com
https://littlespicejar.com/
https://littlesunnykitchen.com/
http://livelytable.com/
https://lovingitvegan.com/
https://www.maangchi.com
https://madensverden.dk/
https://www.madewithlau.com/
https://madsvin.com/
https://marleyspoon.com/
https://marmiton.org/
https://www.marthastewart.com/
https://matprat.no/
https://www.mccormick.com/
https://meljoulwan.com/
https://www.melskitchencafe.com/
https://www.miljuschka.nl/
http://mindmegette.hu/
https://minimalistbaker.com/
https://ministryofcurry.com/
https://misya.info/
https://www.mob.co.uk/
https://mobile.kptncook.com/
https://mobkitchen.co.uk/
https://www.modernhoney.com/
https://www.momontimeout.com/
https://momswithcrockpots.com/
https://monsieur-cuisine.com/
http://motherthyme.com/
https://www.moulinex.fr/
https://www.mundodereceitasbimby.com.pt/
https://mybakingaddiction.com/
https://myjewishlearning.com/
https://mykitchen101.com/
https://mykitchen101en.com/
https://mykoreankitchen.com/
https://www.myplate.gov/
https://myrecipes.com/
https://myvegetarianroots.com/
https://www.nhs.uk/healthier-families/
https://nibbledish.com/
https://norecipes.com/
https://nosalty.hu/
https://www.notenoughcinnamon.com/
https://nourishedbynutrition.com/
https://www.nrk.no/
https://www.number-2-pencil.com/
https://nutritionbynathalie.com/blog
https://nutritionfacts.org/
https://ohsheglows.com/
https://omnivorescookbook.com
https://www.onceuponachef.com
https://onesweetappetite.com/
https://owen-han.com/
https://www.paleorunningmomma.com/
https://www.panelinha.com.br/
https://paninihappy.com/
https://www.peelwithzeal.com/
https://www.persnicketyplates.com/
https://www.pickuplimes.com/
https://pinchofyum.com/
https://www.pingodoce.pt/
https://pinkowlkitchen.com/
https://www.platingpixels.com/
https://plowingthroughlife.com/
https://popsugar.com/
https://potatorolls.com/
https://practicalselfreliance.com/
https://pressureluckcooking.com/
https://www.primaledgehealth.com/
https://www.projectgezond.nl/
https://przepisy.pl/
https://purelypope.com/
https://purplecarrot.com/
https://quitoque.fr/
https://rachlmansfield.com/
https://rainbowplantlife.com/
https://realfood.tesco.com/
https://realsimple.com/
https://receitas.globo.com/
https://receitas.ig.com.br/
https://www.receitasnestle.com.br
https://recept.se/
https://receptyprevas.sk/
https://www.recipegirl.com/
https://reciperunner.com/
https://recipes.farmhousedelivery.com/
https://recipes.timesofindia.com/
https://recipetineats.com/
https://redhousespice.com/
https://reishunger.de/
https://rewe.de/
https://rezeptwelt.de/
https://ricetta.it/
https://ricette.giallozafferano.it/
https://www.ricetteperbimby.it/
https://rosannapansino.com
https://rutgerbakt.nl/
https://www.saboresajinomoto.com.br/
https://sallys-blog.de
https://sallysbakingaddiction.com
https://saltpepperskillet.com/
https://sandwichtribunal.com/
https://www.saveur.com/
https://www.savorynothings.com/
https://seriouseats.com/
https://sharing.kptncook.com/
https://simple-veganista.com/
https://simply-cookit.com/
https://simplyquinoa.com/
https://simplyrecipes.com/
https://simplywhisked.com/
https://skinnytaste.com/
https://smulweb.nl/
https://sobors.hu/
https://www.southerncastiron.com/
https://southernliving.com/
https://spainonafork.com/
https://spendwithpennies.com/
https://www.springlane.de
https://www.staysnatched.com/
https://steamykitchen.com/
https://streetkitchen.hu/
https://www.strongrfastr.com
https://sunbasket.com/
https://sundpaabudget.dk/
https://www.sunset.com/
https://sweetcsdesigns.com/
https://sweetpeasandsaffron.com/
https://www.taste.com.au/
https://www.tasteatlas.com/
https://tasteofhome.com
https://tastesbetterfromscratch.com
https://tastesoflizzyt.com
https://tasty.co
https://tastykitchen.com/
https://theclevercarrot.com/
https://www.thecookierookie.com/
https://thecookingguy.com/
https://thefoodietakesflight.com/
https://theglutenfreeaustrian.com/
https://thehappyfoodie.co.uk/
https://thekitchencommunity.org/
https://www.thekitchenmagpie.com/
https://thekitchn.com/
https://theloopywhisk.com/
https://www.themagicalslowcooker.com/
https://themodernproper.com/
https://www.thepalatablelife.com
https://thepioneerwoman.com/
https://therecipecritic.com/
https://thesaltymarshmallow.com/
https://thespruceeats.com/
https://thevintagemixer.com/
https://thewoksoflife.com/
https://thinlicious.com/
https://tidymom.net
https://tine.no/
https://tofoo.co.uk
https://tudogostoso.com.br/
https://twopeasandtheirpod.com/
https://uitpaulineskeuken.nl/
https://unsophisticook.com/
https://usapears.org/
https://www.valdemarsro.dk/
https://vanillaandbean.com/
https://varecha.pravda.sk/
https://www.vegetarbloggen.no/
https://vegolosi.it/
https://vegrecipesofindia.com/
https://www.waitrose.com/
https://watchwhatueat.com/
https://wearenotmartha.com/
https://www.weightwatchers.com/ (*)
https://www.wellplated.com/
https://whatsgabycooking.com/
https://whole30.com/
https://www.wholefoodsmarket.com/
https://www.williams-sonoma.com/
https://womensweeklyfood.com.au/
https://woolworths.com.au/shop/recipes
https://woop.co.nz/
https://yemek.com/
https://yummly.com/ (*)
https://www.zaubertopf.de
https://zeit.de/ (wochenmarkt)
https://zenbelly.com/
(*) offline saved files only
Contribute
If you spot a design change (or something else) that makes the scraper unable to work for a given site - please fire an issue asap.
If you are programmer PRs with fixes are warmly welcomed and acknowledged with a virtual beer. You can find documentation on how to develop scrapers here .
If you want a scraper for a new site added
Open an Issue providing us the site name, as well as a recipe link from it.
You are a developer and want to code the scraper on your own:
For Devs / Contribute
Assuming you have >=python3.9 installed, navigate to the directory where you want this project to live in and drop these lines
git clone git@github.com:hhursev/recipe-scrapers.git &&
cd recipe-scrapers &&
python -m venv .venv &&
source .venv/bin/activate &&
python -m pip install --upgrade pip &&
pip install -e ".[dev]" &&
pip install pre-commit &&
pre-commit install &&
python -m unittest
In case you want to run a single unittest for a newly developed scraper
python -m unittest -k <test_file_name>
FAQ
What if the recipe site I want to extract information from is not listed above?
You can give it a try with the wild_mode option!
If there is Schema/Recipe available it will work just fine.
url = 'https://www.feastingathome.com/tomato-risotto/'
name = input ( 'What is your name, risotto sampler? \n ' )
html = requests . get ( url , headers = { "User-Agent" : f "Risotto Sampler { name } " }) . content
scraper = scrape_html ( html , org_url = url , wild_mode = True )
scraper . host ()
scraper . title ()
scraper . total_time ()
scraper . image ()
scraper . ingredients ()
scraper . ingredient_groups ()
scraper . instructions ()
scraper . instructions_list ()
scraper . yields ()
scraper . to_json ()
scraper . links ()
scraper . nutrients () # not always available
scraper . canonical_url () # not always available
scraper . equipment () # not always available
scraper . cooking_method () # not always available
scraper . keywords () # not always available
scraper . dietary_restrictions () # not always available
Notes:
How do I know if a website has a Recipe Schema?
Run in python shell:
Python 4.0.4 (main, Oct 26 1985, 09:00:32) [GCC 22.3.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from recipe_scrapers import scrape_html
>>> scraper = scrape_html ( html = None , org_url = '<url of a recipe from the site>' , online = True , wild_mode = True )
>>> # if no error is raised - there's schema available:
>>> scraper . title ()
>>> scraper . instructions () # etc.
Test Data Notice
All content in tests/test_data/ is used for limited, non-commercial testing purposes and belongs to their respective copyright holders. See the tests/test_data/LICENSE.md for details. If you’re a copyright holder with concerns, you can open an issue or contact us privately via the email in our PyPI page.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages .
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names .
The dropdown lists show the available interpreters, ABIs, and platforms.
Enable javascript to be able to filter the list of wheel files.
Copy a direct link to the current filters
Copy
File name
Interpreter
Interpreter
py3
ABI
ABI
none
Platform
Platform
any
File details
Details for the file recipe_scrapers-14.61.0.tar.gz.
File metadata
Download URL: recipe_scrapers-14.61.0.tar.gz
Upload date:
Dec 2, 2024
Size: 131.3 kB
Tags: Source
Uploaded using Trusted Publishing? No
Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Hashes for recipe_scrapers-14.61.0.tar.gz
Algorithm
Hash digest
SHA256
5eab6a666bc2bebac579020d4964d1320f459abaac091b71b49d7f4c83cb7eb3
Copy
MD5
f8e74673d96c27b7ea043c3c760bf458
Copy
BLAKE2b-256
54082c1f4de61202cb6c7a2ebb8b0797b8fc782ba61be8c38b638d509061c613
Copy
See more details on using hashes here.
File details
Details for the file recipe_scrapers-14.61.0-py3-none-any.whl.
File metadata
File hashes
Hashes for recipe_scrapers-14.61.0-py3-none-any.whl
Algorithm
Hash digest
SHA256
e17ba32d16717e5456dbedbf8c9bad45d0be0780efdf5d05839c43b837114aef
Copy
MD5
4af2259d8cc1f7d416e121fe6027ab70
Copy
BLAKE2b-256
ae4e9dca308b1385f97e844d8eea71c2b07fdd1a6a94e9807491c9ea4a915a52
Copy
See more details on using hashes here.