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] urlopen error [Errno 101] Network is unreachable #22812

Closed
bhattisatish opened this issue Oct 23, 2019 · 6 comments
Closed

[Youtube] urlopen error [Errno 101] Network is unreachable #22812

bhattisatish opened this issue Oct 23, 2019 · 6 comments

Comments

@bhattisatish
Copy link

@bhattisatish bhattisatish commented Oct 23, 2019

Checklist

  • I'm reporting a broken site support
  • I've verified that I'm running youtube-dl version 2019.10.22
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar issues including closed ones

Verbose log

PASTE VERBOSE LOG HERE
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-x', '-k', '-v', 'tahOuqFS8kM']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.10.22
[debug] Python version 3.6.8 (CPython) - Linux-4.15.0-65-generic-x86_64-with-Ubuntu-18.04-bionic
[debug] exe versions: ffmpeg 3.4.6, ffprobe 3.4.6
[debug] Proxy map: {}
[youtube] tahOuqFS8kM: Downloading webpage
[youtube] tahOuqFS8kM: Downloading video info webpage
[youtube] {18} signature length 106, html5 player vflYUXieR
[youtube] {43} signature length 102, html5 player vflYUXieR
[youtube] {133} signature length 106, html5 player vflYUXieR
[youtube] {242} signature length 102, html5 player vflYUXieR
[youtube] {160} signature length 106, html5 player vflYUXieR
[youtube] {278} signature length 102, html5 player vflYUXieR
[youtube] {140} signature length 102, html5 player vflYUXieR
[youtube] {251} signature length 106, html5 player vflYUXieR
[youtube] tahOuqFS8kM: Downloading MPD manifest
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://manifest.googlevideo.com/api/manifest/dash/expire/1571823669/ei/1cuvXeXuLsCz3LUP4tCHgAg/ip/122.167.86.184/id/b5a84ebaa152f243/source/youtube/requiressl/yes/playback_host/r2---sn-ci5gup-cags.googlevideo.com/mm/31%2C29/mn/sn-ci5gup-cags%2Csn-ci5gup-h55l/ms/au%2Crdu/mv/m/mvi/1/pl/19/tx/23756554/txs/23756553%2C23756554/hfr/all/as/fmp4_audio_clear%2Cwebm_audio_clear%2Cwebm2_audio_clear%2Cfmp4_sd_hd_clear%2Cwebm2_sd_hd_clear/initcwndbps/995000/mt/1571801986/fvip/14/fexp/23842630/itag/0/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Ctx%2Ctxs%2Chfr%2Cas%2Citag/sig/ALgxI2wwRQIhAOsLhBh_IAFP9xv2UB7hiUe3bAPeePD9jQeIiR6MkigJAiBpy56-MaNEuiadv31XpF81yD03P9psSKJfJtPwTWxZrQ%3D%3D/lsparams/playback_host%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps/lsig/AHylml4wRQIgaX4UwjRWAX0IGhcJVF9VesqXqWxA1OmfAHGPJYvh6ZQCIQCkddu5W_Rq8Qr9ppZ_0yZ0zSAehZUiGaibTuEYkIzL_Q%3D%3D'
[dashsegments] Total fragments: 1057
[download] Destination: Marshall Rosenberg   The Dynamics Of Empathy-tahOuqFS8kM.f242.webm
[download]   2.6% of ~16.14MiB at  5.91MiB/s ETA 27:21ERROR: unable to download video data: <urlopen error [Errno 101] Network is unreachable>
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/request.py", line 1318, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1254, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1300, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1249, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1036, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 974, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1407, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 946, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
OSError: [Errno 101] Network is unreachable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/satishb/.local/share/virtualenvs/NVC_Workshop-wqQhCiFs/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 1919, in process_info
    partial_success = dl(fname, new_info)
  File "/home/satishb/.local/share/virtualenvs/NVC_Workshop-wqQhCiFs/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 1864, in dl
    return fd.download(name, info)
  File "/home/satishb/.local/share/virtualenvs/NVC_Workshop-wqQhCiFs/lib/python3.6/site-packages/youtube_dl/downloader/common.py", line 366, in download
    return self.real_download(filename, info_dict)
  File "/home/satishb/.local/share/virtualenvs/NVC_Workshop-wqQhCiFs/lib/python3.6/site-packages/youtube_dl/downloader/dash.py", line 48, in real_download
    success, frag_content = self._download_fragment(ctx, fragment_url, info_dict)
  File "/home/satishb/.local/share/virtualenvs/NVC_Workshop-wqQhCiFs/lib/python3.6/site-packages/youtube_dl/downloader/fragment.py", line 102, in _download_fragment
    'http_headers': headers or info_dict.get('http_headers'),
  File "/home/satishb/.local/share/virtualenvs/NVC_Workshop-wqQhCiFs/lib/python3.6/site-packages/youtube_dl/downloader/common.py", line 366, in download
    return self.real_download(filename, info_dict)
  File "/home/satishb/.local/share/virtualenvs/NVC_Workshop-wqQhCiFs/lib/python3.6/site-packages/youtube_dl/downloader/http.py", line 341, in real_download
    establish_connection()
  File "/home/satishb/.local/share/virtualenvs/NVC_Workshop-wqQhCiFs/lib/python3.6/site-packages/youtube_dl/downloader/http.py", line 109, in establish_connection
    ctx.data = self.ydl.urlopen(request)
  File "/home/satishb/.local/share/virtualenvs/NVC_Workshop-wqQhCiFs/lib/python3.6/site-packages/youtube_dl/YoutubeDL.py", line 2237, 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 564, in error
    result = 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 756, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/home/satishb/.local/share/virtualenvs/NVC_Workshop-wqQhCiFs/lib/python3.6/site-packages/youtube_dl/utils.py", line 2724, in https_open
    req, **kwargs)
  File "/usr/lib/python3.6/urllib/request.py", line 1320, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 101] Network is unreachable>

