summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2016-07-26 15:46:54 +0300
committerAndrew Dolgov <[email protected]>2016-07-26 15:46:54 +0300
commit76ba1df76e9ce3733c990e1d953706b691ee7b14 (patch)
treed5c340d31e9b8945c37fad601b50bad58e65d4c8 /plugins
parent18186149495108becf8e07344cbafef9110b5aa3 (diff)
af_redditimgur: use browser UA for readability requests
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/af_redditimgur/init.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php
index f32578450..1068ec548 100755
--- a/plugins/af_redditimgur/init.php
+++ b/plugins/af_redditimgur/init.php
@@ -349,24 +349,27 @@ class Af_RedditImgur extends Plugin {
/* link may lead to a huge video file or whatever, we need to check content type before trying to
parse it which p much requires curl */
+ $useragent_compat = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)";
+
$ch = curl_init($content_link->getAttribute("href"));
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("open_basedir"));
- curl_setopt($ch, CURLOPT_USERAGENT, SELF_USER_AGENT);
+ curl_setopt($ch, CURLOPT_USERAGENT, $useragent_compat);
@$result = curl_exec($ch);
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
if ($content_type && strpos($content_type, "text/html") !== FALSE) {
- $tmp = fetch_file_contents($content_link->getAttribute("href"));
+ $tmp = fetch_file_contents(array("url" => $content_link->getAttribute("href"),
+ "useragent" => $useragent_compat));
//_debug("tmplen: " . mb_strlen($tmp));
- if ($tmp && mb_strlen($tmp) < 65535 * 4) {
+ if ($tmp && mb_strlen($tmp) < 1024 * 250) {
$r = new Readability($tmp, $content_link->getAttribute("href"));