summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-02 21:32:20 +0300
committerAndrew Dolgov <[email protected]>2021-03-02 21:32:20 +0300
commit3b67abb0ea44358b0740381a49cac28857153787 (patch)
tree785d5d1dc99bb522696ad14c86ea8bde6330ec09
parent6f93c45c2841ad8ca3b5b5eda94407835cb92ade (diff)
reddit: import comment counts
-rwxr-xr-xplugins/af_redditimgur/init.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php
index 79188b89e..e574c831c 100755
--- a/plugins/af_redditimgur/init.php
+++ b/plugins/af_redditimgur/init.php
@@ -217,6 +217,7 @@ class Af_RedditImgur extends Plugin {
$found = false;
$post_is_nsfw = false;
+ $num_comments = 0;
$apply_nsfw_tags = FeedItem_Common::normalize_categories($this->host->get_array($this, "apply_nsfw_tags", []));
// embed before reddit <table> post layout
@@ -245,6 +246,8 @@ class Af_RedditImgur extends Plugin {
$data = $child["data"];
$over_18 = $data["over_18"] ?? 0 == 1;
+ $num_comments += $data["num_comments"] ?? 0;
+
if ($over_18) {
Debug::log("JSON: post is NSFW", Debug::$LOG_EXTENDED);
$post_is_nsfw = true;
@@ -287,6 +290,8 @@ class Af_RedditImgur extends Plugin {
$article["tags"] = array_merge($article["tags"], $apply_nsfw_tags);
}
+ $article["num_comments"] = $num_comments;
+
if ($found) {
Debug::log("JSON: found media data, skipping further processing of content", Debug::$LOG_VERBOSE);
$this->remove_post_thumbnail($doc, $xpath);