mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-20 16:31:28 +00:00
af_redditimgur: don't try to load empty html; fix a warning in update debugger
This commit is contained in:
@@ -772,7 +772,7 @@ class Feeds extends Handler_Protected {
|
|||||||
Debug::set_loglevel($xdebug);
|
Debug::set_loglevel($xdebug);
|
||||||
|
|
||||||
$feed_id = (int)$_REQUEST["feed_id"];
|
$feed_id = (int)$_REQUEST["feed_id"];
|
||||||
@$do_update = $_REQUEST["action"] == "do_update";
|
$do_update = ($_REQUEST["action"] ?? "") == "do_update";
|
||||||
$csrf_token = $_POST["csrf_token"];
|
$csrf_token = $_POST["csrf_token"];
|
||||||
|
|
||||||
$sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE id = ? AND owner_uid = ?");
|
$sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE id = ? AND owner_uid = ?");
|
||||||
|
|||||||
@@ -515,9 +515,10 @@ class Af_RedditImgur extends Plugin {
|
|||||||
|
|
||||||
function hook_article_filter($article) {
|
function hook_article_filter($article) {
|
||||||
|
|
||||||
if (strpos($article["link"], "reddit.com/r/") !== false) {
|
if (strpos($article["link"], "reddit.com/r/") !== false && !empty($article["content"])) {
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
@$doc->loadHTML($article["content"]);
|
|
||||||
|
if (@$doc->loadHTML($article["content"])) {
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
|
|
||||||
$content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0);
|
$content_link = $xpath->query("(//a[contains(., '[link]')])")->item(0);
|
||||||
@@ -567,6 +568,7 @@ class Af_RedditImgur extends Plugin {
|
|||||||
$article = $this->readability($article, $content_link->getAttribute("href"), $doc, $xpath);
|
$article = $this->readability($article, $content_link->getAttribute("href"), $doc, $xpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $article;
|
return $article;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user