Description

WRITE DESCRIPTION HERE

I am able to download most files from youtube but it consistently fails for certain files with the error
<urlopen error [Errno 101] Network is unreachable>
The file is generally partially downloaded and if I try downloading them in a while loop it continues to download but consistently fails after maybe 1-2% progress irrespective of the file size.
Or it can get stuck at the initial stage say
Resuming download at byte 40814096

The failure consistently happens only with certain files. I have seen this occurring from past 1 month or so. It was present even when I tried with 2019.08.02 and continues with the present version too.

E.gs of failing files are:
tahOuqFS8kM
l7TONauJGfc

My current work around is to download it with the following script

while true; do
youtube-dl -x -k tahOuqFS8kM && break
echo "Retrying"
done

@remitamine
Copy link
Collaborator

@remitamine remitamine commented Oct 23, 2019

most likely a network issue on your side:

youtube-dl tahOuqFS8kM
[youtube] tahOuqFS8kM: Downloading webpage
[youtube] tahOuqFS8kM: Downloading video info webpage
[youtube] tahOuqFS8kM: Downloading js player vflYUXieR
[youtube] tahOuqFS8kM: Downloading js player vflYUXieR
[youtube] tahOuqFS8kM: Downloading MPD manifest
[dashsegments] Total fragments: 1057
[download] Destination: Marshall Rosenberg   The Dynamics Of Empathy-tahOuqFS8kM.f242.webm
[download] 100% of 16.67MiB in 18:25
[dashsegments] Total fragments: 542
[download] Destination: Marshall Rosenberg   The Dynamics Of Empathy-tahOuqFS8kM.f251.webm
[download] 100% of 91.13MiB in 11:22
[ffmpeg] Merging formats into "Marshall Rosenberg   The Dynamics Of Empathy-tahOuqFS8kM.webm"
Deleting original file Marshall Rosenberg   The Dynamics Of Empathy-tahOuqFS8kM.f242.webm (pass -k to keep)
Deleting original file Marshall Rosenberg   The Dynamics Of Empathy-tahOuqFS8kM.f251.webm (pass -k to keep)
@remitamine remitamine closed this Oct 23, 2019
@bhattisatish
Copy link
Author

@bhattisatish bhattisatish commented Oct 27, 2019

This is definitely not a network issue, though the underlying error seems to indicate that. The error persists only for certain files irrespective of how much time has passed by.
For e.g. when I was trying to download a playlist, all files except one where downloaded and all the files where around 1.2- 1.8Gb
I can only download the failing file by continuously trying (eg. by using a while loop). I just tried downloading few files from the same playlist and I am seeing the same behaviour for this particular file even though 1 month has passed by when I tried it lastime.

When a file fails, it consistently fails, which is so unlike a network error.

@remitamine
Copy link
Collaborator

@remitamine remitamine commented Oct 27, 2019

as you can see from the output the same files you're trying to download without failing at all, so it's either a problem in you're network or the servers selected by youtube.com for you.
theses are some measures that you try:

  • setup a Caching DNS Resolver.
  • run youtube-dl in until loop.
    until YOUTUBE-DL_COMMAND; do continue; done
  • select other formats when some of them are continuously failing.
@crystaler4
Copy link

@crystaler4 crystaler4 commented May 6, 2020

Use proxy.

Also possible similar to this

@SwissCheese5
Copy link

@SwissCheese5 SwissCheese5 commented Jun 4, 2020

I'm curious, are any of you guys trying to download the links on google servers? I only had network unreachable errors when I was running youtube-dl on google compute engine.

@bhattisatish
Copy link
Author

@bhattisatish bhattisatish commented Jun 17, 2020

Use proxy.

Yup, that seems to work. I am not sure what is the problem, but looks like hiding my location / region seems to work.

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.