Skip to content

2.0.0

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39
· 36 commits to master since this release

Tagged on 2019-07-19.

Pluggable parsers: the scraper now combines the results of one or more parsers.

Added

  • Tomaj\Scraper\Parser\ParserInterface and two parsers: OgParser (meta and Open Graph tags) and SchemaParser (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() and Meta::addSection() / getSections() (#2).

Changed

  • BREAKING CHANGE: PHP 7.1 or newer is required.
  • BREAKING CHANGE: Scraper::parse($content, array $parsers) and Scraper::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() and Meta::setSection() / getSection() were replaced by addAuthor() / getAuthors() (each author is an array with id and name) and addSection() / getSections().
  • BREAKING CHANGE: Meta and Scraper methods declare scalar parameter and return types (declare(strict_types=1)).

Full Changelog: 1.5.0...2.0.0