From: Andrew Dolgov Date: Wed, 20 Jun 2018 12:56:08 +0000 (+0300) Subject: Af_RedditImgur: update to use readability-php X-Git-Tag: 18.8~20 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b22766fcdd8d440d6f570ae4d00da52e7c45ee10;p=tt-rss.git Af_RedditImgur: update to use readability-php --- diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 4079a5b3..8a662de2 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -1,4 +1,7 @@ init()) { + try { + if ($r->parse($tmp)) { - $tmpxpath = new DOMXPath($r->dom); + $tmpxpath = new DOMXPath($r->getDOMDocument()); - $entries = $tmpxpath->query('(//a[@href]|//img[@src])'); + $entries = $tmpxpath->query('(//a[@href]|//img[@src])'); - foreach ($entries as $entry) { - if ($entry->hasAttribute("href")) { - $entry->setAttribute("href", - rewrite_relative_url($url, $entry->getAttribute("href"))); + foreach ($entries as $entry) { + if ($entry->hasAttribute("href")) { + $entry->setAttribute("href", + rewrite_relative_url($url, $entry->getAttribute("href"))); - } + } - if ($entry->hasAttribute("src")) { - $entry->setAttribute("src", - rewrite_relative_url($url, $entry->getAttribute("src"))); + if ($entry->hasAttribute("src")) { + $entry->setAttribute("src", + rewrite_relative_url($url, $entry->getAttribute("src"))); + + } } + $article["content"] = $r->getContent() . "
" . $article["content"]; } - - $article["content"] = $r->articleContent->innerHTML . "
" . $article["content"]; + } catch (ParseException $e) { + // } } }