diff options
author | Andrew Dolgov <[email protected]> | 2017-09-16 10:08:30 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-09-16 10:08:30 +0300 |
commit | 06a19166bda1505eaab655299a36cca3d12cc8cd (patch) | |
tree | 22bcb595cab030cc6007506f218744fba45a264b | |
parent | 7cadef1effd741968012ccdf4397af6d1d4c62a2 (diff) |
af_redditimgur: add basic support for v.redd.it videos
-rwxr-xr-x | plugins/af_redditimgur/init.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index ac23a4fa3..c872b429a 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -79,6 +79,7 @@ class Af_RedditImgur extends Plugin { private function inline_stuff($article, &$doc, $xpath, $debug = false) { $entries = $xpath->query('(//a[@href]|//img[@src])'); + $img_entries = $xpath->query("(//img[@src])"); $found = false; @@ -146,6 +147,24 @@ class Af_RedditImgur extends Plugin { } } + if (!$found && preg_match("/https?:\/\/v\.redd\.it\/(.*)$/i", $entry->getAttribute("href"), $matches)) { + + _debug("Handling as reddit inline video", $debug); + + $img = $img_entries->item(0); + + if ($img) { + $poster_url = $img->getAttribute("src"); + } else { + $poster_url = false; + } + + $source_stream = "https://v.redd.it/" . $matches[1] . "/DASH_600_K"; + + $this->handle_as_video($doc, $entry, $source_stream, $poster_url); + $found = 1; + } + if (!$found && preg_match("/https?:\/\/(www\.)?streamable.com\//i", $entry->getAttribute("href"))) { _debug("Handling as Streamable", $debug); |