Don't set stream context manually

Guzzle already takes care of that
This commit is contained in:
Pierre Rudloff 2021-05-05 20:56:42 +02:00
parent 4977f99797
commit a0548ea473

View file

@ -477,22 +477,12 @@ class Downloader implements LoggerAwareInterface
// IDN conversion breaks with Google hosts like https://r3---sn-25glene6.googlevideo.com/. // IDN conversion breaks with Google hosts like https://r3---sn-25glene6.googlevideo.com/.
$client = new Client(['idn_conversion' => false]); $client = new Client(['idn_conversion' => false]);
$urls = $video->getUrl(); $urls = $video->getUrl();
$stream_context_options = [];
if (array_key_exists('Referer', (array)$video->http_headers)) {
$stream_context_options = [
'http' => [
'header' => 'Referer: ' . $video->http_headers->Referer
]
];
}
return $client->request( return $client->request(
'GET', 'GET',
$urls[0], $urls[0],
[ [
'stream' => true, 'stream' => true,
'stream_context' => $stream_context_options,
'headers' => array_merge((array)$video->http_headers, $headers) 'headers' => array_merge((array)$video->http_headers, $headers)
] ]
); );