af_redditimgur: handle youtube /embed/ URLs

This commit is contained in:
Andrew Dolgov 2021-01-23 08:57:36 +03:00
parent 43e9dd5ea9
commit 6c546f37ba
1 changed files with 4 additions and 3 deletions

View File

@ -354,6 +354,7 @@ class Af_RedditImgur extends Plugin {
$matches = array(); $matches = array();
if (!$found && (preg_match("/youtube\.com\/v\/([\w-]+)/", $entry_href, $matches) || if (!$found && (preg_match("/youtube\.com\/v\/([\w-]+)/", $entry_href, $matches) ||
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("/youtube\.com\/watch\?v=([\w-]+)/", $entry_href, $matches) ||
preg_match("/\/\/youtu.be\/([\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) { 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; return $found;
} }