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

youtube - bad request when specified format restriction on height #15257

Closed
nimatrueway opened this issue Jan 15, 2018 · 6 comments
Closed

youtube - bad request when specified format restriction on height #15257

nimatrueway opened this issue Jan 15, 2018 · 6 comments

Comments

@nimatrueway
Copy link

@nimatrueway nimatrueway commented Jan 15, 2018

  • I've verified and I assure that I'm running youtube-dl 2018.01.14
  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Bug report (encountered problems with youtube-dl)

youtube-dl --format '[height<=720]' https://www.youtube.com/watch?v=T6f1-nEjDdM

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', '--proxy', 'http://127.0.0.1:9990', '--format', '[height<=720]', 'https://www.youtube.com/watch?v=T6f1-nEjDdM']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.01.14
[debug] Git HEAD: d1cac973b
[debug] Python version 3.6.3 (CPython) - Linux-4.13.0-16-generic-x86_64-with-Ubuntu-17.10-artful
[debug] exe versions: ffmpeg 3.3.4-2, ffprobe 3.3.4-2
[debug] Proxy map: {'http': 'http://127.0.0.1:9990', 'https': 'http://127.0.0.1:9990'}
[youtube] T6f1-nEjDdM: Downloading webpage
[youtube] T6f1-nEjDdM: Downloading video info webpage
[youtube] T6f1-nEjDdM: Extracting video information
[debug] Invoking downloader on 'https://r5---sn-5hnekn7s.googlevideo.com/videoplayback?beids=%5B9466591%5D&mn=sn-5hnekn7s&mt=1516004915&itag=22&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&lmt=1503469642833792&signature=9DB429872AAC1EC9135A5E51140025C4A33A0F84.0B801C0884CD346D893C70B8351638A9A787ADCE&ip=2.176.129.164&ratebypass=yes&source=youtube&ei=gWZcWqKkIe6r-APx8ob4Ag&requiressl=yes&ms=au&ipbits=0&initcwndbps=120000&mv=m&pl=17&id=o-AKHfcVMKECQmWNo7NADbOTafzKSpjf4wwdJkbMtHZvFZ&dur=662.720&mime=video%2Fmp4&expire=1516026593&key=yt6&mm=31'
[download] Destination: Humans and Nature and Creation - Crash Course World Mythology #6-T6f1-nEjDdM.mp4
[download]   0.4% of 89.19MiB at 336.18KiB/s ETA 04:30[download] Got server HTTP error: Downloaded 353078 bytes, expected 93517591 bytes. Retrying (attempt 1 of 10)...
[download] Resuming download at byte 353078
ERROR: unable to download video data: HTTP Error 400: Bad Request

Traceback (most recent call last):
  File "/home/nima/Projects/youtube-dl/youtube_dl/YoutubeDL.py", line 1895, in process_info
    success = dl(filename, info_dict)
  File "/home/nima/Projects/youtube-dl/youtube_dl/YoutubeDL.py", line 1834, in dl
    return fd.download(name, info)
  File "/home/nima/Projects/youtube-dl/youtube_dl/downloader/common.py", line 361, in download
    return self.real_download(filename, info_dict)
  File "/home/nima/Projects/youtube-dl/youtube_dl/downloader/http.py", line 286, in real_download
    establish_connection()
  File "/home/nima/Projects/youtube-dl/youtube_dl/downloader/http.py", line 74, in establish_connection
    ctx.data = self.ydl.urlopen(request)
  File "/home/nima/Projects/youtube-dl/youtube_dl/YoutubeDL.py", line 2198, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

Description of your issue, suggested solution and other information

Seems like the extracted video URL is not valid. However, when I also tried without specifying format restriction (height<=720) it worked fine. This is the only youtube video that I had problem with. (This never occurred to me at least for many other videos)

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jan 15, 2018

Most likely the problem is due to your proxy.

