Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The use of an error(ubuntu16.04,python2.7,Using the agent,I am a Chinese) #13199

Closed
sunhao130130 opened this issue May 25, 2017 · 4 comments
Closed
Labels

Comments

@sunhao130130
Copy link

@sunhao130130 sunhao130130 commented May 25, 2017

youtube-dl -v --proxy 127.0.0.1:1080 https://www.youtube.com/watch?v=q_gr3dtBaic
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--proxy', u'127.0.0.1:1080', u'https://www.youtube.com/watch?v=q_gr3dtBaic']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.05.23
[debug] Python version 2.7.12 - Linux-4.4.0-62-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: ffmpeg 2.8.11-0ubuntu0.16.04.1, ffprobe 2.8.11-0ubuntu0.16.04.1, rtmpdump 2.4
[debug] Proxy map: {u'http': u'127.0.0.1:1080', u'https': u'127.0.0.1:1080'}
[youtube] q_gr3dtBaic: Downloading webpage
ERROR: Unable to download webpage: (caused by BadStatusLine('\x05\x00',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 502, in _request_webpage
return self._downloader.urlopen(url_or_request)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 2106, in urlopen
return self._opener.open(req, timeout=self._socket_timeout)
File "/usr/lib/python2.7/urllib2.py", line 429, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 447, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/utils.py", line 1090, in https_open
req, **kwargs)
File "/usr/lib/python2.7/urllib2.py", line 1195, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/usr/lib/python2.7/httplib.py", line 1057, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1097, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 897, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 859, in send
self.connect()
File "/usr/lib/python2.7/httplib.py", line 1270, in connect
HTTPConnection.connect(self)
File "/usr/lib/python2.7/httplib.py", line 839, in connect
self._tunnel()
File "/usr/lib/python2.7/httplib.py", line 811, in _tunnel
(version, code, message) = response._read_status()
File "/usr/lib/python2.7/httplib.py", line 431, in _read_status
raise BadStatusLine(line)

@sunhao130130
Copy link
Author

@sunhao130130 sunhao130130 commented May 25, 2017

The latest version

@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 25, 2017

Most likely your proxy does not work properly.

@dstftw dstftw closed this May 25, 2017
@sunhao130130
Copy link
Author

@sunhao130130 sunhao130130 commented May 25, 2017

so? Am I wrong to set the agent? but !

import socks
from sockshandler import SocksiPyHandler
def getHtml(url):
opener = urllib2.build_opener(SocksiPyHandler(socks.SOCKS5, "127.0.0.1", 1080))
page = opener.open(url)
html = page.read()
return html
opener = urllib2.build_opener(SocksiPyHandler(socks.SOCKS5, "127.0.0.1", 1080))

def getUrl(html):
reg = r"(?<=a\shref="/watch).+?(?=")"
urlre = re.compile(reg)
urllist = re.findall(urlre, html)
format = "https://www.youtube.com/watch%s\n"
f = open("youtube.txt", 'a')
for url in urllist:
result = (format % url)
f.write(result)
f.close()
html = getHtml("https://www.youtube.com/channel/UCoCKFuefOSNviiJ9skeR0hA/videos?view=0&sort=dd&flow=grid")
print getUrl(html)

This ok!!!

@dstftw
Copy link
Collaborator

@dstftw dstftw commented May 25, 2017

--proxy URL                      Use the specified HTTP/HTTPS/SOCKS proxy.
                                 To enable experimental SOCKS proxy, specify
                                 a proper scheme. For example
                                 socks5://127.0.0.1:1080/. Pass in an empty
                                 string (--proxy "") for direct connection

socks5://127.0.0.1:1080/
socks5://

@ytdl-org ytdl-org locked and limited conversation to collaborators May 25, 2017
@dstftw dstftw added the invalid label May 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.