af_redditimgur: check content-type before downloading data for og:image and imgur pages
This commit is contained in:
parent
204f92b926
commit
831648e3c8
|
@ -496,6 +496,10 @@ class Af_RedditImgur extends Plugin {
|
||||||
|
|
||||||
Debug::log("handling as imgur page/whatever", Debug::LOG_VERBOSE);
|
Debug::log("handling as imgur page/whatever", Debug::LOG_VERBOSE);
|
||||||
|
|
||||||
|
$content_type = $this->get_content_type($entry_href);
|
||||||
|
|
||||||
|
if ($content_type && strpos($content_type, "text/html") !== false) {
|
||||||
|
|
||||||
$content = UrlHelper::fetch(["url" => $entry_href,
|
$content = UrlHelper::fetch(["url" => $entry_href,
|
||||||
"http_accept" => "text/*"]);
|
"http_accept" => "text/*"]);
|
||||||
|
|
||||||
|
@ -521,6 +525,10 @@ class Af_RedditImgur extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Debug::log("skipping imgur $entry_href because of content type: $content_type", Debug::LOG_VERBOSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// wtf is this even
|
// wtf is this even
|
||||||
|
@ -543,6 +551,10 @@ class Af_RedditImgur extends Plugin {
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
Debug::log("looking for meta og:image", Debug::LOG_VERBOSE);
|
Debug::log("looking for meta og:image", Debug::LOG_VERBOSE);
|
||||||
|
|
||||||
|
$content_type = $this->get_content_type($entry_href);
|
||||||
|
|
||||||
|
if ($content_type && strpos($content_type, "text/html") !== false) {
|
||||||
|
|
||||||
$content = UrlHelper::fetch(["url" => $entry_href,
|
$content = UrlHelper::fetch(["url" => $entry_href,
|
||||||
"http_accept" => "text/*"]);
|
"http_accept" => "text/*"]);
|
||||||
|
|
||||||
|
@ -591,6 +603,9 @@ class Af_RedditImgur extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Debug::log("BODY: skipping $entry_href because of content type: $content_type", Debug::LOG_VERBOSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue