animelover1984 / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
Other
287 stars 48 forks source link

Can't download video with danmaku: <urlopen error [Errno -2] Name or service not known> #40

Open Cavernosa opened 2 years ago

Cavernosa commented 2 years ago

Without comments it works perfectly

$ youtube-dl https://www.nicovideo.jp/watch/sm10780722
[niconico] sm10780722: Downloading video info page
[niconico] sm10780722: Downloading HTML5 player webpage
[niconico] sm10780722: Downloading JSON metadata for h264_360p-aac_192kbps
[niconico] sm10780722: Downloading JSON metadata for h264_360p_low-aac_192kbps
[niconico] sm10780722: Downloading JSON metadata for h264_360p-aac_64kbps
[niconico] sm10780722: Downloading JSON metadata for h264_360p_low-aac_64kbps
[download] Heartbeat with 15.0 second interval...
[download] Destination: おちゃめ機能 歌った-sm10780722.mp4
[download] 100% of 8.51MiB in 00:57

But using --write-sub --all-subs throws an error

$ youtube-dl https://www.nicovideo.jp/watch/sm10780722 --write-sub --all-subs
[niconico] sm10780722: Downloading video info page
[niconico] sm10780722: Downloading HTML5 player webpage
[niconico] sm10780722: Downloading JSON metadata for h264_360p-aac_192kbps
[niconico] sm10780722: Downloading JSON metadata for h264_360p_low-aac_192kbps
[niconico] sm10780722: Downloading JSON metadata for h264_360p-aac_64kbps
[niconico] sm10780722: Downloading JSON metadata for h264_360p_low-aac_64kbps
[niconico] sm10780722: Downloading comments from thread 1/1 (en)
ERROR: Unable to download JSON metadata: <urlopen error [Errno -2] Name or service not known> (caused by URLError(gaierror(-2, 'Name or service not known')))
$ youtube-dl http://www.nicovideo.jp/watch/sm10780722 --all-subs --write-sub -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['http://www.nicovideo.jp/watch/sm10780722', '--all-subs', '--write-sub', '-v']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.12.14
[debug] Python version 3.9.7 (CPython) - Linux-5.14.14-artix1-1-x86_64-with-glibc2.33
[debug] exe versions: ffmpeg 4.4, ffprobe 4.4
[debug] Proxy map: {}
[niconico] sm10780722: Downloading video info page
[niconico] sm10780722: Downloading HTML5 player webpage
[niconico] sm10780722: Downloading JSON metadata for h264_360p-aac_192kbps
[niconico] sm10780722: Downloading JSON metadata for h264_360p_low-aac_192kbps
[niconico] sm10780722: Downloading JSON metadata for h264_360p-aac_64kbps
[niconico] sm10780722: Downloading JSON metadata for h264_360p_low-aac_64kbps
[niconico] sm10780722: Downloading comments from thread 1/1 (en)
ERROR: Unable to download JSON metadata: <urlopen error [Errno -2] Name or service not known> (caused by URLError(gaierror(-2, 'Name or service not known')))
  File "/home/caverna/.local/lib/python3.9/site-packages/youtube_dl/extractor/common.py", line 633, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/home/caverna/.local/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 2284, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/usr/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/home/caverna/.local/lib/python3.9/site-packages/youtube_dl/utils.py", line 2740, in https_open
    return self.do_open(p, req, **kwargs)
  File "/usr/lib/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
CompulsiveConfig commented 2 years ago

Can confirm same issue

horahoradev commented 2 years ago

🙀🙀🙀 Will take a look at this weekend; in the meantime, I'd recommend switching to yt-dlp if it fits your use case.