reddit: import comment counts
This commit is contained in:
parent
6f93c45c28
commit
3b67abb0ea
|
@ -217,6 +217,7 @@ class Af_RedditImgur extends Plugin {
|
||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
$post_is_nsfw = false;
|
$post_is_nsfw = false;
|
||||||
|
$num_comments = 0;
|
||||||
$apply_nsfw_tags = FeedItem_Common::normalize_categories($this->host->get_array($this, "apply_nsfw_tags", []));
|
$apply_nsfw_tags = FeedItem_Common::normalize_categories($this->host->get_array($this, "apply_nsfw_tags", []));
|
||||||
|
|
||||||
// embed before reddit <table> post layout
|
// embed before reddit <table> post layout
|
||||||
|
@ -245,6 +246,8 @@ class Af_RedditImgur extends Plugin {
|
||||||
$data = $child["data"];
|
$data = $child["data"];
|
||||||
$over_18 = $data["over_18"] ?? 0 == 1;
|
$over_18 = $data["over_18"] ?? 0 == 1;
|
||||||
|
|
||||||
|
$num_comments += $data["num_comments"] ?? 0;
|
||||||
|
|
||||||
if ($over_18) {
|
if ($over_18) {
|
||||||
Debug::log("JSON: post is NSFW", Debug::$LOG_EXTENDED);
|
Debug::log("JSON: post is NSFW", Debug::$LOG_EXTENDED);
|
||||||
$post_is_nsfw = true;
|
$post_is_nsfw = true;
|
||||||
|
@ -287,6 +290,8 @@ class Af_RedditImgur extends Plugin {
|
||||||
$article["tags"] = array_merge($article["tags"], $apply_nsfw_tags);
|
$article["tags"] = array_merge($article["tags"], $apply_nsfw_tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$article["num_comments"] = $num_comments;
|
||||||
|
|
||||||
if ($found) {
|
if ($found) {
|
||||||
Debug::log("JSON: found media data, skipping further processing of content", Debug::$LOG_VERBOSE);
|
Debug::log("JSON: found media data, skipping further processing of content", Debug::$LOG_VERBOSE);
|
||||||
$this->remove_post_thumbnail($doc, $xpath);
|
$this->remove_post_thumbnail($doc, $xpath);
|
||||||
|
|
Loading…
Reference in New Issue