Download the PHP package ssnepenthe/recipe-scraper without Composer
On this page you can find all versions of the php package ssnepenthe/recipe-scraper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ssnepenthe/recipe-scraper
More information about ssnepenthe/recipe-scraper
Files in ssnepenthe/recipe-scraper
Package recipe-scraper
Short Description A recipe scraping library.
License GPL-2.0
Homepage https://github.com/ssnepenthe/recipe-scraper
Informations about the package recipe-scraper
recipe-scraper
A recipe scraping library which makes it easy to scrape recipes from popular sites around the web.
Current site support is still limited. A full list is available in SITE-SUPPORT.md.
Requirements
Composer, PHP 7.0 or later.
Installation
Usage
Scraper instances work on Symfony DomCrawler instances. These can be created however you choose, but the easiest is to use a BrowserKit implementation like Goutte:
If you only need to scrape recipes from a single site, you can use the corresponding class from src/Scrapers
:
If you want to be able to scrape recipes from all supported sites, create a DelegatingScraper
using the Factory
class:
Check whether a scraper supports a given crawler using the ->supports()
method:
Finally, scrape a recipe by passing the crawler to the ->scrape()
method:
The following properties are guaranteed to be set on the $recipe
array:
If the ->scrape()
method is called on an unsupported crawler instance, all values in $recipe
will be null.
Altogether:
OUTPUT:
Limitations
Scraping seems to be (unfortunately) the best option available for extracting structured recipes from the sites supported by this scraper.
Just keep in mind that any template updates to the target site have a very high chance of breaking this scraper.
If you notice support for a particular site is broken, please submit an issue or pull request.
For this same reason, it may be preferable to track the master branch of this repo, although I will try to tag a new release after any site-specific updates.
All versions of recipe-scraper with dependencies
danielstjules/stringy Version ^2.0|^3.0
symfony/css-selector Version ^3.0|^4.0|^5.0
symfony/dom-crawler Version ^3.1|^4.0