我的 youtube-dl 是最新版本:
youtube-dl --version
2020.07.28
我发现有些网址可以下载,有些则不能。
#url which can be downloaded
url='https://www.youtube.com/watch?v=5dZ_lvDgevk'
root@vultr:~/video# youtube-dl -v $url
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://www.youtube.com/watch?v=5dZ_lvDgevk']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.07.28
[debug] Python version 3.5.3 (CPython) - Linux-4.9.0-12-amd64-x86_64-with-debian-9.12
[debug] exe versions: ffmpeg 3.2.14-1, ffprobe 3.2.14-1
[debug] Proxy map: {}
[youtube] 5dZ_lvDgevk: Downloading webpage
[debug] Default format spec: bestvideo+bestaudio/best
[download] Destination: In the Age of AI (full film) _ FRONTLINE-5dZ_lvDgevk.f137.mp4
[download] 100% of 1.21GiB in 00:24
[download] Destination: In the Age of AI (full film) _ FRONTLINE-5dZ_lvDgevk.f251.webm
[download] 100% of 109.03MiB in 00:01
[ffmpeg] Merging formats into "In the Age of AI (full film) _ FRONTLINE-5dZ_lvDgevk.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:In the Age of AI (full film) _ FRONTLINE-5dZ_lvDgevk.f137.mp4' -i 'file:In the Age of AI (full film) _ FRONTLINE-5dZ_lvDgevk.f251.webm' -c copy -map 0:v:0 -map 1:a:0 'file:In the Age of AI (full film) _ FRONTLINE-5dZ_lvDgevk.temp.mkv'
Deleting original file In the Age of AI (full film) _ FRONTLINE-5dZ_lvDgevk.f137.mp4 (pass -k to keep)
Deleting original file In the Age of AI (full film) _ FRONTLINE-5dZ_lvDgevk.f251.webm (pass -k to keep)
该网址已成功下载,我们再尝试一下。
#url which can't be downloaded
url="https://www.youtube.com/watch?v=bpAi70WWBlw"
youtube-dl -v $url
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://www.youtube.com/watch?v=bpAi70WWBlw']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.07.28
[debug] Python version 3.5.3 (CPython) - Linux-4.9.0-12-amd64-x86_64-with-debian-9.12
[debug] exe versions: ffmpeg 3.2.14-1, ffprobe 3.2.14-1
[debug] Proxy map: {}
[youtube] bpAi70WWBlw: Downloading webpage
ERROR: bpAi70WWBlw: YouTube said: Unable to extract video data
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/youtube_dl/YoutubeDL.py", line 797, in extract_info
ie_result = ie.extract(url)
File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 530, in extract
ie_result = self._real_extract(url)
File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/youtube.py", line 1893, in _real_extract
'YouTube said: %s' % unavailable_message, expected=True, video_id=video_id)
youtube_dl.utils.ExtractorError: bpAi70WWBlw: YouTube said: Unable to extract video data
它失败了。
如何修复它?