deepin入坑指南——使用you-get下载主流视频网站的视频
安装和配置pip3
安装pip3
首先安装pip3,终端输入命令:
1
|
sudo apt install python3-pip
|
更换国内源
临时使用可以加上-i参数,指定pip源,例如
1
|
pip install you-get -i https://pypi.tuna.tsinghua.edu.cn/simple
|
永久修改则修改~/.pip/pip.conf(没有就创建一个), 内容如下
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
一些国内的镜像源:
- 阿里云 http://mirrors.aliyun.com/pypi/simple/
- 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
- 豆瓣 http://pypi.douban.com/simple/
- 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
- 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
安装you-get
终端输入命令
1
|
sudo pip3 install you-get
|
若要更新,使用命令
1
|
pip3 install --upgrade you-get
|
使用you-get
下载指定格式的视频
首先使用–info或者-i参数获取视频信息
这里的url就是浏览器访问视频时地址框里的那个
例如,如果我要下载爱奇艺上的德云社春晚相声,就在终端输入
1
|
you-get -i https://www.iqiyi.com/v_19rx2ez0w4.html
|
这时you-get的输出如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
you-get: vd: 75 is not handled
you-get: info is {'m3utx': 'http://cache.m.iqiyi.com/mus/text/250351801/b5d8357ec33641c316bf0a0dc7adb8bb/afbe8fd3d73448c9/0/20200329/c8/99/ccd2f230c814c2aab54a6994e7433afb.m3u8?qd_originate=tmts_py&tvid=14281781800&bossStatus=0&qd_vip=0&px=&src=3_31_312&prv=&previewType=&previewTime=&from=&qd_time=1613129716572&qd_p=0e9d4591&qd_asc=4af38ab6f480b859f7b88d496c8c019e&qypid=14281781800_04022000001000000000_75&qd_k=2004ae445e0a1b1825cfd616d87f3c93&isdol=0&code=2&ff=f4v&iswb=0&qd_s=otv&vf=4b7c73268eb847d33a7cfeaba213652d&np_tag=nginx_part_tag', 'lgt': 13, 'mver': 100, 'screenSize': '896x504', 'ists': 1, 'unencryptedDuration': 0, 'vd': 75, 'm3u': 'http://cache.m.iqiyi.com/mus/250351801/b5d8357ec33641c316bf0a0dc7adb8bb/afbe8fd3d73448c9/0/20200329/c8/99/ccd2f230c814c2aab54a6994e7433afb.m3u8?qd_originate=tmts_py&tvid=14281781800&bossStatus=0&qd_vip=0&px=&src=3_31_312&prv=&previewType=&previewTime=&from=&qd_time=1613129716572&qd_p=0e9d4591&qd_asc=4af38ab6f480b859f7b88d496c8c019e&qypid=14281781800_04022000001000000000_75&qd_k=2004ae445e0a1b1825cfd616d87f3c93&isdol=0&code=2&ff=f4v&iswb=0&qd_s=otv&vf=4b7c73268eb847d33a7cfeaba213652d&np_tag=nginx_part_tag', 'code': 2, 'dr': -1, 'drmType': 1, 'vid': 'b5d8357ec33641c316bf0a0dc7adb8bb'}
site: 爱奇艺 (Iqiyi)
title: 2020天津卫视德云社相声春晚之精编版(下)
streams: # Available quality and codecs
[ DEFAULT ] _________________________________
- format: TD
container: m3u8
video-profile: 720p
m3u8_url: http://cache.m.iqiyi.com/mus/250351801/4fc7566f752ca2c20ee1894df99f3453/afbe8fd3d73448c9/0/20201029/55/b3/e55e81f305266eedc05bc074d249a6ef.m3u8?qd_originate=tmts_py&tvid=14281781800&bossStatus=0&qd_vip=0&px=&src=3_31_312&prv=&previewType=&previewTime=&from=&qd_time=1613129716572&qd_p=0e9d4591&qd_asc=5d4075f202f2fb30c7fdce7f8c417e54&qypid=14281781800_04022000001000000000_4&qd_k=2004ae445e0a1b1825cfd616d87f3c93&isdol=0&code=2&ff=f4v&iswb=0&qd_s=otv&vf=fd25d9f6bc8aa66ca5e06de000b36658&np_tag=nginx_part_tag
# download-with: you-get --format=TD [URL]
- format: TD_H265
container: m3u8
video-profile: 720p H265
m3u8_url: http://cache.m.iqiyi.com/mus/250351801/2b2b080be951084fab021dc1249384ef/afbe8fd3d73448c9/0/20201029/55/b3/0d6fcc58ff080f575ed5a4386cda8356.m3u8?qd_originate=tmts_py&tvid=14281781800&bossStatus=0&qd_vip=0&px=&src=3_31_312&prv=&previewType=&previewTime=&from=&qd_time=1613129716572&qd_p=0e9d4591&qd_asc=26fa4e7c5403eee1942e73344f47c57c&qypid=14281781800_04022000001000000000_17&qd_k=2004ae445e0a1b1825cfd616d87f3c93&isdol=0&code=1&ff=265ts&iswb=0&qd_s=otv&vf=e10bf652e02b1611a2de6a7c498c3329&np_tag=nginx_part_tag
# download-with: you-get --format=TD_H265 [URL]
- format: HD
container: m3u8
video-profile: 540p
m3u8_url: http://cache.m.iqiyi.com/mus/250351801/3297bf14ce29680457e74bd3b29655fc/afbe8fd3d73448c9/0/20201029/55/b3/6111cf77ca9d50b5c836493d3e274487.m3u8?qd_originate=tmts_py&tvid=14281781800&bossStatus=0&qd_vip=0&px=&src=3_31_312&prv=&previewType=&previewTime=&from=&qd_time=1613129716572&qd_p=0e9d4591&qd_asc=02e9664c7cff7ff4c5602f30c9dcea89&qypid=14281781800_04022000001000000000_2&qd_k=2004ae445e0a1b1825cfd616d87f3c93&isdol=0&code=2&ff=f4v&iswb=0&qd_s=otv&vf=796575d2118904ecdab75e98af416dce&np_tag=nginx_part_tag
# download-with: you-get --format=HD [URL]
- format: HD_H265
container: m3u8
video-profile: 540p H265
m3u8_url: http://cache.m.iqiyi.com/mus/250351801/31bc12eef9157c0fa186664858bfe712/afbe8fd3d73448c9/0/20201029/55/b3/58650d10ae97ea73506f1041d72e4dac.m3u8?qd_originate=tmts_py&tvid=14281781800&bossStatus=0&qd_vip=0&px=&src=3_31_312&prv=&previewType=&previewTime=&from=&qd_time=1613129716572&qd_p=0e9d4591&qd_asc=cfbf044d5dfa5b87d7d0d1d090e4886b&qypid=14281781800_04022000001000000000_21&qd_k=2004ae445e0a1b1825cfd616d87f3c93&isdol=0&code=1&ff=265ts&iswb=0&qd_s=otv&vf=e1b20f06c858cdf7d55590f459f480bc&np_tag=nginx_part_tag
# download-with: you-get --format=HD_H265 [URL]
- format: SD
container: m3u8
video-profile: 360p
m3u8_url: http://cache.m.iqiyi.com/mus/250351801/5d7a91960ce5b8c049136e4be8d0c4ac/afbe8fd3d73448c9/0/20200329/c8/99/946add8a95cc05f129fc1d5d0ac9da14.m3u8?qd_originate=tmts_py&tvid=14281781800&bossStatus=0&qd_vip=0&px=&src=3_31_312&prv=&previewType=&previewTime=&from=&qd_time=1613129716572&qd_p=0e9d4591&qd_asc=5f34d251fe608a49cfdd0c584ec27667&qypid=14281781800_04022000001000000000_1&qd_k=2004ae445e0a1b1825cfd616d87f3c93&isdol=0&code=2&ff=f4v&iswb=0&qd_s=otv&vf=f172ed9a453a415f9b7425254fb93444&np_tag=nginx_part_tag
# download-with: you-get --format=SD [URL]
- format: LD
container: m3u8
video-profile: 210p
m3u8_url: http://cache.m.iqiyi.com/mus/250351801/0b184d7790ebe24ce40d6a42d4a87927/afbe8fd3d73448c9/0/20200329/c8/99/5f0701913828afadb29cd633c1c0744b.m3u8?qd_originate=tmts_py&tvid=14281781800&bossStatus=0&qd_vip=0&px=&src=3_31_312&prv=&previewType=&previewTime=&from=&qd_time=1613129716572&qd_p=0e9d4591&qd_asc=7bccc88a2ca1cd6e26843180eb3b20f6&qypid=14281781800_04022000001000000000_96&qd_k=2004ae445e0a1b1825cfd616d87f3c93&isdol=0&code=2&ff=f4v&iswb=0&qd_s=otv&vf=251ad0fd24c007bc80630a1647da6ff9&np_tag=nginx_part_tag
# download-with: you-get --format=LD [URL]
|
这里的第六行往下就是可选下载的视频了
注意前面有一个"-“号的条目,这里是format.所以在下载的时候应该输入
1
|
you-get --format=<-format后面的那个> https://www.iqiyi.com/v_19rx2ez0w4.html
|
在每一个可选视频的最下面,you-get也给出了提示:download-with XXX,只需要把[URL]替换成要下载的视频的链接即可,例如
1
|
you-get --format=TD https://www.iqiyi.com/v_19rx2ez0w4.html
|
如果不使用-i参数,那么会默认直接下载第一个视频
然后,你就可以在当前终端的目录找到这个视频了
设置输出路径
如果要指定下载到的目录,则可以使用-o选项后面加上输出文件夹的路径,例如我要把春晚德云社的相声存到桌面上,就可以输入
1
|
you-get -o ~/Desktop --format=TD https://www.iqiyi.com/v_19rx2ez0w4.html
|
加载cookies以下载vip视频
有一些视频是要vip才能下载的,这时就可以加载cookies(保存登录信息,这要求先登录vip账号),这时就可以使用其加载cookies的功能
在linux下,you-get目前仅支持firefox的cookies,文件名是cookies.sqlite,路径是~/.mozilla/firefox/XXX.default-release/cookies.sqlite
要加载cookie,使用-c选项加上cookies.sqlite的路径,例如
1
|
you-get --format=TD https://www.iqiyi.com/v_19rx2ez0w4.html -c=~/Desktop/cookies.sqlite
|
参考资料
PIP 更换国内安装源
github:you-get
cookie 存放地点
you-get下载会员视频使用-c参数导入cookies.sqlite文件