使用
在观看 Google I/O 2012 ( 官网 ) 视频, 网络不是很稳定, 老卡, 打算下载下来看, 并且方便可以重温.
使用 FF 下载, 手动一个个下, 感觉有点二, 并且不稳定, 有时候 putty 会掉线, 失去链接.
Google 了一下, 找到了 youtube-dl , 代码存放在 github 上 ( 这里 )
下载 / 安装
需要 python 2.7 , vps 上的python 版本是 2.4, 得先升级下, 见这里.
安装好 python 2.7 后, 开始安装 youtube-dl
wget https://raw.github.com/rg3/youtube-dl/2012.02.27/youtube-dl -O /usr/local/bin/youtube-dl; chmod 755 /usr/local/bin/youtube-dl
文档可以 看这里
基本使用:
youtube-dl -t "http://www.youtube.com/watch?v=lz0o-y-2wT0"
输出:
[youtube] Setting language [youtube] lz0o-y-2wT0: Downloading video webpage [youtube] lz0o-y-2wT0: Downloading video info webpage [youtube] lz0o-y-2wT0: Extracting video information [download] Destination: How_we_did_it_-_Project_Glass_Demo_At_Google_I_O-lz0o-y-2wT0.mp4 [download] 100.0% of 241.77M at 10.19M/s ETA 00:00
下载 list , 示例 – 下载 GDC 2012 视频 -> Youtube
youtube-dl -tc http://www.youtube.com/playlist?list=PL0803CD315D85ED5E
输出:
[youtube] Setting language [youtube] PL 0803CD315D85ED5E: Downloading page #1 [youtube] R281PhQufHo: Downloading video webpage [youtube] R281PhQufHo: Downloading video info webpage [youtube] R281PhQufHo: Extracting video information [download] Destination: GDC_2012_Porting_your_game_to_NaCl-R281PhQufHo.mp4 [download] 100.0% of 305.32M at 10.36M/s ETA 00:00 [youtube] huXucPChX3g: Downloading video webpage [youtube] huXucPChX3g: Downloading video info webpage [youtube] huXucPChX3g: Extracting video information [download] Destination: GDC_2012_Best_practices_in_developing_a_web_game-huXucPChX3g.mp4 [download] 100.0% of 535.02M at 10.15M/s ETA 00:00 [youtube] XAqIpGU8ZZk: Downloading video webpage [youtube] XAqIpGU8ZZk: Downloading video info webpage [youtube] XAqIpGU8ZZk: Extracting video information [download] Destination: GDC_2012_From_Console_to_Chrome-XAqIpGU8ZZk.mp4 [download] 100.0% of 517.39M at 10.39M/s ETA 00:00 [youtube] 7bJ-D1xXEeg: Downloading video webpage [youtube] 7bJ-D1xXEeg: Downloading video info webpage [youtube] 7bJ-D1xXEeg: Extracting video information [download] Destination: GDC_2012_DXT_is_NOT_ENOUGH_Advanced_texture_compression_for_games-7bJ-D1xXEeg.mp4 [download] 100.0% of 280.40M at 9.93M/s ETA 00:00 [youtube] _adMEEAtDwE: Downloading video webpage [youtube] _adMEEAtDwE: Downloading video info webpage [youtube] _adMEEAtDwE: Extracting video information [download] Destination: GDC_2012_The_Bleeding_Edge_of_Open_Web_Tech-_adMEEAtDwE.mp4 [download] 100.0% of 417.45M at 10.39M/s ETA 00:00 [youtube] lz0o-y-2wT0: Downloading video webpage [youtube] lz0o-y-2wT0: Downloading video info webpage [youtube] lz0o-y-2wT0: Extracting video information [download] How_we_did_it_-_Project_Glass_Demo_At_Google_I_O-lz0o-y-2wT0.mp4 has already been downloaded [youtube] OOE9l23P7jg: Downloading video webpage [youtube] OOE9l23P7jg: Downloading video info webpage [youtube] OOE9l23P7jg: Extracting video information
更复杂的操作, 示例 – 下载 Google IO 2012 LIST -> Youtube
youtube-dl -tc --playlist-start 2 --playlist-end 2 http://www.youtube.com/playlist?list=PL56D792A831D0C362
参数解释:
-t 下载后以下载目标的 title 命名,
-c 断点续传
–playlist-start 是在播放列表里面的开始 id, 默认为 1 , 就是从第一个下载
–playlist-end 是在播放列表里面的结束 id, 默认为 最后
更多参数设置请看 这里