

How do I know if a website has a Recipe Schema? Run in python shell:įrom recipe_scrapers import scrape_me scraper = scrape_me ( '', wild_mode = True ) # if no error is raised - there's schema available: scraper. In case you want to run a single unittest for a newly developed scraper python -m unittest tests.test_myscraper FAQ venv/bin/activate & python -m pip install -upgrade pip & pip install -r requirements-dev.txt & pip install pre-commit & pre-commit install & python -m unittest The content will be stored in test_data to be used with the test class.Īssuming you have >=python3.7 installed, navigate to the directory where you want this project to live in and drop these lines git clone & cd recipe-scrapers & python3 -m venv. URL: The URL of an example recipe from the target site. Generating a new scraper class: python generate.py ĬlassName: The name of the new scraper class.

If Schema is available on the site - you can go like this. You are a developer and want to code the scraper on your own: Open an Issue providing us the site name, as well as a recipe link from it. If you want a scraper for a new site added If you are programmer PRs with fixes are warmly welcomed and acknowledged with a virtual beer. 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. The attribute names are the dictionary keys. Scraper.links() returns a list of dictionaries containing all of the tag attributes. content scraper = scrape_html ( html = html, org_url = url ) scraper. You also have an option to scrape html-like content import requests from recipe_scrapers import scrape_html url = "" html = requests. scraper = scrape_me ( '', wild_mode = True ) scraper. Then: from recipe_scrapers import scrape_me scraper = scrape_me ( '' ) # 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. A simple web scraping tool for recipe sites.
