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

ERROR: unable to download video data: HTTP Error 400: Bad Request #5297

Open lgbaldoni opened 9 years ago

lgbaldoni commented 9 years ago

youtube-dl -v https://www.youtube.com/watch?v=sc03SlMY3vA
[debug] System config: [] [debug] User config: [] [debug] Command-line args: [u'-v', u'https://www.youtube.com/watch?v=sc03SlMY3vA'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2015.03.24 [debug] Python version 2.7.8 - Linux-3.16.7-7-desktop-x86_64-with-SuSE-13.2-x86_64 [debug] exe versions: ffmpeg 2.6.1, ffprobe 2.6.1 [debug] Proxy map: {} [youtube] sc03SlMY3vA: Downloading webpage [youtube] sc03SlMY3vA: Extracting video information [youtube] sc03SlMY3vA: Downloading formats manifest [youtube] sc03SlMY3vA: Downloading DASH manifest [debug] Invoking downloader on 'https://manifest.googlevideo.com/api/manifest/webvtt/id/sc03SlMY3vA.2/itag/92/source/yt_live_broadcast/playlist_type/LIVE/gcr/it/pmbypass/yes/ratebypass/yes/cmbypass/yes/live/1/lang/en/sver/3/fexp/900239,900720,901809,902904,907263,916730,934954,9406986,9407103,948124,948703,951511,951703,952612,955100,957201,961404,961406/signature/516D6F0A9A262DF75D41B8036DF218FC3C7361D9.0167894D26CF5171FE9D0AE97E56AEDF375275CD/upn/_Ixu0cIss-Q/key/dg_yt0/ip/95.246.55.64/ipbits/0/expire/1427466972/sparams/ip,ipbits,expire,id,itag,source,playlist_type,gcr,pmbypass,ratebypass,cmbypass,live,lang' ERROR: unable to download video data: HTTP Error 400: Bad Request Traceback (most recent call last): File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1379, in process_info success = dl(filename, info_dict) File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1354, in dl return fd.download(name, info) File "/usr/bin/youtube-dl/youtube_dl/downloader/common.py", line 341, in download return self.real_download(filename, info_dict) File "/usr/bin/youtube-dl/youtube_dl/downloader/http.py", line 64, in real_download data = self.ydl.urlopen(request) File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1673, in urlopen return self._opener.open(req, timeout=self._socket_timeout) File "/usr/lib64/python2.7/urllib2.py", line 410, in open response = meth(req, response) File "/usr/lib64/python2.7/urllib2.py", line 523, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib64/python2.7/urllib2.py", line 448, in error return self._call_chain(_args) File "/usr/lib64/python2.7/urllib2.py", line 382, in _call_chain result = func(_args) File "/usr/lib64/python2.7/urllib2.py", line 531, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) HTTPError: HTTP Error 400: Bad Request

suranands commented 9 years ago

I am not sure if this helps. I got the same issue when I tried with the URL as below. But it looks like the issue is why I got this URL with that "t=18&" part in it. I could not understand it. But if I remove it, it worked perfect.

$ youtube-dl https://www.youtube.com/watch?t=18&v=elojMnjn4kk

[debug] System config: [] [debug] User config: [] [debug] Command-line args: [u'-v', u'https://www.youtube.com/watch?t=18'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2015.04.09 [debug] Python version 2.7.9 - Linux-3.13.0-27-generic-x86_64-with-debian-jessie-sid [debug] exe versions: avconv 1.2.6-7, avprobe 1.2.6-7, ffmpeg 1.2.6-7, ffprobe 1.2.6-7, rtmpdump 2.4 [debug] Proxy map: {} [generic] watch?t=18: Requesting header [redirect] Following redirect to https://www.youtube.com/supported_browsers?next_url=%2F [download] Downloading playlist: supported_browsers [youtube:user] supported_browsers: Downloading video ids from 1 to 51 ERROR: Unable to download webpage: HTTP Error 400: Bad Request (caused by HTTPError()); >please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type >youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete >output. File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 314, in _request_webpage return self._downloader.urlopen(url_or_request) File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1673, in urlopen return self._opener.open(req, timeout=self._socket_timeout) File "/home/anand/anaconda/lib/python2.7/urllib2.py", line 437, in open response = meth(req, response) File "/home/anand/anaconda/lib/python2.7/urllib2.py", line 550, in http_response 'http', request, response, code, msg, hdrs) File "/home/anand/anaconda/lib/python2.7/urllib2.py", line 475, in error return self._call_chain(_args) File "/home/anand/anaconda/lib/python2.7/urllib2.py", line 409, in _call_chain result = func(_args) File "/home/anand/anaconda/lib/python2.7/urllib2.py", line 558, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

dstftw commented 9 years ago

@PyAS you have to escape & or enclose the whole URL in quotes.

suranands commented 9 years ago

Thanks @dstftw for that. I didn't know this. But when youtube itself did not have it in the original URL, why did I get this modified URL from the same video embedded on a different website? Does it happen because of embedding?