@dstftw dstftw closed this Jan 15, 2018
@nimatrueway
Copy link
Author

@nimatrueway nimatrueway commented Jan 15, 2018

@dstftw How did you reach this conclusion ? it's working fine without height restriction. Plus I have downloaded like a thousand videos this way.

@nimatrueway
Copy link
Author

@nimatrueway nimatrueway commented Jan 15, 2018

Please, try to reproduce it and confirm :

youtube-dl --format '[height<=720]' T6f1-nEjDdM
@Hrxn
Copy link

@Hrxn Hrxn commented Jan 15, 2018

PS E:\test> youtube-dl --ignore-config --verbose --format '[height<=720]' T6f1-nEjDdM
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--ignore-config', '--verbose', '--format', '[height<=720]', 'T6f1-nEjDdM']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2018.01.14
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.16299
[debug] exe versions: ffmpeg 3.4.1, ffprobe 3.4.1, phantomjs 2.1.1
[debug] Proxy map: {}
[youtube] T6f1-nEjDdM: Downloading webpage
[youtube] T6f1-nEjDdM: Downloading video info webpage
[youtube] T6f1-nEjDdM: Extracting video information
[debug] Invoking downloader on 'https://r5---sn-4g5edn7e.googlevideo.com/videoplayback?mn=sn-4g5edn7e&ipbits=0&expire=1516031473&ratebypass=yes&ms=au&lmt=1503469642833792&ei=kXlcWo7PJMTGcIKCvqAG&dur=662.720&pl=20&id=o-ACZ7QuasiYc1AcTJIsO-FOTYdy-XlysQRwZwix-tVv4t&initcwndbps=718750&mv=m&source=youtube&signature=75FC53C5004B180EA688603AD24EB1ADA961F216.40B80DCAE3F0C35D9B6706622DEC8CE76C1614A9&key=yt6&mime=video%2Fmp4&requiressl=yes&ip=92.75.1.118&mm=31&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&itag=22&mt=1516009736'
[download] Destination: Humans and Nature and Creation - Crash Course World Mythology #6-T6f1-nEjDdM.mp4
[download]   0.3% of 89.19MiB at  1.39MiB/s ETA 01:03 [download] Got server HTTP error: Downloaded 289165 bytes, expected 93517591 bytes. Retrying (attempt 1 of 10)...
[download] Resuming download at byte 289165
[download] Destination: Humans and Nature and Creation - Crash Course World Mythology #6-T6f1-nEjDdM.mp4
[download]   0.4% of 89.19MiB at 448.49KiB/s ETA 03:22[download] Got server HTTP error: Downloaded 354169 bytes, expected 93517591 bytes. Retrying (attempt 2 of 10)...
[download] Resuming download at byte 354169


ERROR: Did not get any data blocks
  File "__main__.py", line 19, in <module>
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\__init__.py", line 465, in main
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\__init__.py", line 455, in _real_main
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\YoutubeDL.py", line 1988, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\YoutubeDL.py", line 795, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\YoutubeDL.py", line 849, in process_ie_result
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\YoutubeDL.py", line 1622, in process_video_result
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\YoutubeDL.py", line 1895, in process_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\YoutubeDL.py", line 1834, in dl
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\downloader\common.py", line 361, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\downloader\http.py", line 287, in real_download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\downloader\http.py", line 257, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\downloader\common.py", line 163, in report_error
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\YoutubeDL.py", line 612, in report_error
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpo17hktrm\build\youtube_dl\YoutubeDL.py", line 574, in trouble

PS E:\test>

What are you actually trying to achieve with [height<=720]?
Why not use just best format in this case instead?

@nimatrueway
Copy link
Author

@nimatrueway nimatrueway commented Jan 15, 2018

Thank you @Hrxn for responding and confirming.
The reason for that format.. I'm quite content with 720p video. I was actually trying to download many videos therefore 1080p quality would result in like 40GB extra space on disk which I wanted to avoid.

