summaryrefslogtreecommitdiff
path: root/providers/Rss.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-02-02 19:41:46 +0100
committeremkael <emkael@tlen.pl>2018-02-02 19:41:46 +0100
commitab82beef33f4c196383a81213dcdff4ebe9447ae (patch)
treedde27a501a908e7b64451e2c9e71a1e8a0280b14 /providers/Rss.php
parent52aa40b9b8764da2872385fb4ff4155874b28c57 (diff)
Adding RollingStone feed and acommodating for its quirks
Diffstat (limited to 'providers/Rss.php')
-rw-r--r--providers/Rss.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/providers/Rss.php b/providers/Rss.php
index cc0aaf8..d12bc98 100644
--- a/providers/Rss.php
+++ b/providers/Rss.php
@@ -37,13 +37,13 @@ class Rss extends \Providers\Provider {
protected function _mapItems($content) {
$items = [];
foreach ($content as $contentString) {
- $item = new \SimpleXMLElement($contentString);
+ $item = new \SimpleXMLElement(str_replace('content:encoded>', 'content>', $contentString));
$itemObject = new Item();
$itemObject->ID = strval($item->id ?: $item->guid);
$itemObject->Title = strval($item->title);
$itemObject->Time = strval($item->published ?: $item->pubDate);
- $itemObject->Text = strval($item->summary ?: $item->description);
- $itemObject->Link = strval(is_string($item->link) ? $item->link : $item->link->attributes()['href']);
+ $itemObject->Text = strval($item->summary ?: $item->description ?: $item->content);
+ $itemObject->Link = strval(isset($item->link['href']) ? $item->link->attributes()['href'] : $item->link);
$itemObject->Author = strval(is_string($item->author) ? $item->author : $item->author->name);
$items[] = $itemObject;
}