question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Broken] YouTube: a very small number of videos consistently fail to download

See original GitHub issue

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-f', '137+251', '--cookies', 'Y:\\cookies.txt', '--add-metadata', '--write-description', '--write-info-json', '--write-thumbnail', '--download-archive', 'Y:\\ytdl_archive.txt', '--all-subs', '-ciw', '-o', '%(title)s.%(ext)s', '-v', 'https://www.youtube.com/watch?v=LIdZ2oPyB1Y']
[debug] Loading archive file 'Y:\\ytdl_archive.txt'
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dlc version 2020.11.11-2
[debug] Python version 3.9.0 (CPython) - Windows-10-10.0.19041-SP0
[debug] exe versions: ffmpeg git-2020-04-15-51db0a4, ffprobe 4.3.1-2020-10-01-full_build-www.gyan.dev
[debug] Proxy map: {}
[youtube] LIdZ2oPyB1Y: Downloading webpage
[info] Video description is already present
[info] Video subtitle en.vtt is already present
[info] Video subtitle tr.vtt is already present
[info] Video description metadata is already present
[youtube] LIdZ2oPyB1Y: Thumbnail is already present
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on 'https://r5---sn-hp57kn7e.googlevideo.com/videoplayback?expire=1606634316&ei=6_bCX8bLNuuDzLUP5pi8oAM&ip=77.81.142.124&id=o-ABxbQ79-SQUNxEEobMptDUyFmzaAcyduZOh0portJKj-&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&requiressl=yes&mh=wM&mm=31%2C29&mn=sn-hp57kn7e%2Csn-hp57yne7&ms=au%2Crdu&mv=m&mvi=5&pl=24&initcwndbps=633750&vprv=1&mime=video%2Fmp4&ns=KsUGVusZhmzwLjUH87Cn8yEF&gir=yes&clen=249849935&dur=1342.720&lmt=1572754520057451&mt=1606612362&fvip=5&keepalive=yes&c=WEB&txp=1306222&n=eRfKKH3XA4B5i7zHf36&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgCkzbEg6HpwujHV6Zu9gFcCZ9rPEBjcJ3JK-iZWLrQVYCIQCZoM-u9Slf2GXAjgqhOhsTM0H-fcEx2C6NpT-Ng1sUxQ%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgZH75_E7jj_TWqgwOwjw5wGYRqZiq-9THO7z7BrBJHGsCIQCS3s_ppZN__VE--XDQFihwQ5A_saofyzFdOcPNBlEdBQ%3D%3D&ratebypass=yes'
ERROR: unable to download video data: <urlopen error [WinError 10051] A socket operation was attempted to an unreachable network>
Traceback (most recent call last):
  File "urllib\request.py", line 1342, in do_open
  File "http\client.py", line 1255, in request
  File "http\client.py", line 1301, in _send_request
  File "http\client.py", line 1250, in endheaders
  File "http\client.py", line 1010, in _send_output
  File "http\client.py", line 950, in send
  File "http\client.py", line 1417, in connect
  File "http\client.py", line 921, in connect
  File "socket.py", line 843, in create_connection
  File "socket.py", line 831, in create_connection
OSError: [WinError 10051] A socket operation was attempted to an unreachable network

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "youtube_dlc\YoutubeDL.py", line 2014, in process_info
  File "youtube_dlc\YoutubeDL.py", line 1875, in dl
  File "youtube_dlc\downloader\common.py", line 375, in download
  File "youtube_dlc\downloader\http.py", line 349, in real_download
  File "youtube_dlc\downloader\http.py", line 114, in establish_connection
  File "youtube_dlc\downloader\http.py", line 110, in establish_connection
  File "youtube_dlc\YoutubeDL.py", line 2325, in urlopen
  File "urllib\request.py", line 517, in open
  File "urllib\request.py", line 534, in _open
  File "urllib\request.py", line 494, in _call_chain
  File "youtube_dlc\utils.py", line 2736, in https_open
  File "urllib\request.py", line 1345, in do_open
urllib.error.URLError: <urlopen error [WinError 10051] A socket operation was attempted to an unreachable network>

Description

When I archive whole channels, some videos may fail to download due to copyright claims, but there are a few outliers like this one that work fine on YouTube and fail in yt-dlc. This might happen to one out of every 2000 videos I archive, but these same videos are failing the same way for multiple weeks across reboots and new program versions. I noticed that Waterfox seems to be using different servers than yt-dlc for some reason; it seems that the servers yt-dlc is picking up don’t actually work. Here’s a sample of the network traffic dev console panel for that video:

image

Also, there does appear to be one mention of the server yt-dlc is trying in the list; it shows 0 bytes transferred.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
blackjack4494commented, Nov 30, 2020

