1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-15 22:26:00 +00:00

af_redditimgur: don't try to load empty html; fix a warning in update debugger

This commit is contained in:
Andrew Dolgov
2021-02-06 10:31:06 +03:00
parent ce489a724b
commit 5849a39820
2 changed files with 38 additions and 36 deletions

View File

@@ -772,7 +772,7 @@ class Feeds extends Handler_Protected {
Debug::set_loglevel($xdebug);
$feed_id = (int)$_REQUEST["feed_id"];
@$do_update = $_REQUEST["action"] == "do_update";
$do_update = ($_REQUEST["action"] ?? "") == "do_update";
$csrf_token = $_POST["csrf_token"];
$sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE id = ? AND owner_uid = ?");

View File

@@ -515,9 +515,10 @@ class Af_RedditImgur extends Plugin {
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->loadHTML($article["content"]);
if (@$doc->loadHTML($article["content"])) {
$xpath = new DOMXPath($doc);
$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);
}
}
}
return $article;
}