1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-31 22:00:23 +02:00

[EconomistBridge] Fix if no article image present (#2328)

This commit is contained in:
Bockiii
2022-01-15 06:29:18 +01:00
committed by GitHub
parent 607d9297ff
commit 9dcce0ba1d

View File

@@ -99,8 +99,12 @@ class EconomistBridge extends FeedExpander {
$article = getSimpleHTMLDOM($item['uri']);
// before the article can be added, it needs to be cleaned up, thus, the extra function
$item['content'] = $this->cleanContent($article);
// only the article lead image is retained
$item['enclosures'][] = $article->find('div.article__lead-image', 0)->find('img', 0)->getAttribute('src');
// only the article lead image is retained if it's there
if (!is_null($article->find('div.article__lead-image', 0))) {
$item['enclosures'][] = $article->find('div.article__lead-image', 0)->find('img', 0)->getAttribute('src');
} else {
$item['enclosures'][] = '';
}
return $item;
}