1
0
mirror of https://tt-rss.org/git/tt-rss.git synced 2024-06-27 12:05:06 +02:00

Merge branch 'tumblr_hd_videos' of Self-Perfection/tt-rss into master

This commit is contained in:
fox 2018-07-15 09:04:09 +00:00 committed by Gogs
commit 331ded21ba

View File

@ -4,7 +4,7 @@ class Af_Tumblr_1280 extends Plugin {
function about() {
return array(1.0,
"Replace Tumblr pictures with largest size if available (requires CURL)",
"Replace Tumblr pictures and videos with largest size if available (requires CURL)",
"fox");
}
@ -64,6 +64,19 @@ class Af_Tumblr_1280 extends Plugin {
}
}
$video_sources = $xpath->query('//video/source[contains(@src, \'.tumblr.com/video_file\')]');
foreach ($video_sources as $source) {
$src = $source->getAttribute("src");
$new_src = preg_replace("/\/\d{3}$/", "", $src);
if ($src != $new_src) {
$source->setAttribute("src", $new_src);
$found = true;
}
}
if ($found) {
$doc->removeChild($doc->firstChild); //remove doctype
$article["content"] = $doc->saveHTML();