From 6c546f37ba5271f0e1af98947bc3e59f8a8de2fc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Jan 2021 08:57:36 +0300 Subject: [PATCH] af_redditimgur: handle youtube /embed/ URLs --- plugins/af_redditimgur/init.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 1bf88f02a..6eb530e27 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -354,6 +354,7 @@ class Af_RedditImgur extends Plugin { $matches = array(); if (!$found && (preg_match("/youtube\.com\/v\/([\w-]+)/", $entry_href, $matches) || preg_match("/youtube\.com\/.*?[\&\?]v=([\w-]+)/", $entry_href, $matches) || + preg_match("/youtube\.com\/embed\/([\w-]+)/", $entry_href, $matches) || preg_match("/youtube\.com\/watch\?v=([\w-]+)/", $entry_href, $matches) || preg_match("/\/\/youtu.be\/([\w-]+)/", $entry_href, $matches))) { @@ -490,9 +491,6 @@ class Af_RedditImgur extends Plugin { } } } - - if ($found) - $this->remove_post_thumbnail($doc, $xpath); } if (!$found && $anchor && count($this->fallback_preview_urls) > 0) { @@ -505,6 +503,9 @@ class Af_RedditImgur extends Plugin { } } + if ($found) + $this->remove_post_thumbnail($doc, $xpath); + return $found; }