为什么用 youtube-dl 设置代理参数时无法下载视频标题?
Why can't download video title when to set proxy argument with youtube-dl?
该命令无需 proxy
参数即可获取视频标题,运行 在我的 vps 上。
url="https://www.youtube.com/watch?v=znmQ7oMiQrM&list=PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9&index=1"
youtube-dl -o "/tmp/%(title)s.%(ext)s" --write-auto-sub --yes-playlist $url
上述命令的输出信息。
[info] Writing video subtitles to: /tmp/Session 1 - Introduction to Valuation.en.vtt
[download] Destination: /tmp/Session 1 - Introduction to Valuation.mp4
它可以获取视频字幕,现在添加proxy
参数,运行在我的本地电脑上。
url="https://www.youtube.com/watch?v=znmQ7oMiQrM&list=PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9&index=1"
youtube-dl -o "/tmp/%(title)s.%(ext)s" --proxy "socks5://127.0.0.1:1080/" --write-auto-sub --yes-playlist $url
我只添加了proxy
参数,其他的保持不变,得到如下输出:
WARNING: Unable to extract video title
[youtube] znmQ7oMiQrM: Looking for automatic captions
[info] Writing video subtitles to: /tmp/_.en.vtt
[download] Destination: /tmp/_.f248.webm
它可以下载没有标题的视频作为下载的视频,如果参数proxy
的动作不同,为什么我的vps上的运行有关系?
添加 v
参数以详细显示所有信息。
youtube-dl -v --write-pages -o "/tmp/%(title)s.%(ext)s" --proxy "socks5://127.0.0.1:1080/" --write-auto-sub --yes-playlist $url
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--write-pages', '-o', '/tmp/%(title)s.%(ext)s', '--proxy', 'socks5://127.0.0.1:1080/', '--write-auto-sub', '--yes-playlist', 'https://www.youtube.com/watch?v=znmQ7oMiQrM&list=PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9&index=1']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.07.16
[debug] Python version 3.5.3 (CPython) - Linux-4.9.0-9-amd64-x86_64-with-debian-9.9
[debug] exe versions: ffmpeg 3.2.14-1, ffprobe 3.2.14-1
[debug] Proxy map: {'https': 'socks5://127.0.0.1:1080/', 'http': 'socks5://127.0.0.1:1080/'}
[youtube:playlist] Downloading playlist PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9 - add --no-playlist to just download video znmQ7oMiQrM
[youtube:playlist] PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9: Downloading webpage
[youtube:playlist] Saving request to PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9_https_-_www.youtube.com_playlistlist=PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9_disable_polymer=true.dump
[download] Downloading playlist: Valuation
[youtube:playlist] playlist Valuation: Downloading 25 videos
[download] Downloading video 1 of 25
[youtube] znmQ7oMiQrM: Downloading webpage
[youtube] Saving request to znmQ7oMiQrM_https_-_www.youtube.com_watchhas_verified=1_bpctr=9999999999_v=znmQ7oMiQrM_disable_polymer=true_hl=en_gl=US.dump
[youtube] znmQ7oMiQrM: Downloading video info webpage
[youtube] Saving request to znmQ7oMiQrM_https_-_www.youtube.com_get_video_infohl=en_gl=US_video_id=znmQ7oMiQrM_disable_polymer=true_eurl=_ps=default_el=embedded.dump
WARNING: Unable to extract video title
[youtube] znmQ7oMiQrM: Looking for automatic captions
[debug] Default format spec: bestvideo+bestaudio/best
[info] Writing video subtitles to: /tmp/_.en.vtt
[debug] Invoking downloader on 'https://r4---sn-a5msen7l.googlevideo.com/videoplayback?expire=1565674517&ei=tPdRXZy-MND8kgbJ7JrwCQ&ip=65.49.218.106&id=o-APXnQrHHHHttAI0VI1FjI3xIZNQKXoAcTffCZvbDaowF&itag=248&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-a5msen7l%2Csn-a5mekne7&ms=au%2Crdu&mv=m&mvi=3&pl=20&initcwndbps=1261250&mime=video%2Fwebm&gir=yes&clen=123038403&dur=974.431&lmt=1540749282657199&mt=1565652704&fvip=1&keepalive=yes&c=WEB&txp=5432432&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=ALgxI2wwRQIgWW_UbLJqGcCIkKNgYhCKSWEDpC_ND_4c-_e9LSbAMkACIQDKZNf_b01YjtrNllZFNq_dL7GX5bX6CM5jsgiaqw0JZQ%3D%3D&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRQIgFkroUYnazUgzoaBbuU1Ot4vu81LmQex7WfJoNhsNx6kCIQCCIeMh_wo0F2bUysi0P9yJCZBh9g9XfxKQpZMGvYKw6A%3D%3D&ratebypass=yes'
[download] Destination: /tmp/_.f248.webm
一个update to youtube-dl was recently made to address similar issues;试试新版本:
$ youtube-dl --update
$ youtube-dl --version
2019.08.13
If that doesn't resolve your problem you could try the geo-restriction
options, or file a bug report with the developers and
provide access to your vpn, vps, proxy, etc. so they can debug it.
sudo pip3 install --upgrade youtube-dl
该命令无需 proxy
参数即可获取视频标题,运行 在我的 vps 上。
url="https://www.youtube.com/watch?v=znmQ7oMiQrM&list=PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9&index=1"
youtube-dl -o "/tmp/%(title)s.%(ext)s" --write-auto-sub --yes-playlist $url
上述命令的输出信息。
[info] Writing video subtitles to: /tmp/Session 1 - Introduction to Valuation.en.vtt
[download] Destination: /tmp/Session 1 - Introduction to Valuation.mp4
它可以获取视频字幕,现在添加proxy
参数,运行在我的本地电脑上。
url="https://www.youtube.com/watch?v=znmQ7oMiQrM&list=PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9&index=1"
youtube-dl -o "/tmp/%(title)s.%(ext)s" --proxy "socks5://127.0.0.1:1080/" --write-auto-sub --yes-playlist $url
我只添加了proxy
参数,其他的保持不变,得到如下输出:
WARNING: Unable to extract video title
[youtube] znmQ7oMiQrM: Looking for automatic captions
[info] Writing video subtitles to: /tmp/_.en.vtt
[download] Destination: /tmp/_.f248.webm
它可以下载没有标题的视频作为下载的视频,如果参数proxy
的动作不同,为什么我的vps上的运行有关系?
添加 v
参数以详细显示所有信息。
youtube-dl -v --write-pages -o "/tmp/%(title)s.%(ext)s" --proxy "socks5://127.0.0.1:1080/" --write-auto-sub --yes-playlist $url
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--write-pages', '-o', '/tmp/%(title)s.%(ext)s', '--proxy', 'socks5://127.0.0.1:1080/', '--write-auto-sub', '--yes-playlist', 'https://www.youtube.com/watch?v=znmQ7oMiQrM&list=PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9&index=1']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.07.16
[debug] Python version 3.5.3 (CPython) - Linux-4.9.0-9-amd64-x86_64-with-debian-9.9
[debug] exe versions: ffmpeg 3.2.14-1, ffprobe 3.2.14-1
[debug] Proxy map: {'https': 'socks5://127.0.0.1:1080/', 'http': 'socks5://127.0.0.1:1080/'}
[youtube:playlist] Downloading playlist PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9 - add --no-playlist to just download video znmQ7oMiQrM
[youtube:playlist] PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9: Downloading webpage
[youtube:playlist] Saving request to PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9_https_-_www.youtube.com_playlistlist=PLUkh9m2BorqnKWu0g5ZUps_CbQ-JGtbI9_disable_polymer=true.dump
[download] Downloading playlist: Valuation
[youtube:playlist] playlist Valuation: Downloading 25 videos
[download] Downloading video 1 of 25
[youtube] znmQ7oMiQrM: Downloading webpage
[youtube] Saving request to znmQ7oMiQrM_https_-_www.youtube.com_watchhas_verified=1_bpctr=9999999999_v=znmQ7oMiQrM_disable_polymer=true_hl=en_gl=US.dump
[youtube] znmQ7oMiQrM: Downloading video info webpage
[youtube] Saving request to znmQ7oMiQrM_https_-_www.youtube.com_get_video_infohl=en_gl=US_video_id=znmQ7oMiQrM_disable_polymer=true_eurl=_ps=default_el=embedded.dump
WARNING: Unable to extract video title
[youtube] znmQ7oMiQrM: Looking for automatic captions
[debug] Default format spec: bestvideo+bestaudio/best
[info] Writing video subtitles to: /tmp/_.en.vtt
[debug] Invoking downloader on 'https://r4---sn-a5msen7l.googlevideo.com/videoplayback?expire=1565674517&ei=tPdRXZy-MND8kgbJ7JrwCQ&ip=65.49.218.106&id=o-APXnQrHHHHttAI0VI1FjI3xIZNQKXoAcTffCZvbDaowF&itag=248&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-a5msen7l%2Csn-a5mekne7&ms=au%2Crdu&mv=m&mvi=3&pl=20&initcwndbps=1261250&mime=video%2Fwebm&gir=yes&clen=123038403&dur=974.431&lmt=1540749282657199&mt=1565652704&fvip=1&keepalive=yes&c=WEB&txp=5432432&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=ALgxI2wwRQIgWW_UbLJqGcCIkKNgYhCKSWEDpC_ND_4c-_e9LSbAMkACIQDKZNf_b01YjtrNllZFNq_dL7GX5bX6CM5jsgiaqw0JZQ%3D%3D&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRQIgFkroUYnazUgzoaBbuU1Ot4vu81LmQex7WfJoNhsNx6kCIQCCIeMh_wo0F2bUysi0P9yJCZBh9g9XfxKQpZMGvYKw6A%3D%3D&ratebypass=yes'
[download] Destination: /tmp/_.f248.webm
一个update to youtube-dl was recently made to address similar issues;试试新版本:
$ youtube-dl --update
$ youtube-dl --version
2019.08.13
If that doesn't resolve your problem you could try the geo-restriction options, or file a bug report with the developers and provide access to your vpn, vps, proxy, etc. so they can debug it.
sudo pip3 install --upgrade youtube-dl