Repository: youtube-dl
Issue: Youtube download fails with: unable to download video data: HTTP Error 401: Unauthorized
Labels: cant-reproduce

- [x] I've **verified** and **I assure** that I'm running youtube-dl **2017.08.27.1**

### Before submitting an *issue* make sure you have:
- [x] At least skimmed through the [README](https://github.com/rg3/youtube-dl/blob/master/README.md), **most notably** the [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
- [x] [Searched](https://github.com/rg3/youtube-dl/search?type=Issues) the bugtracker for similar issues including closed ones

### What is the purpose of your *issue*?
- [x] Bug report (encountered problems with youtube-dl)
- [ ] Site support request (request for adding support for a new site)
- [ ] Feature request (request for a new functionality)
- [ ] Question
- [ ] Other

---

```
youtube-dl.exe -v -f best/mp4 I_tNvkNlNoI
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-f', 'best/mp4', 'I_tNvkNlNoI']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2017.08.27.1
[debug] Python version 3.4.4 - Windows-10-10.0.14393
[debug] exe versions: ffmpeg 2.8.4, ffprobe N-78843-g1c7e2cf
[debug] Proxy map: {}
[youtube] I_tNvkNlNoI: Downloading webpage
[youtube] I_tNvkNlNoI: Downloading video info webpage
[youtube] I_tNvkNlNoI: Extracting video information
WARNING: unable to extract uploader nickname
[youtube] I_tNvkNlNoI: Downloading MPD manifest
[debug] Invoking downloader on 'https://r3---sn-oapm-guhl.googlevideo.com/videoplayback?ipbits=0&clen=3503353&initcwndbps=1107500&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&pcm2cms=yes&mime=video%2Fwebm&mn=sn-oapm-guhl&mm=31&id=o-AEGU2DyQotB8SiZHfvs78KavWiT9ke2CcK05EqiQb60K&ip=REMOVEDMANUALLY&pl=17&mv=m&mt=1504098431&ms=au&ei=A7mmWcXNEJWx1gLKqKGQBw&ratebypass=yes&expire=1504120163&itag=43&signature=5786DEC040D53FDD8C5E2A4DDFBF8FD76052BE7D.B4781090104746316361D6B6F53939A55C07D7F3&key=yt6&gir=yes&requiressl=yes&dur=0.000&source=youtube&lmt=1299963847443446'
ERROR: unable to download video data: HTTP Error 401: Unauthorized
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp_2hklmx2\build\youtube_dl\YoutubeDL.py", line 1865, in process_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp_2hklmx2\build\youtube_dl\YoutubeDL.py", line 1807, in dl
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp_2hklmx2\build\youtube_dl\downloader\common.py", line 361, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp_2hklmx2\build\youtube_dl\downloader\http.py", line 286, in real_download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp_2hklmx2\build\youtube_dl\downloader\http.py", line 74, in establish_connection
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp_2hklmx2\build\youtube_dl\YoutubeDL.py", line 2168, in urlopen
  File "C:\Python\Python34\lib\urllib\request.py", line 470, in open
  File "C:\Python\Python34\lib\urllib\request.py", line 580, in http_response
  File "C:\Python\Python34\lib\urllib\request.py", line 508, in error
  File "C:\Python\Python34\lib\urllib\request.py", line 442, in _call_chain
  File "C:\Python\Python34\lib\urllib\request.py", line 588, in http_error_default
urllib.error.HTTPError: HTTP Error 401: Unauthorized
```

---

### Description of your *issue*, suggested solution and other information

The given video https://www.youtube.com/watch?v=I_tNvkNlNoI cannot be downloaded when the option '-f best/mp4' is given. Just downloading the video with ``youtube-dl I_tNvkNlNoI`` is no problem. It appears to has something to do with the format nr 160:

```
youtube-dl -F I_tNvkNlNoI
[youtube] I_tNvkNlNoI: Downloading webpage
[youtube] I_tNvkNlNoI: Downloading video info webpage
[youtube] I_tNvkNlNoI: Extracting video information
[youtube] I_tNvkNlNoI: Downloading MPD manifest
[info] Available formats for I_tNvkNlNoI:
format code  extension  resolution note
139          m4a        audio only DASH audio   48k , m4a_dash container, mp4a.40.5@ 48k (22050Hz), 356.06KiB
249          webm       audio only DASH audio   52k , opus @ 50k, 371.85KiB
250          webm       audio only DASH audio   63k , opus @ 70k, 441.94KiB
171          webm       audio only DASH audio   89k , vorbis@128k, 658.89KiB
140          m4a        audio only DASH audio  127k , m4a_dash container, mp4a.40.2@128k (44100Hz), 948.22KiB
251          webm       audio only DASH audio  167k , opus @160k, 1.18MiB
278          webm       192x144    144p   99k , webm container, vp9, 15fps, video only, 627.50KiB
160          mp4        192x144    DASH video  113k , avc1.42c00c, 15fps, video only, 834.93KiB
133          mp4        320x240    DASH video  248k , avc1.4d400d, 30fps, video only, 1.78MiB
242          webm       320x240    240p  268k , vp9, 30fps, video only, 1.52MiB
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k
18           mp4        320x240    medium , avc1.42001E, mp4a.40.2@ 96k
43           webm       640x360    medium , vp8.0, vorbis@128k (best)
```
```
youtube-dl -f 160 I_tNvkNlNoI
[youtube] I_tNvkNlNoI: Downloading webpage
[youtube] I_tNvkNlNoI: Downloading video info webpage
[youtube] I_tNvkNlNoI: Extracting video information
[youtube] I_tNvkNlNoI: Downloading MPD manifest
ERROR: unable to download video data: HTTP Error 401: Unauthorized
```

I've tested this on 2 different PC's. One Linux, one windows 10. Both with different IP addresses and location. I suspect it has something to do with the mp4 not being available at youtube.

### Possible solution

Some fallback to other formats (as the 133 or 18 format in this case which do work) when an automatically selected format (by using the best/mp4 option) does not work.
Furthermore the format nr 133 appears to be the best option, but 160 is selected automatically. Why?