Skip to content

Releases

4.3.0

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39
23c5e83

Tagged on 2020-11-23.

Added

  • Tomaj\Scraper\Parser\OgDomParser: parses the same meta and Open Graph tags as OgParser with the DOM extension instead of regular expressions (needs ext-dom and ext-libxml) (#7).
  • Meta::addAuthorByName() and Meta::addSectionByName().

Full Changelog: 4.2.0...4.3.0

4.2.0

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39
4670dc0

Tagged on 2020-11-21.

Added

  • Guzzle 7 support (guzzlehttp/guzzle ^6.0 | ^7.0).
  • OgParser reads meta tags whose attributes use single quotes (#6).

Changed

  • Autoloading switched from a classmap to PSR-4 (Tomaj\Scraper\ → src/).

Full Changelog: 4.1.0...4.2.0

4.1.0

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39
e9c3f13

Tagged on 2020-06-05.

Added

  • Tags: Tomaj\Scraper\Tag, Meta::addTag() / getTags(). SchemaParser fills them from the schema about field; Meta::merge() merges them (#5).

Full Changelog: 4.0.0...4.1.0

4.0.0

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39
95bc9be

Tagged on 2020-05-06.

Added

  • Scraper::__construct(array $guzzleOptions = []) passes options to the Guzzle client (merged with the defaults: 5 second connect timeout and the Tomaj\Scraper User-Agent) (#4).

Changed

  • BREAKING CHANGE: the $timeout parameter of Scraper::parseUrl() was removed; pass new Scraper(['connect_timeout' => 10]) instead.
  • OgParser also matches meta tags whose content attribute is not the last one.

Full Changelog: 3.0.0...4.0.0

3.0.0

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39
c6f0230

Tagged on 2019-08-13.

Added

  • Tomaj\Scraper\Author and Tomaj\Scraper\Section value objects with id() and name().
  • SchemaParser reads sections (with their ids) from articleTerms entries of type Category; articleSection is used when articleTerms is missing.

Changed

  • BREAKING CHANGE: Meta::addAuthor() takes an Author and Meta::addSection() takes a Section; getAuthors() / getSections() return these objects instead of arrays / strings. Replace $author['name'] with $author->name() and $author['id'] with $author->id().

Full Changelog: 2.0.1...3.0.0

2.0.1

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39

Tagged on 2019-07-22.

Fixed

  • SchemaParser no longer raises an "Undefined offset" notice on pages without a schema block (#3).

Full Changelog: 2.0.0...2.0.1

2.0.0

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39

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

1.5.0

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39

Tagged on 2018-05-18.

Changed

  • Meta tags are parsed in one pass: every <meta> tag is read once and its name or property attribute (case-insensitive) is mapped to the Meta fields, so attribute order no longer matters.

Full Changelog: 1.4.0...1.5.0

1.4.0

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39

Tagged on 2018-05-18.

Changed

  • <title> tags with attributes and meta tags with additional attributes (e.g. <meta itemprop="..." name="description" content="...">) are now recognised.

Full Changelog: 1.3.0...1.4.0

1.3.0

Choose a tag to compare

@tomaj tomaj released this 22 Nov 12:39

Tagged on 2017-01-23.

Fixed

  • An article:published_time / article:modified_time value that strtotime() cannot parse is ignored instead of being stored as 1970-01-01.

Full Changelog: 1.2.1...1.3.0