ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.46k stars 10.04k forks source link

Proxy parameter is not working correctly inside of openload.py (PhantomJS) #15047

Open xTended2600 opened 6 years ago

xTended2600 commented 6 years ago

Please follow the guide below


Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.12.14. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

Before submitting an issue make sure you have:

What is the purpose of your issue?


Currently openload.py is using PhantomJS in order the obtain the final URL, but it is not passing correctly the parameter --proxy URL to PhantomJS. Output is: https://openload.co/stream/None?mime=true In the Proxy Server I could see only one https call to openload servers, missing the rest of them which are being originated in openload.py lines 228-231:

    p = subprocess.Popen([
        self.exe, '--ssl-protocol=any',
        self._TMP_FILES['script'].name
    ], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Here we can see that the only parameter used for PhantomJS is "--ssl-protocol=any". I have tested it in the latest version (2017.12.14) and the issue is still there.

yan12125 commented 6 years ago

Notices for those who are interesting:

xTended2600 commented 6 years ago

I agree with you that some additional parameters should be forwarded to PhantomJS.

Although, it is not necessary a different proxy for HTTP and HTTPS requests. A HTTP proxy server can retrieve SSL content. Basically, difference between a HTTP and HTTPS proxy sever lies in the communication (Plain HTTP or SSL) between the client and the proxy server.

Regarding to original issue, I made some changes locally in openload.py and utils.py, and now it is working fine, but this code is not enough clean to merge it into master.

Regards.

yan12125 commented 6 years ago

it is not necessary a different proxy for HTTP and HTTPS requests

Totally correct. I have never see an actual use case with different proxies; this is a design issue - what youtube-dl should pass to phantomjs if there were really different proxies? Report an error or pick one of them?

In the long term, I'm wondering if it's possible to replace PhantomJS with maintained projects like headless Chrome. For former is declared dead by former maintainers (https://github.com/ariya/phantomjs/issues/15105), and the latter supports proxies much better.