前言
汪汪。
想不到2021年的第一周就拖更了啊,刚立下的flag瞬间糊自己一脸,噗。
上周工作方面事情太多,周末也忙到完全忘记了这回事(仔细想想工作日的晚上少打两把游戏也说不定就能憋出来了,拖延症误我)。
先水一篇把上周的账平掉(划掉),今天要说的是一个很niubility的视频下载神器——you-get。
介绍
you-get是一个基于Python3和FFmpeg的第三方库,源码开源在github,有官方网站,配置和使用方法很简单,兼容大多数视频网站,还能顺便下载字幕、弹幕、图片等资源,是我比较常用的工具。
安装
第一步,要安装Python3.2或者更高的版本。
直接到Python官网找到适合自己系统的安装包下载安装即可,注意版本不能低于3.2,这里就不做演示了。
第二步,要安装FFmpeg。
这是一个老面孔了,最强大的开源视频处理工具没有之一。直接到FFmpeg官网找到下载链接,根据自己系统找到编译好的可执行程序,windows的话直接到github或者直接点此链接下载,下载完后找到ffmpeg.exe这个程序。
将ffmpeg.exe放到Python可以自动调用的位置,例如Python安装目录下或者Python安装目录下的Scripts文件夹内。
或者将ffmpeg.exe放到别的文件夹下,然后将该文件夹的路径加到PATH环境变量中,这样you-get就可以自动寻找到ffmpeg.exe并调用。
第三步,安装you-get本体。
you-get的安装有很多方式,这里只说最简单的通过Python3自带的pip包管理工具安装的方法,克隆git编译什么的专业开发人员自己看官网说明折腾去吧
在CMD窗口中输入以下命令回车,等待安装完毕即可。
pip install you-get
升级已安装的you-get可以使用以下命令。
pip install --upgrade you-get
安装完毕后在CMD输入you-get -V
然后回车,如果打印出you-get的版本信息即为安装成功。
使用
you-get的使用非常方便,直接在CMD窗口中输入you-get 视频网址
即可将视频下载到CMD当前目录下。
以万能的B站为例。
默认下载的是视频的最高清晰度,并且如果有字幕或者弹幕的话,也会同时下载下来。
下载其他清晰度
在CMD窗口中输入you-get -i 视频网址
然后回车即可打印出所有可以下载的清晰度,并有各自的下载代码。
如果想要下载360p的视频,那么只要输入you-get --format=flv360 视频网址
即可下载。
其他选项
使用代理
在下载YouTube等国外网站的视频时,you-get可以通过-x
选项设置要使用的HTTP代理,或者使用-s
选项设置要使用的SOCKS5代理。
使用SOCKS5代理如果报错,可以通过pip装一下PySocks这个第三方库 ,再进行下载。
pip install PySocks
you-get -x 192.168.0.13:1080 https://www.youtube.com/watch?v=lIES3ii-IOg you-get -s 192.168.0.13:1081 https://www.youtube.com/watch?v=lIES3ii-IOg
设置保存路径
you-get默认将视频存储到CMD当前目录下,视频标题则为视频原本的标题,可以使用-o
和-O
参数修改保存路径和视频标题。
you-get -o D:\videos -O "Kaizo Trap.mp4" https://www.youtube.com/watch?v=lIES3ii-IOg
断点续传
默认开启断点续传,在下载中断后,重新执行下载代码,会从刚才中断的位置继续下载,网络不稳定的小伙伴不用担心了。
如果不想续传可以使用-f
参数,这样就会重新开始下载。
多个下载
当要下载多个视频时,可以将视频网址逐行写到txt文件中,然后使用-I
参数,即可逐个下载。
you-get -I D:\urls.txt
如果要下载的视频网址为分集视频或者播放列表,例如B站的多集视频教程,可以使用-l
参数,即可下载所有视频。
you-get -l https://www.bilibili.com/video/BV1ex411x7Em
独立播放
可以通过-p
参数调用本地播放器播放网页视频,省去烦人的广告。
you-get -p vlc https://www.bilibili.com/video/BV1ev411x7en
cookies支持
很多网站的视频需要登录账号或者开通会员才能观看,这种情况下就没法直接使用you-get下载,可以使用-c
参数,加载浏览器的cookies文件进行下载。
需要注意的是这个功能目前只支持Firefox(cookies.sqlite)和Netscape(cookies.txt)这两款浏览器。
以比较常用的Firefox浏览器为例,cookies存储路径为C:\Users\当前用户名\AppData\Roaming\Mozilla\Firefox\Profiles\随机字符.default-release\cookies.sqlite
,直接加载进行下载即可。
you-get -c cookies.sqlite https://www.bilibili.com/bangumi/play/ss26652
支持网站
支持常用的YouTube、Bilibili、niconico、iQiYi、优酷、腾讯视频等在线视频网站,还有抖音、快手、网易云音乐、斗鱼等各类短视频音乐直播网站,甚至Facebook、百度贴吧、知乎、Tumblr、豆瓣等等偏向社交分享的平台,具体可以在官网支持列表查看。
喜欢谈论痛苦的,
往往是不识愁滋味的少年,
而饱尝人间苦难的老年贝多芬,
却唱起了欢乐颂。
《灵魂只能独行》
——周国平
评论
735224 565436Excellent article. I appreciate your attention to this topic and I learned a whole lot 471857
I also think therefore, perfectly composed post! .
https://www.dublantechnology.com/altavoces-portatiles-y-de-fiesta/151431-jbl-jblflip6blk-flip-6-negro-30-w-6925281992971.html
Youre so cool! I dont suppose Ive read something like this before. So nice to find somebody with some unique thoughts on this subject. realy thanks for starting this up. this web site is something that’s needed on the net, someone with a bit of originality. helpful job for bringing something new to the web!
https://www.actualteam.com/hire-a-hacker-for-whatsapp/
Almost all of the things you claim is astonishingly appropriate and it makes me wonder why I had not looked at this with this light before. Your piece truly did switch the light on for me as far as this subject goes. Nonetheless there is one particular position I am not too comfortable with and while I make an effort to reconcile that with the actual main idea of the point, permit me see exactly what all the rest of the subscribers have to say.Well done.
https://youtu.be/SfWI8Hj1WfY
Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!
https://youtu.be/2hfKFiLKaFg
Whats Going down i’m new to this, I stumbled upon this I have discovered It absolutely helpful and it has helped me out loads. I am hoping to give a contribution & aid other customers like its aided me. Good job.
https://youtu.be/YJ79lcx8cgo
Real fantastic info can be found on web blog. “I believe in nothing, everything is sacred. I believe in everything, nothing is sacred.” by Tom Robbins.
https://youtu.be/BmR_L57lgjY
225448 168710Wohh just what I was looking for, appreciate it for putting up. 846862
Great web site. Lots of helpful information here. I am sending it to a few buddies ans also sharing in delicious. And of course, thanks in your effort!
https://www.revtut.com/hire-a-hacker-for-whatsapp/
I believe this is one of the most significant info for me. And i’m happy studying your article. However should observation on some normal issues, The website taste is perfect, the articles is really nice : D. Excellent activity, cheers
https://youtu.be/9eZIPlO-CEE
Thank you, I have just been searching for information about this topic for ages and yours is the best I’ve discovered till now. But, what about the bottom line? Are you sure about the source?
https://www.revtut.com/hire-a-hacker-for-instagram/
929846 50405This is some excellent details. I expect additional facts like this was distributed across the internet today. 816109
Ikaria Lean Belly Juice is a fast-acting weight loss supplement that is developed to incinerate stubborn fat.
https://youtu.be/PyBRYFp8gEE
You got a very great website, Gladiolus I observed it through yahoo.
https://youtu.be/_608arb5Lxc