Skip to content

Commit

Permalink
[GQMagazineBridge] Adapt to changes, fixes RSS-Bridge#1280
Browse files Browse the repository at this point in the history
  • Loading branch information
Riduidel authored and teromene committed Sep 6, 2019
1 parent 99becf9 commit 753735b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bridges/GQMagazineBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getURI()

private function findTitleOf($link) {
foreach (self::POSSIBLE_TITLES as $tag) {
$title = $link->find($tag, 0);
$title = $link->parent()->find($tag, 0);
if($title !== null) {
if($title->plaintext !== null) {
return $title->plaintext;
Expand All @@ -77,11 +77,13 @@ public function collectData()
// Since GQ don't want simple class scrapping, let's do it the hard way and ... discover content !
$main = $html->find('main', 0);
foreach ($main->find('a') as $link) {
if(strpos($link, $this->getInput('page')))
continue;
$uri = $link->href;
$date = $link->find('time', 0);
$date = $link->parent()->find('time', 0);

$item = array();
$author = $link->find('span[itemprop=name]', 0);
$author = $link->parent()->find('span[itemprop=name]', 0);
if($author !== null) {
$item['author'] = $author->plaintext;
$item['title'] = $this->findTitleOf($link);
Expand Down

0 comments on commit 753735b

Please sign in to comment.