Hello,
Here's a snipet that I found and modify to get input from user. Hope you like it. Please let me know if it is "pythonic" enough for you!
Enjoy
# SCRAPING TOOL TO GET RECIPIE SITES FROM THE INTERNET:
# Documentation: https://pypi.org/project/recipe-scrapers/
from recipe_scrapers import scrape_me
# give the url as a string, it can be url from any site listed below
scraper = scrape_me('https://www.allrecipes.com/recipe/158968/spinach-and-feta-turkey-burgers/')
# Q: What if the recipe site I want to extract information from is not listed below?
# A: You can give it a try with the wild_mode option! If there is Schema/Recipe available it will work just fine.
scraper = scrape_me('https://www.feastingathome.com/tomato-risotto/', wild_mode=True)
scraper.title()
scraper.total_time()
scraper.yields()
scraper.ingredients()
scraper.instructions()
scraper.image()
scraper.host()
scraper.links()
scraper.nutrients() # if available
scrape_dict = scraper.links()
# save the dictionary to a text file
f = open("recipie_2.txt","w")
f.write( str(scrape_dict) )
f.close()
# convert text file to pdf
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", size = 12)
# create a cell
file = open("recipie_2.txt", "r")
# insert the texts in pdf
for g in file:
pdf.cell(200, 10, txt = g, ln = 1, align = 'C')
pdf.output("RECIPIE_2.pdf")
'''Scrapers available for:
https://www.acouplecooks.com
https://claudia.abril.com.br/
https://allrecipes.com/
https://alltommat.se/
https://amazingribs.com/
https://ambitiouskitchen.com/
https://archanaskitchen.com/
https://www.atelierdeschefs.fr/
https://averiecooks.com/
https://bbc.com/
https://bbc.co.uk/
https://bbcgoodfood.com/
https://bakingmischief.com/
https://bettycrocker.com/
https://bigoven.com/
https://blueapron.com/
https://bonappetit.com/
https://bowlofdelicious.com/
https://budgetbytes.com/
https://castironketo.net/
https://cdkitchen.com/
https://chefkoch.de/
https://closetcooking.com/
https://cookeatshare.com/
https://cookpad.com/
https://cookieandkate.com/
https://cookinglight.com/
https://cookstr.com/
https://copykat.com/
https://countryliving.com/
https://cucchiaio.it/
https://cuisineaz.com/
https://cybercook.com.br/
https://delish.com/
https://domesticate-me.com/
https://downshiftology.com/
https://www.dr.dk/
https://eatwhattonight.com/
https://www.eatingbirdfood.com/
https://eatsmarter.com/
https://eatsmarter.de/
https://epicurious.com/
https://recipes.farmhousedelivery.com/
https://fifteenspatulas.com/
https://finedininglovers.com/
https://fitmencook.com/
https://food.com/
https://food52.com/
https://foodandwine.com/
https://foodnetwork.com/
https://foodrepublic.com/
https://www.forksoverknives.com/
https://www.750g.com
https://geniuskitchen.com/
https://giallozafferano.it/
https://gimmesomeoven.com/
https://recietas.globo.com/
https://gonnawantseconds.com/
https://gousto.co.uk/
https://greatbritishchefs.com/
https://www.heb.com/
https://halfbakedharvest.com/
https://www.hassanchef.com/
https://heinzbrasil.com.br/
https://hellofresh.com/
https://hellofresh.co.uk/
https://www.hellofresh.de/
https://hostthetoast.com/
https://101cookbooks.com/
https://receitas.ig.com.br/
https://indianhealthyrecipes.com
https://www.innit.com/
https://inspiralized.com/
https://jamieoliver.com/
https://justbento.com/
https://kennymcgovern.com/
https://www.kingarthurbaking.com
https://kochbar.de/
https://kuchnia-domowa.pl/
https://lecremedelacrumb.com/
https://littlespicejar.com/
http://livelytable.com/
https://lovingitvegan.com/
https://marmiton.org/
https://www.marthastewart.com/
https://matprat.no/
https://www.melskitchencafe.com/
http://mindmegette.hu/
https://minimalistbaker.com/
https://misya.info/
https://momswithcrockpots.com/
http://motherthyme.com/
https://mybakingaddiction.com/
https://myrecipes.com/
https://healthyeating.nhlbi.nih.gov/
https://cooking.nytimes.com/
https://nourishedbynutrition.com/
https://nutritionbynathalie.com/blog
https://ohsheglows.com/
https://101cookbooks.com/
https://www.paleorunningmomma.com/
https://www.panelinha.com.br/
https://paninihappy.com/
https://popsugar.com/
https://przepisy.pl/
https://purelypope.com/
https://purplecarrot.com/
https://rachlmansfield.com/
https://realsimple.com/
https://recipietineats.com/
https://redhousespice.com/
https://reishunger.de/
https://www.saveur.com/
https://seriouseats.com/
https://simplyquinoa.com/
https://simplyrecipes.com/
https://simplywhisked.com/
https://skinnytaste.com/
https://southernliving.com/
https://spendwithpennies.com/
https://www.thespruceeats.com/
https://steamykitchen.com/
https://streetkitchen.hu/
https://sunbasket.com/
https://sweetcsdesigns.com/
https://sweetpeasandsaffron.com/
https://tasteofhome.com
https://tastesoflizzyt.com
https://tasty.co
https://tastykitchen.com/
https://theclevercarrot.com/
https://thehappyfoodie.co.uk/
https://thekitchn.com/
https://thenutritiouskitchen.co/
https://thepioneerwoman.com/
https://thespruceeats.com/
https://thevintagemixer.com/
https://thewoksoflife.com/
https://timesofindia.com/
https://tine.no/
https://tudogostoso.com.br/
https://twopeasandtheirpod.com/
https://vanillaandbean.com/
https://vegrecipesofindia.com/
https://vegolosi.it/
https://watchwhatueat.com/
https://whatsgabycooking.com/
https://www.wholefoodsmarket.com/
https://www.wholefoodsmarket.co.uk/
https://en.wikibooks.org/
https://yemek.com/
https://yummly.com/
'''
Comments
Post a Comment