af_redditimgur: import link flair as tags
This commit is contained in:
parent
bc7cb76379
commit
b1961163b8
|
@ -244,6 +244,7 @@ class Af_RedditImgur extends Plugin {
|
|||
$post_is_nsfw = false;
|
||||
$num_comments = 0;
|
||||
$score = 0;
|
||||
$link_flairs = [];
|
||||
$apply_nsfw_tags = FeedItem_Common::normalize_categories($this->host->get_array($this, "apply_nsfw_tags", []));
|
||||
|
||||
// embed before reddit <table> post layout
|
||||
|
@ -275,6 +276,10 @@ class Af_RedditImgur extends Plugin {
|
|||
$score += $data['score'] ?? 0;
|
||||
$num_comments += $data["num_comments"] ?? 0;
|
||||
|
||||
if (!empty($data["link_flair_text"])) {
|
||||
array_push($link_flairs, $data["link_flair_text"]);
|
||||
}
|
||||
|
||||
if ($over_18) {
|
||||
Debug::log("JSON: post is NSFW", Debug::$LOG_EXTENDED);
|
||||
$post_is_nsfw = true;
|
||||
|
@ -317,6 +322,10 @@ class Af_RedditImgur extends Plugin {
|
|||
$article["tags"] = array_merge($article["tags"], $apply_nsfw_tags);
|
||||
}
|
||||
|
||||
if (count($link_flairs) > 0) {
|
||||
$article["tags"] = array_merge($article["tags"], FeedItem_Common::normalize_categories($link_flairs));
|
||||
}
|
||||
|
||||
$article["num_comments"] = $num_comments;
|
||||
|
||||
if ($import_score && $score > 0)
|
||||
|
@ -694,8 +703,8 @@ class Af_RedditImgur extends Plugin {
|
|||
|
||||
function testurl() {
|
||||
|
||||
$url = clean($_POST["url"]);
|
||||
$article_url = clean($_POST["article_url"]);
|
||||
$url = clean($_POST["url"] ?? "");
|
||||
$article_url = clean($_POST["article_url"] ?? "");
|
||||
|
||||
$this->dump_json_data = true;
|
||||
|
||||
|
@ -743,6 +752,8 @@ class Af_RedditImgur extends Plugin {
|
|||
|
||||
Debug::log("Inline result: $found", Debug::$LOG_VERBOSE);
|
||||
|
||||
print_r($article);
|
||||
|
||||
if (!$found) {
|
||||
Debug::log("Readability result:", Debug::$LOG_VERBOSE);
|
||||
|
||||
|
|
Loading…
Reference in New Issue