diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 35eb40950..b16b679af 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -7,6 +7,7 @@ class Af_RedditImgur extends Plugin { private $dump_json_data = false; private $fallback_preview_urls = []; private $default_max_score = 100; + private $generated_enclosures = []; function about() { return array(null, @@ -247,6 +248,8 @@ class Af_RedditImgur extends Plugin { $link_flairs = []; $apply_nsfw_tags = FeedItem_Common::normalize_categories($this->host->get_array($this, "apply_nsfw_tags", [])); + $this->generated_enclosures = []; + // embed anchor element, before reddit
- if ($anchor) - $anchor->parentNode->insertBefore($iframe, $anchor); - else - $entry->parentNode->insertBefore($iframe, $entry); + /* push generated video URL to enclosures so that youtube embed plugins would deal with it later (if enabled) */ + $this->generated_enclosures[] = [$video_url, "text/html", null, null, '', '']; $found = true; } @@ -635,7 +625,7 @@ class Af_RedditImgur extends Plugin { if ($node && $found) { $article["content"] = $doc->saveHTML($node); - $article["enclosures"] = []; + $article["enclosures"] = $this->generated_enclosures; } else if ($content_link) { $article = $this->readability($article, $content_link->getAttribute("href"), $doc, $xpath); } |