mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-09 16:38:50 +00:00
[RoadAndTrack] fix: broken css selectors (#2642)
This commit is contained in:
parent
563c099d80
commit
f9801a5c58
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class RoadAndTrackBridge extends BridgeAbstract {
|
class RoadAndTrackBridge extends BridgeAbstract {
|
||||||
const MAINTAINER = 'teromene';
|
const MAINTAINER = 'teromene';
|
||||||
const NAME = 'Road And Track Bridge';
|
const NAME = 'Road And Track Bridge';
|
||||||
@ -10,17 +11,15 @@ class RoadAndTrackBridge extends BridgeAbstract {
|
|||||||
|
|
||||||
$page = getSimpleHTMLDOM(self::URI);
|
$page = getSimpleHTMLDOM(self::URI);
|
||||||
|
|
||||||
//Process the first element
|
$limit = 5;
|
||||||
$firstArticleLink = $page->find('.custom-promo-title', 0)->href;
|
|
||||||
$this->items[] = $this->fetchArticle($firstArticleLink);
|
|
||||||
|
|
||||||
$limit = 19;
|
foreach($page->find('a.enk2x9t2') as $article) {
|
||||||
foreach($page->find('.full-item-title') as $article) {
|
|
||||||
$this->items[] = $this->fetchArticle($article->href);
|
$this->items[] = $this->fetchArticle($article->href);
|
||||||
$limit -= 1;
|
|
||||||
if($limit == 0) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (count($this->items) >= $limit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function fixImages($content) {
|
private function fixImages($content) {
|
||||||
@ -36,7 +35,6 @@ class RoadAndTrackBridge extends BridgeAbstract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $enclosures;
|
return $enclosures;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function fetchArticle($articleLink) {
|
private function fetchArticle($articleLink) {
|
||||||
@ -45,13 +43,19 @@ class RoadAndTrackBridge extends BridgeAbstract {
|
|||||||
$article = getSimpleHTMLDOM($articleLink);
|
$article = getSimpleHTMLDOM($articleLink);
|
||||||
$item = array();
|
$item = array();
|
||||||
|
|
||||||
$item['title'] = $article->find('.content-hed', 0)->innertext;
|
$title = $article->find('.content-hed', 0);
|
||||||
|
if ($title) {
|
||||||
|
$item['title'] = $title->innertext;
|
||||||
|
}
|
||||||
|
|
||||||
$item['author'] = $article->find('.byline-name', 0)->innertext;
|
$item['author'] = $article->find('.byline-name', 0)->innertext;
|
||||||
$item['timestamp'] = strtotime($article->find('.content-info-date', 0)->getAttribute('datetime'));
|
$item['timestamp'] = strtotime($article->find('.content-info-date', 0)->getAttribute('datetime'));
|
||||||
|
|
||||||
$content = $article->find('.content-container', 0);
|
$content = $article->find('.content-container', 0);
|
||||||
if($content->find('.content-rail', 0) !== null)
|
if($content->find('.content-rail', 0) !== null) {
|
||||||
$content->find('.content-rail', 0)->innertext = '';
|
$content->find('.content-rail', 0)->innertext = '';
|
||||||
|
}
|
||||||
|
|
||||||
$enclosures = $this->fixImages($content);
|
$enclosures = $this->fixImages($content);
|
||||||
|
|
||||||
$item['enclosures'] = $enclosures;
|
$item['enclosures'] = $enclosures;
|
||||||
|
Loading…
Reference in New Issue
Block a user