From de34dac6cc3467280bc99b01e9ecf7470161a5d0 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 26 Jan 2021 09:56:28 +0000 Subject: port youtube embed fix from zap --- include/oembed.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/oembed.php') diff --git a/include/oembed.php b/include/oembed.php index eeae7a174..1550eaacf 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -189,6 +189,13 @@ function oembed_fetch_url($embedurl){ $entries = $xpath->query("//link[@type='application/json+oembed']"); foreach($entries as $e){ $href = $e->getAttributeNode("href")->nodeValue; + + // Youtube will happily hand us an http oembed URL even if we specify an https link; and the returned http link will fail with a 40x if you try and fetch it + // This is not our bug, but good luck getting google to fix it. + if (strpos($href,'http:') === 0 && strpos($href,'youtu') !== false) { + $href = str_replace('http:','https:', $href); + } + $x = z_fetch_url($href . '&maxwidth=' . App::$videowidth); if($x['success']) $txt = $x['body']; -- cgit v1.2.3