aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-01-26 09:56:28 +0000
committerMario <mario@mariovavti.com>2021-01-26 09:56:28 +0000
commitde34dac6cc3467280bc99b01e9ecf7470161a5d0 (patch)
tree92cea31ee262149d900e930241837b9c5646494f /include
parent1c8d298f3f13ad358693d2ec8016e49043f2250f (diff)
downloadvolse-hubzilla-de34dac6cc3467280bc99b01e9ecf7470161a5d0.tar.gz
volse-hubzilla-de34dac6cc3467280bc99b01e9ecf7470161a5d0.tar.bz2
volse-hubzilla-de34dac6cc3467280bc99b01e9ecf7470161a5d0.zip
port youtube embed fix from zap
Diffstat (limited to 'include')
-rwxr-xr-xinclude/oembed.php7
1 files changed, 7 insertions, 0 deletions
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'];