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
131.37k stars 9.96k forks source link

[youtube] HTTPSConnectionV3 instance has no attribute '_tunnel_host' Android #1860

Closed canamcy closed 10 years ago

canamcy commented 10 years ago

video id = 1-5bzCOLMb8 ytdl version 2013.11.29

t/usr/lib/python2.6/httplib.py", line 874, in request
 File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/ou
t/usr/lib/python2.6/httplib.py", line 911, in _send_request
 File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/ou
t/usr/lib/python2.6/httplib.py", line 868, in endheaders
 File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/ou
t/usr/lib/python2.6/httplib.py", line 740, in _send_output
 File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/ou
t/usr/lib/python2.6/httplib.py", line 699, in send
 File "/mnt/sdcard/sl4a/scripts/!yo-2b/youtube_dl.py/youtube_dl/utils.py", li
551, in connect
 if self._tunnel_host:
ttributeError: HTTPSConnectionV3 instance has no attribute '_tunnel_host'
Sepulep commented 10 years ago

found the same issue, python 2.6

jaimeMF commented 10 years ago

Could you please post wich version of python2.6 are you using?, you can run python --version or youtube-dl --verbose.

Sepulep commented 10 years ago

2.6.2 here

Sepulep commented 10 years ago

it works on 2.6.2 with:

--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -548,9 +548,12 @@ def make_HTTPS_handler(opts_no_check_certificate):

             def connect(self):
                 sock = socket.create_connection((self.host, self.port),
-                if self._tunnel_host:
-                    self.sock = sock
-                    self._tunnel()
+                try:
+                    if self._tunnel_host:
+                        self.sock = sock
+                        self._tunnel()
+                except:
+                    pass
                 try:
                     self.sock = ssl.wrap_socket(sock, self.key_file, se
                 except ssl.SSLError:
jaimeMF commented 10 years ago

The problem was probably introduced in 13ebea791fb4293acf939730ad5a9c07e553005f. @phihag it uses a non-documented property, which (after a quick search) was added to python 2.6 in http://hg.python.org/cpython/rev/0f57b30a152f, the first release that included it seems to be 2.6.3. We should either check if the property is present (I haven't look carefully at the code) or bump the minimum supported version of python 2.6. What do you think?

Sepulep commented 10 years ago

any update on this issue? I would be grateful if you could maintain compatibility for 2.6.2, cause I am using youtube-dl for a youtube app on the openpandora handheld - http://repo.openpandora.org/?page=detail&app=thetube (the firmware has 2.6.2, meaning I can keep the app very lean at 500kb)

canamcy commented 10 years ago

I only use youtube and it continues to work with 2013.11.21.

lopen libpython2.6.so ython 2.6.2 (r262:71600, Mar 20 2011, 16:54:21) GCC 4.4.3] on linux-armv6l ype "help", "copyright", "credits" or "license" for more information.

phihag commented 10 years ago

Fixed in version 2013.12.09 and newer. You may have to reinstall these though, or update from an older version that works.