mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-03 23:27:32 +02:00
fix(FeedParser): scrape out content from rss content:encoded (#4178)
* fix(FeedParser): parse content module from rss2 * refactor
This commit is contained in:
@@ -186,21 +186,26 @@ class FeedItem
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|object $content The item content as text or simple_html_dom object.
|
||||
* @param string|array|\simple_html_dom|\simple_html_dom_node $content The item content
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = null;
|
||||
|
||||
if (
|
||||
$content instanceof simple_html_dom
|
||||
|| $content instanceof simple_html_dom_node
|
||||
) {
|
||||
$content = (string) $content;
|
||||
} elseif (is_array($content)) {
|
||||
// Assuming this is the rss2.0 content module
|
||||
$content = $content['encoded'] ?? '';
|
||||
}
|
||||
|
||||
if (is_string($content)) {
|
||||
$this->content = $content;
|
||||
} else {
|
||||
Debug::log(sprintf('Feed content must be a string but got %s', gettype($content)));
|
||||
Debug::log(sprintf('Unable to convert feed content to string: %s', gettype($content)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user