@raszpl
Copy link

@raszpl raszpl commented Apr 10, 2018

best is same as itag=22, which he was getting with '[height<=720]'
confirming this bug, same as #16140 . Google is screwing with itag 22, maybe its their way of fighting YT downloaders?

D:\_learning>youtube-dl.exe -f best -g https://www.youtube.com/watch?v=T6f1-nEjDdM
https://r2---sn-f5f7ln7s.googlevideo.com/videoplayback?pl=13&id=o-ALcHPR9aC5Epx2lpS7dfTl1j5WlBX9OSfxSfCZbgDOuz&dur=662.720&mv=m&initcwndbps=1032500&source=youtube&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&fvip=5&ms=au%2Conr&mn=sn-f5f7ln7s%2Csn-4g5edn7e&ip=&key=yt6&expire=1523349093&mime=video%2Fmp4&ipbits=0&requiressl=yes&lmt=1503469642833792&signature=B7F114EF8CABF7411FD0CC0071D1AF8627F053BF.362D7E34989597F5B90067DFB97C38ADB08A87FC&mm=31%2C26&itag=22&ratebypass=yes&c=WEB&mt=1523327325&ei=BSLMWsKlCcig7ASe1pOQDg

D:\_learning>wget "https://r2---sn-f5f7ln7s.googlevideo.com/videoplayback?pl=13&id=o-ALcHPR9aC5Epx2lpS7dfTl1j5WlBX9OSfxSfCZbgDOuz&dur=662.720&mv=m&initcwndbps=1032500&source=youtube&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&fvip=5&ms=au%2Conr&mn=sn-f5f7ln7s%2Csn-4g5edn7e&ip=&key=yt6&expire=1523349093&mime=video%2Fmp4&ipbits=0&requiressl=yes&lmt=1503469642833792&signature=B7F114EF8CABF7411FD0CC0071D1AF8627F053BF.362D7E34989597F5B90067DFB97C38ADB08A87FC&mm=31%2C26&itag=22&ratebypass=yes&c=WEB&mt=1523327325&ei=BSLMWsKlCcig7ASe1pOQDg"
--2018-04-10 05:32:05--  https://r2---sn-f5f7ln7s.googlevideo.com/videoplayback?pl=13&id=o-ALcHPR9aC5Epx2lpS7dfTl1j5WlBX9OSfxSfCZbgDOuz&dur=662.720&mv=m&initcwndbps=1032500&source=youtube&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&fvip=5&ms=au%2Conr&mn=sn-f5f7ln7s%2Csn-4g5edn7e&ip=&key=yt6&expire=1523349093&mime=video%2Fmp4&ipbits=0&requiressl=yes&lmt=1503469642833792&signature=B7F114EF8CABF7411FD0CC0071D1AF8627F053BF.362D7E34989597F5B90067DFB97C38ADB08A87FC&mm=31%2C26&itag=22&ratebypass=yes&c=WEB&mt=1523327325&ei=BSLMWsKlCcig7ASe1pOQDg
Resolving r2---sn-f5f7ln7s.googlevideo.com (r2---sn-f5f7ln7s.googlevideo.com)... 173.194.150.136
Connecting to r2---sn-f5f7ln7s.googlevideo.com (r2---sn-f5f7ln7s.googlevideo.com)|173.194.150.136|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 93517591 (89M) [video/mp4]
Saving to: 'videoplayback@pl=13&id=o-ALcHPR9aC5Epx2lpS7dfTl1j5WlBX9OSfxSfCZbgDOuz&dur=662.720&mv=m&initcwndbps=1032500&source=youtube&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequire'

videoplayback@pl=13&id=o-ALcH   0%[                                                  ] 345.87K  --.-KB/s    in 0.06s

2018-04-10 05:32:06 (5.51 MB/s) - Connection closed at byte 354169. Retrying.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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