youtube-dl fails to use proxy #211

Closed
opened 2026-02-20 22:28:25 -05:00 by deekerman · 8 comments
Owner

Originally created by @patricklauer on GitHub (Feb 25, 2012).

$ http_proxy="127.0.0.1:3128" youtube-dl http://www.youtube.com/watch?v=z4KV7e8kwbI
[youtube] Setting language
WARNING: unable to set language: <urlopen error [Errno 111] Connection refused>
[youtube] z4KV7e8kwbI: Downloading video webpage
ERROR: unable to download video webpage: <urlopen error [Errno 111] Connection refused>

--> of course it doesn't work if you don't use the proxy server ...

Originally created by @patricklauer on GitHub (Feb 25, 2012). $ http_proxy="127.0.0.1:3128" youtube-dl http://www.youtube.com/watch?v=z4KV7e8kwbI [youtube] Setting language WARNING: unable to set language: <urlopen error [Errno 111] Connection refused> [youtube] z4KV7e8kwbI: Downloading video webpage ERROR: unable to download video webpage: <urlopen error [Errno 111] Connection refused> --> of course it doesn't work if you don't use the proxy server ...
Author
Owner

@h3xx commented on GitHub (Feb 25, 2012):

Seems like this could be a bug in urllib or urllib2. Have you tried a simple script to test your proxy?

#!/usr/bin/python
import urllib2
import sys
url = sys.argv[1]
response = urllib2.urlopen(url)
html_string = response.read()
print html_string
@h3xx commented on GitHub (Feb 25, 2012): Seems like this could be a bug in `urllib` or `urllib2`. Have you tried a simple script to test your proxy? ``` #!/usr/bin/python import urllib2 import sys url = sys.argv[1] response = urllib2.urlopen(url) html_string = response.read() print html_string ```
Author
Owner

@rg3 commented on GitHub (Feb 26, 2012):

As per the documentation, try to put the "http://" prefix before the host name.

http://rg3.github.com/youtube-dl/documentation.html#d5

@rg3 commented on GitHub (Feb 26, 2012): As per the documentation, try to put the "http://" prefix before the host name. http://rg3.github.com/youtube-dl/documentation.html#d5
Author
Owner

@phihag commented on GitHub (Feb 26, 2012):

Mmm, urllib2 seems ok with leaving out the http://. On which platform (Python version, Linux distribution) are you running youtube-dl? Can you update youtube-dl to 2012.02.26 and test with the new --verbose option? What does that output?

@phihag commented on GitHub (Feb 26, 2012): Mmm, urllib2 seems ok with leaving out the `http://`. On which platform (Python version, Linux distribution) are you running youtube-dl? Can you update youtube-dl to 2012.02.26 and test with the new `--verbose` option? What does that output?
Author
Owner

@rg3 commented on GitHub (Feb 28, 2012):

I just peeked at the code in urllib2 and you're completely right. It should go even as far back as Python 2.5. However, I distinctly remember having problems if I omitted the http:// prefix when I tested the feature after adding it. Could it be a subtle problem in youtube-dl's code? It could still be interesting to test with the prefix just in case.

@rg3 commented on GitHub (Feb 28, 2012): I just peeked at the code in urllib2 and you're completely right. It should go even as far back as Python 2.5. However, I distinctly remember having problems if I omitted the http:// prefix when I tested the feature after adding it. Could it be a subtle problem in youtube-dl's code? It could still be interesting to test with the prefix just in case.
Author
Owner

@patricklauer commented on GitHub (Mar 21, 2012):

Same with 2012.02.27 (running on Gentoo Linux / AMD64). The script from comment #1 hangs (which tells me that it does not respect the http_proxy env var)

@patricklauer commented on GitHub (Mar 21, 2012): Same with 2012.02.27 (running on Gentoo Linux / AMD64). The script from comment #1 hangs (which tells me that it does _not_ respect the http_proxy env var)
Author
Owner

@AR0x7E7 commented on GitHub (May 1, 2012):

youtube-dl --version:
2012.02.27

uname -a;
Linux MacBookUbuntuPro 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 20:45:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

http_proxy="http://72.64.146.135:8080" youtube-dl www.youtube.com/watch?v=mjli3hj0ZkM

Works like a charm!

@AR0x7E7 commented on GitHub (May 1, 2012): youtube-dl --version: 2012.02.27 uname -a; Linux MacBookUbuntuPro 3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 20:45:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux http_proxy="http://72.64.146.135:8080" youtube-dl www.youtube.com/watch?v=mjli3hj0ZkM Works like a charm!
Author
Owner

@rg3 commented on GitHub (May 1, 2012):

AR0x7E7, could you try without the http:// prefix to verify it still works or if it makes any difference?

@rg3 commented on GitHub (May 1, 2012): AR0x7E7, could you try without the http:// prefix to verify it still works or if it makes any difference?
Author
Owner

@AR0x7E7 commented on GitHub (May 1, 2012):

http_proxy="72.64.146.135:8080" youtube-dl http://www.youtube.com/watch?v=sOS9aOIXPEk

Still works perfectly!

Btw:
python --version:
Python 2.7.2+

@AR0x7E7 commented on GitHub (May 1, 2012): http_proxy="72.64.146.135:8080" youtube-dl http://www.youtube.com/watch?v=sOS9aOIXPEk Still works perfectly! Btw: python --version: Python 2.7.2+
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#211
No description provided.