[GQMagazineBridge] Adapt to changes, fixes #1280

This commit is contained in:
Nicolas Delsaux 2019-09-06 10:51:13 +02:00 committed by Lyra
parent 38960df180
commit 0dfc4ea2c5

View file

@ -61,7 +61,7 @@ class GQMagazineBridge extends BridgeAbstract
private function findTitleOf($link) { private function findTitleOf($link) {
foreach (self::POSSIBLE_TITLES as $tag) { foreach (self::POSSIBLE_TITLES as $tag) {
$title = $link->find($tag, 0); $title = $link->parent()->find($tag, 0);
if($title !== null) { if($title !== null) {
if($title->plaintext !== null) { if($title->plaintext !== null) {
return $title->plaintext; return $title->plaintext;
@ -77,11 +77,13 @@ class GQMagazineBridge extends BridgeAbstract
// Since GQ don't want simple class scrapping, let's do it the hard way and ... discover content ! // Since GQ don't want simple class scrapping, let's do it the hard way and ... discover content !
$main = $html->find('main', 0); $main = $html->find('main', 0);
foreach ($main->find('a') as $link) { foreach ($main->find('a') as $link) {
if(strpos($link, $this->getInput('page')))
continue;
$uri = $link->href; $uri = $link->href;
$date = $link->find('time', 0); $date = $link->parent()->find('time', 0);
$item = array(); $item = array();
$author = $link->find('span[itemprop=name]', 0); $author = $link->parent()->find('span[itemprop=name]', 0);
if($author !== null) { if($author !== null) {
$item['author'] = $author->plaintext; $item['author'] = $author->plaintext;
$item['title'] = $this->findTitleOf($link); $item['title'] = $this->findTitleOf($link);