Rudloff / alltube

Web GUI for youtube-dl
GNU General Public License v3.0
2.96k stars 582 forks source link

Fix xHamster support, fixes #264 #276

Closed 0x6470 closed 4 years ago

0x6470 commented 4 years ago

As described in #264 xHamster downloads are not possible, unless their site itself is specified as HTTP-Referer. Since it didn't work for me either, I tried to fix it. As it seems, it only works if the referer is passed as custom stream context option, as this overrides other values.

further details here: http://docs.guzzlephp.org/en/stable/faq.html#how-can-i-add-custom-stream-context-options https://www.php.net/manual/en/context.http.php#context.http.header

Setting the referer as Guzzle request header (http://docs.guzzlephp.org/en/stable/request-options.html#headers) or through CURLOPT_REFERER did not work.

With this fix, it's possible to download videos from xHamster if the stream option is activated. To achieve this without the streaming option, I recommend to use a plugin in your web browser.

Rudloff commented 3 years ago

I reverted this change because it was overriding the other headers.

Guzzle already takes care of creating the context here.