summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-01-29 14:36:37 +0300
committerAndrew Dolgov <[email protected]>2017-01-29 14:36:37 +0300
commit60e97d9e63df7cdbf6fc9ece09ae4bb79e4a5272 (patch)
treeb4557abc6698cd4316b0495a818eced3e20a5343 /plugins
parentf45a1152bb246f823251b243c5dceeeca752a2ba (diff)
af_redditimgur: inline streamable.com videos
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/af_redditimgur/init.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php
index 7ab07b900..29ea329ad 100755
--- a/plugins/af_redditimgur/init.php
+++ b/plugins/af_redditimgur/init.php
@@ -152,6 +152,32 @@ class Af_RedditImgur extends Plugin {
}
}
+ if (!$found && preg_match("/https?:\/\/(www\.)?streamable.com\//i", $entry->getAttribute("href"))) {
+
+ _debug("Handling as Streamable", $debug);
+
+ $tmp = fetch_file_contents($entry->getAttribute("href"));
+
+ if ($tmp) {
+ $tmpdoc = new DOMDocument();
+
+ if (@$tmpdoc->loadHTML($tmp)) {
+ $tmpxpath = new DOMXPath($tmpdoc);
+
+ $source_node = $tmpxpath->query("//video[contains(@class,'video-player-tag')]//source[contains(@src, '.mp4')]")->item(0);
+ $poster_node = $tmpxpath->query("//video[contains(@class,'video-player-tag') and @poster]")->item(0);
+
+ if ($source_node && $poster_node) {
+ $source_stream = $source_node->getAttribute("src");
+ $poster_url = $poster_node->getAttribute("poster");
+
+ $this->handle_as_video($doc, $entry, $source_stream, $poster_url);
+ $found = 1;
+ }
+ }
+ }
+ }
+
// imgur .gif -> .gifv
if (!$found && preg_match("/i\.imgur\.com\/(.*?)\.gif$/i", $entry->getAttribute("href"))) {
_debug("Handling as imgur gif (->gifv)", $debug);