Repository navigation
2.0.0
Tagged on 2019-07-19.
Pluggable parsers: the scraper now combines the results of one or more parsers.
Added
Tomaj\Scraper\Parser\ParserInterfaceand two parsers:OgParser(meta and Open Graph tags) andSchemaParser(the JSON-LD<script id="schema" type="application/ld+json">block: headline, description, image, url, authors, sections, published/modified dates).Meta::merge(): values missing in the first parser's result are filled from the next parsers.- Multiple authors and sections:
Meta::addAuthor()/getAuthors()andMeta::addSection()/getSections()(#2).
Changed
- BREAKING CHANGE: PHP 7.1 or newer is required.
- BREAKING CHANGE:
Scraper::parse($content, array $parsers)andScraper::parseUrl($url, array $parsers, $timeout = 5)require the list of parsers to use; pass[new OgParser()]for the 1.x behaviour. - BREAKING CHANGE:
Meta::setAuthor()/getAuthor()andMeta::setSection()/getSection()were replaced byaddAuthor()/getAuthors()(each author is an array withidandname) andaddSection()/getSections(). - BREAKING CHANGE:
MetaandScrapermethods declare scalar parameter and return types (declare(strict_types=1)).
Full Changelog: 1.5.0...2.0.0