mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-27 03:50:42 +03:00
983df45264
* [CourrierInternationalBridge] fix: skip unusual feed items #2570 This skips feed items who don't have content. The one I encountered was a horoscope. This change makes sure the bridge dont errors out.
26 lines
706 B
PHP
26 lines
706 B
PHP
<?php
|
|
class CourrierInternationalBridge extends FeedExpander {
|
|
|
|
const MAINTAINER = 'teromene';
|
|
const NAME = 'Courrier International Bridge';
|
|
const URI = 'https://www.courrierinternational.com/';
|
|
const CACHE_TIMEOUT = 300; // 5 min
|
|
const DESCRIPTION = 'Returns the newest articles';
|
|
|
|
public function collectData(){
|
|
$this->collectExpandableDatas(static::URI . 'feed/all/rss.xml', 20);
|
|
}
|
|
|
|
protected function parseItem($feedItem){
|
|
$item = parent::parseItem($feedItem);
|
|
|
|
$articlePage = getSimpleHTMLDOMCached($feedItem->link);
|
|
$content = $articlePage->find('.article-text, depeche-text', 0);
|
|
if (!$content) {
|
|
return $item;
|
|
}
|
|
$item['content'] = sanitize($content);
|
|
|
|
return $item;
|
|
}
|
|
}
|