summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-09-09 12:45:02 +0300
committerAndrew Dolgov <[email protected]>2018-09-09 12:45:02 +0300
commitf43ce66e65aed5cfed7182ed6ff04646c4ffd335 (patch)
tree1f07e23bd49f93c28983e9dd5962624a2bca8631 /plugins
parent5a35b31b897f8dc76513c534c2424797d6b0d192 (diff)
af_redditimgur: simplify handling of gfycat URLs
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/af_redditimgur/init.php23
1 files changed, 4 insertions, 19 deletions
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php
index b46428677..270f1beb2 100755
--- a/plugins/af_redditimgur/init.php
+++ b/plugins/af_redditimgur/init.php
@@ -132,26 +132,11 @@ class Af_RedditImgur extends Plugin {
_debug("Handling as Gfycat", $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,'share-video')]//source[contains(@src, '.mp4')]")->item(0);
- $poster_node = $tmpxpath->query("//video[contains(@class,'share-video') and @poster]")->item(0);
+ $source_stream = 'https://giant.gfycat.com/' . $matches[2] . '.mp4';
+ $poster_url = 'https://thumbs.gfycat.com/' . $matches[2] . '-mobile.jpg';
- 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;
- }
- }
- }
+ $this->handle_as_video($doc, $entry, $source_stream, $poster_url);
+ $found = 1;
}
if (!$found && preg_match("/https?:\/\/v\.redd\.it\/(.*)$/i", $entry->getAttribute("href"), $matches)) {