This is odd. Works fine for me. But I saw some other people having similar problems.
Okay I tried some urls multiple times and this error is not consistent for me but sometimes pop up.

1reaction
Vangelis66commented, Nov 29, 2020

Probably related issue: https://github.com/blackjack4494/yt-dlc/issues/258

Nice catch! But the errors printed are somewhat different:

https://github.com/blackjack4494/yt-dlc/issues/264:

[debug] Invoking downloader on 'https://r5---sn-hp57kn7e.googlevideo.com/videoplayback?expire=1606634316&ei=6_bCX8bLNuuDzLUP5pi8oAM&ip=77.81.142.124&id=o-ABxbQ79-SQUNxEEobMptDUyFmzaAcyduZOh0portJKj-&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&requiressl=yes&mh=wM&mm=31%2C29&mn=sn-hp57kn7e%2Csn-hp57yne7&ms=au%2Crdu&mv=m&mvi=5&pl=24&initcwndbps=633750&vprv=1&mime=video%2Fmp4&ns=KsUGVusZhmzwLjUH87Cn8yEF&gir=yes&clen=249849935&dur=1342.720&lmt=1572754520057451&mt=1606612362&fvip=5&keepalive=yes&c=WEB&txp=1306222&n=eRfKKH3XA4B5i7zHf36&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgCkzbEg6HpwujHV6Zu9gFcCZ9rPEBjcJ3JK-iZWLrQVYCIQCZoM-u9Slf2GXAjgqhOhsTM0H-fcEx2C6NpT-Ng1sUxQ%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgZH75_E7jj_TWqgwOwjw5wGYRqZiq-9THO7z7BrBJHGsCIQCS3s_ppZN__VE--XDQFihwQ5A_saofyzFdOcPNBlEdBQ%3D%3D&ratebypass=yes'
ERROR: unable to download video data: <urlopen error [WinError 10051] A socket operation was attempted to an unreachable network>

https://github.com/blackjack4494/yt-dlc/issues/258:

[debug] Invoking downloader on 'https://r4---sn-uxaxovg-vnae7.googlevideo.com/videoplayback?expire=1606380694&ei=Nhi_X9WQI5G8yQX85KmgDw&ip=82.164.193.144&id=o-AIuH8ge2YKQcxn5OSQfwBIeY8A_2agc2r5r1NCYeZV8g&itag=248&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=yt_otf&requiressl=yes&mh=8P&mm=31%2C29&mn=sn-uxaxovg-vnae7%2Csn-5goeen7d&ms=au%2Crdu&mv=m&mvi=4&pl=16&initcwndbps=1718750&vprv=1&mime=video%2Fwebm&ns=qwoo8gNZ6-NLdjn6Qtp16BoF&otf=1&otfp=1&dur=879.111&lmt=1489552536986074&mt=1606358914&fvip=4&keepalive=yes&c=WEB&n=FDlsYvWQOWr4SlRWYsV&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cotf%2Cotfp%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAPqHQMisZgQLvQsPcFhPJTWCnMs6fra3CwmXp3Bwv7miAiEAyFmdM5tGBbBfwO8aPF9QKk1xqVazEmLuGtLuKFNmZf4%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgdELB3vcaPYaBonZW_z5iuCctO62Opd-ojBb8RUgWT0ACIQDIlTERjRsWIOjLIJEqhGcD5HO01ndPQpcM6fXjm17MUQ%3D%3D&ratebypass=yes'
ERROR: unable to download video data: HTTP Error 404: Not Found

i.e. <urlopen error [WinError 10051] A socket operation was attempted to an unreachable network> Vs HTTP Error 404: Not Found

which, to me at least, means in the latter case the connection is being established to the node, but that then returns a 404 response; in this issue, yt-dlc doesn’t even manage to connect at all (???)

Read more comments on GitHub >

github_iconTop Results From Across the Web

a very small number of videos consistently fail to download ...
YouTube provides more than one host to fetch video data but youtube-dl just rolls with the first one in the list and aborts...
Read more >
[Problem Solved!] Can't Download YouTube Videos Anymore
If you can't download YouTube videos using the YouTube app on your phone or tablet, do you know the reason and how to...
Read more >
How to Fix YouTube Downloaded Videos Not Playing? [2022]
Sometimes YouTube downloaded videos are not playing on the device. If you get this error, continue reading this article to find the solution....
Read more >
[Update: Dec. 20] YouTube bugs/issues & pending ...
Here we are tracking all the bugs and problems found on YouTube and their status as well as any pending improvements that are...
Read more >
Common uploading errors - YouTube Help - Google Support
If you're having problems uploading your video, select the error message you're ... "Rejected (file too small)" ... You can upload more videos...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found