[CourrierInternationalBridge] fix: don't break on unusual feed items #2570 (#2571)

* [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.
This commit is contained in:
dag 2022-03-31 17:01:11 +02:00 committed by GitHub
parent 8717c33646
commit 983df45264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -15,11 +15,10 @@ class CourrierInternationalBridge extends FeedExpander {
$item = parent::parseItem($feedItem);
$articlePage = getSimpleHTMLDOMCached($feedItem->link);
$content = $articlePage->find('.article-text', 0);
if(!$content) {
$content = $articlePage->find('.depeche-text', 0);
$content = $articlePage->find('.article-text, depeche-text', 0);
if (!$content) {
return $item;
}
$item['content'] = sanitize($content);
return $item;