mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-15 00:14:45 +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:
parent
e55e9b8fac
commit
b8a9f34527
5 changed files with 39 additions and 20 deletions
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue