From: Andrew Dolgov Date: Fri, 10 Jul 2015 23:08:53 +0000 (+0300) Subject: af_redditimgur: some additional .gif -> mp4 rewriting X-Git-Tag: 16.3~232^2~20 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=5f297a5c111e3abecd143b6412a753ea870e4f20;p=tt-rss.git af_redditimgur: some additional .gif -> mp4 rewriting --- diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index c4ec265d..fd750220 100644 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -80,6 +80,10 @@ class Af_RedditImgur extends Plugin { $matches = array(); + if (preg_match("/\.gfycat.com\/([a-z]+)?(\.[a-z]+)$/i", $entry->getAttribute("href"), $matches)) { + $entry->setAttribute("href", "http://www.gfycat.com/".$matches[1]); + } + if (preg_match("/https?:\/\/(www\.)?gfycat.com\/([a-z]+)$/i", $entry->getAttribute("href"), $matches)) { $tmp = fetch_file_contents($entry->getAttribute("href")); @@ -112,6 +116,12 @@ class Af_RedditImgur extends Plugin { } + // imgur .gif -> .gifv + if (preg_match("/i\.imgur\.com\/(.*?)\.gif$/i", $entry->getAttribute("href"))) { + $entry->setAttribute("href", + str_replace(".gif", ".gifv", $entry->getAttribute("href"))); + } + if (preg_match("/\.(gifv)$/i", $entry->getAttribute("href"))) { $source_stream = str_replace(".gifv", ".mp4", $entry->getAttribute("href"));