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 download fails with: unable to download video data: HTTP Error 401: Unauthorized #14061

Open
Ronnnn opened this issue Aug 30, 2017 · 3 comments

Comments

@Ronnnn
Copy link

@Ronnnn Ronnnn commented Aug 30, 2017

  • I've verified and I assure that I'm running youtube-dl 2017.08.27.1

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • 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?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 30, 2017

Can you watch this in browser in the first place?

@Ronnnn
Copy link
Author

@Ronnnn Ronnnn commented Aug 30, 2017

Just tried on the third PC and here it does work with youtube-dl.exe -v -f best/mp4 I_tNvkNlNoI or youtube-dl -f 160 I_tNvkNlNoI. The first option however downloads an .webm variant instead of the expected .mp4.
Tried again on the Ubuntu machine resulting in the same error ERROR: unable to download video data: HTTP Error 401: Unauthorized.
The only difference I can think of the ip-address and the url where the downloader is invoked on:
https://r3---sn-oapm-guhl.googlevideo.com/ => does NOT work
https://r1---sn-5hne6n7e.googlevideo.com/ => does work

@seanvree
Copy link

@seanvree seanvree commented Sep 23, 2017

I"m having the same issue.

Windows 10E X64
python 2.7

[09/22/17 18:01:26] WARNING: unable to extract uploader nickname
[09/22/17 18:03:45] ERROR: Unable to extract play info; 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.
[09/22/17 18:24:42] WARNING: unable to extract uploader nickname
[09/22/17 18:33:45] [debug] System config: []
[09/22/17 18:33:45] [debug] User config: []
[09/22/17 18:33:45] [debug] Custom config: []
[09/22/17 18:33:45] [debug] Command-line args: ['--newline', '-i', '-o', 'C:\\Users\\Administrator\\Downloads\\%(title)s.%(ext)s', '-f', '136', '-v', '--hls-prefer-native', 'https://www.youtube.com/watch?v=CMXiCR2gQw0']
[09/22/17 18:33:45] [debug] Encodings: locale cp1252, fs mbcs, out cp1252, pref cp1252
[09/22/17 18:33:45] [debug] youtube-dl version 2017.09.15
[09/22/17 18:33:45] [debug] Python version 3.4.4 - Windows-10-10.0.15063
[09/22/17 18:33:45] [debug] exe versions: ffmpeg 3.3.2, ffprobe 3.3.2
[09/22/17 18:33:45] [debug] Proxy map: {}
[09/22/17 18:39:30] [debug] System config: []
[09/22/17 18:39:30] [debug] User config: []
[09/22/17 18:39:30] [debug] Custom config: []
[09/22/17 18:39:30] [debug] Command-line args: ['--newline', '-i', '-o', 'C:\\Users\\Administrator\\Downloads\\%(title)s.%(ext)s', '-f', '22', '-v', '--hls-prefer-native', 'https://www.youtube.com/watch?v=CMXiCR2gQw0']
[09/22/17 18:39:30] [debug] Encodings: locale cp1252, fs mbcs, out cp1252, pref cp1252
[09/22/17 18:39:30] [debug] youtube-dl version 2017.09.15
[09/22/17 18:39:30] [debug] Python version 3.4.4 - Windows-10-10.0.15063
[09/22/17 18:39:30] [debug] exe versions: ffmpeg 3.3.2, ffprobe 3.3.2
[09/22/17 18:39:30] [debug] Proxy map: {}
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
3 participants
You can’t perform that action at this time.