Fix xHamster support, fixes #264 (#276)

* Fix xhamster support

* Send http headers properly

* added spaces

* convert stdObject to array for comparison

Co-authored-by: Pierre Rudloff <contact@rudloff.pro>
This commit is contained in:
0x6470 2020-05-14 10:59:59 +02:00 committed by GitHub
parent 6a3bc97219
commit 8f7601edd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -622,12 +622,22 @@ class Video
{
$client = new Client();
$urls = $this->getUrl();
$stream_context_options = [];
if (array_key_exists('Referer', (array)$this->http_headers)) {
$stream_context_options = [
'http' => [
'header' => 'Referer: ' . $this->http_headers->Referer
]
];
}
return $client->request(
'GET',
$urls[0],
[
'stream' => true,
'stream_context' => $stream_context_options,
'headers' => array_merge((array)$this->http_headers, $headers)
]
);