Repository: youtube-dl
Issue: Failing to retry download or try next format on "Did not get any data blocks" error
Labels: cant-reproduce

<!--

######################################################################
  WARNING!
  IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE
######################################################################

-->


## Checklist

<!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl:
- First of, make sure you are using the latest version of youtube-dl. Run `youtube-dl --version` and ensure your version is 2019.11.05. If it's not, see https://yt-dl.org/update on how to update. Issues with outdated version will be REJECTED.
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
- Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in http://yt-dl.org/escape.
- Search the bugtracker for similar issues: http://yt-dl.org/search-issues. DO NOT post duplicates.
- Read bugs section in FAQ: http://yt-dl.org/reporting
- Finally, put x into all relevant boxes (like this [x])
-->

- [x] I'm reporting a broken site support issue
- [x] I've verified that I'm running youtube-dl version **2019.11.05**
- [x] I've checked that all provided URLs are alive and playable in a browser
- [x] I've checked that all URLs and arguments with special characters are properly quoted or escaped
- [x] I've searched the bugtracker for similar bug reports including closed ones
- [x] I've read bugs section in FAQ


## Verbose log

<!--
Provide the complete verbose output of youtube-dl that clearly demonstrates the problem.
Add the `-v` flag to your command line you run youtube-dl with (`youtube-dl -v <your command line>`), copy the WHOLE output and insert it below. It should look similar to this:
 [debug] System config: []
 [debug] User config: []
 [debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
 [debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
 [debug] youtube-dl version 2019.11.05
 [debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2
 [debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
 [debug] Proxy map: {}
 <more lines>
-->

```
$ youtube-dl --verbose -f 22/best 'http://youtube.com/watch?v=Msn9L0IXPgw'
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', '-f', '22/best', 'http://youtube.com/watch?v=Msn9L0IXPgw']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.11.05
[debug] Python version 3.7.4 (CPython) - Darwin-18.7.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.0.2, ffprobe 4.0.2
[debug] Proxy map: {}
[youtube] Msn9L0IXPgw: Downloading webpage
[youtube] Msn9L0IXPgw: Downloading video info webpage
[youtube] {18} signature length 104, html5 player vflFlp-mq
[youtube] Msn9L0IXPgw: Downloading player https://www.youtube.com/yts/jsbin/player_ias-vflFlp-mq/en_US/base.js
[youtube] {22} signature length 104, html5 player vflFlp-mq
[youtube] {43} signature length 104, html5 player vflFlp-mq
[youtube] {313} signature length 104, html5 player vflFlp-mq
[youtube] {271} signature length 104, html5 player vflFlp-mq
[youtube] {137} signature length 104, html5 player vflFlp-mq
[youtube] {248} signature length 104, html5 player vflFlp-mq
[youtube] {136} signature length 100, html5 player vflFlp-mq
[youtube] Msn9L0IXPgw: Downloading player https://www.youtube.com/yts/jsbin/player_ias-vflFlp-mq/en_US/base.js
[youtube] {247} signature length 104, html5 player vflFlp-mq
[youtube] {135} signature length 104, html5 player vflFlp-mq
[youtube] {244} signature length 104, html5 player vflFlp-mq
[youtube] {134} signature length 104, html5 player vflFlp-mq
[youtube] {243} signature length 104, html5 player vflFlp-mq
[youtube] {133} signature length 104, html5 player vflFlp-mq
[youtube] {242} signature length 104, html5 player vflFlp-mq
[youtube] {160} signature length 100, html5 player vflFlp-mq
[youtube] {278} signature length 100, html5 player vflFlp-mq
[youtube] {140} signature length 100, html5 player vflFlp-mq
[youtube] {249} signature length 104, html5 player vflFlp-mq
[youtube] {250} signature length 104, html5 player vflFlp-mq
[youtube] {251} signature length 104, html5 player vflFlp-mq
[debug] Invoking downloader on 'https://r5---sn-u2bpouxgoxu-5qal.googlevideo.com/videoplayback?expire=1573901343&ei=v3_PXbG2L9uN3LUPm9O44Ac&ip=124.168.216.76&id=o-AMX8d-vP-bCczOwjEQSlnuJLnzWnz6SWtK7KC449kC4f&itag=22&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-u2bpouxgoxu-5qal%2Csn-ntqe6n7r&ms=au%2Crdu&mv=m&mvi=4&pl=21&initcwndbps=1237500&mime=video%2Fmp4&ratebypass=yes&dur=235.241&lmt=1569437714851264&mt=1573879663&fvip=5&fexp=23842630&beids=9466585&c=WEB&txp=2316222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cmime%2Cratebypass%2Cdur%2Clmt&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRAIgds4ItG2cSzxz3rBZ8XJbNIbSJwB4TrqTUlVJAEvzZisCIFjeNldL0kpo7BtoGtfgV1A428l-J1XxR_OlqlTYUkIF&sig=ALgxI2wwRgIhAKXV-eQbHZpt0mMcFLF3G3QUoJ4ihutHi9g9gOptjBRyAiEAr4McLw2mFeR1oU_-270t3HdxOafLf4JdJt8zp4VPkm0='
[download] Destination: Carlo Traversi... SENDING in RMNP-Msn9L0IXPgw.mp4
[download]   0.2% of 41.69MiB at 689.91KiB/s ETA 01:01[download] Got server HTTP error: Downloaded 88699 bytes, expected 43715037 bytes. Retrying (attempt 1 of 10)...


ERROR: Did not get any data blocks
  File "/Users/dbr/code/venvs/ytdl/bin/youtube-dl", line 8, in <module>
    sys.exit(main())
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/__init__.py", line 474, in main
    _real_main(argv)
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/__init__.py", line 464, in _real_main
    retcode = ydl.download(all_urls)
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2018, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 807, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 862, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1643, in process_video_result
    self.process_info(new_info)
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1925, in process_info
    success = dl(filename, info_dict)
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1864, in dl
    return fd.download(name, info)
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/downloader/common.py", line 366, in download
    return self.real_download(filename, info_dict)
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/downloader/http.py", line 342, in real_download
    return download()
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/downloader/http.py", line 312, in download
    self.report_error('Did not get any data blocks')
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/downloader/common.py", line 165, in report_error
    self.ydl.report_error(*args, **kargs)
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 624, in report_error
    self.trouble(error_message, tb)
  File "/Users/dbr/code/venvs/ytdl/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 586, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())
```


## Description

<!--
Provide an explanation of your issue in an arbitrary form. Please make sure the description is worded well enough to be understood, see https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient. Provide any additional information, suggested solution and as much context and examples as possible.
If work on your issue requires account credentials please provide them or explain how one can obtain them.
-->

I'm using youtube-dl to download videos as 720p mp4a (`-f 22`). As per issues like #17148 and #20296 this is apparently an issue with Youtube, and as of the last few months(?) I often get downloads failing with the `Did not get any data blocks`.

So as a solution to this I tried using the format fallback mechanism and specifying `-f 22/best` (as per the [format section docs](https://github.com/ytdl-org/youtube-dl/blob/master/README.md#format-selection) and this very old bug #650), so it'll prefer the mp4a then fallback to to the default format. However this doesn't work - youtube-dl stops after the first error occurs:

```
$ youtube-dl -f 22/best 'http://youtube.com/watch?v=Msn9L0IXPgw'
[...]
[download]   0.2% of 41.69MiB at 122.11KiB/s ETA 05:48[download] Got server HTTP error: Downloaded 88699 bytes, expected 43715037 bytes. Retrying (attempt 1 of 10)...


ERROR: Did not get any data blocks
$
```

Although it would be useful in my case, I'm not certain if it would be correct for the "no data blocks" error to try the next format (since I assume Youtube API claims the format *does* exist), however the  output saying "Retrying (attempt 1 of 10)" but it immediately exiting definitely seems like a bug?