介绍 :You-Get
是一个小型的命令行实用程序,用于从Web
下载媒体内容(视频,音频,图像),以防没有其他方便的方法。
- Github
- Github中文
安装
安装pip
#ubuntu
apt install python3-pip
#centos
yum install pip3
安装you-get
you-get
之官方版本通过PyPI
分发, 可从PyPI
镜像中通过pip
包管理器安装. 须知您务必使用版本3
的pip
:
pip3 install you-get
命令简介
Usage: you-get [OPTION]... [URL]...
Startup options:
-V | --version 版本信息
-h | --help 帮助
Dry-run options: (no actual downloading)
-i | --info 列出所有可获取的视频信息
-u | --url 打印URLs的提取出信息,真实链接地址
--json 打印URLs的JSON格式
Download options:
-n | --no-merge 不合并分片
--no-caption 不下载其他文件(字幕,歌词,弹幕。。。)
-f | --force 覆盖存在的文件
-F | --format <STREAM_ID> 选择下载那种清晰度的视频
-O | --output-filename <FILE> 设置输出文件名
-o | --output-dir <PATH> 输出文件夹(相对位置可用,如:~/video/)
-p | --player <PLAYER [OPTIONS]> 将提取出的真实地址传给播放器
-c | --cookies <COOKIES_FILE> 导入cookies.txt或cookies.sqlite(firefox下使用export-cookies插件)
-x | --http-proxy <HOST:PORT> 使用HTTP代理下载
-y | --extractor-proxy <HOST:PORT> 仅对真实地址视频文件的下载使用HTTP代理
--no-proxy 不使用代理
-s | --socks-proxy <HOST:PORT> 使用SOCKS5协议代理
-t | --timeout <SECONDS> 设置代理的timeout
-d | --debug 显示traceback和其他的debug信息
-I | --input-file 仅下载链接的视频不下载列表
简单使用
当您收到感兴趣的影片时,您可以使用--info/ -i选项查看所有可用的品质和格式:
$ you-get -i 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
site: YouTube
title: Me at the zoo
streams: # Available quality and codecs
[ DEFAULT ] _________________________________
- itag: 43
container: webm
quality: medium
size: 0.5 MiB (564215 bytes)
# download-with: you-get --itag=43 [URL]
- itag: 18
container: mp4
quality: medium
# download-with: you-get --itag=18 [URL]
- itag: 5
container: flv
quality: small
# download-with: you-get --itag=5 [URL]
- itag: 36
container: 3gp
quality: small
# download-with: you-get --itag=36 [URL]
- itag: 17
container: 3gp
quality: small
# download-with: you-get --itag=17 [URL]
标有DEFAULT
为默认画质。如认同,直接可下载:
$ you-get 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
site: YouTube
title: Me at the zoo
stream:
- itag: 43
container: webm
quality: medium
size: 0.5 MiB (564215 bytes)
# download-with: you-get --itag=43 [URL]
Downloading zoo.webm ...
100.0% ( 0.5/0.5 MB) ├████████████████████████████████████████┤[1/1] 7 MB/s
Saving Me at the zoo.en.srt ...Done.
(如YouTube
视频带有字幕,将被一同下载,以SubRip
格式保存.)
或,如您希望其他格式(mp4)
,请使用其他提示选项:
you-get --itag=18 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
下载其他内容
如你有URL
,可以直接使用:
$ you-get https://stallman.org/rms.jpg
Site: stallman.org
Title: rms
Type: JPEG Image (image/jpeg)
Size: 0.06 MiB (66482 Bytes)
Downloading rms.jpg ...
100.0% ( 0.1/0.1 MB) ├████████████████████████████████████████┤[1/1] 127 kB/s
或者, you-get
将自动检查网页,下载一切有可能感兴趣的内容:
$ you-get http://kopasas.tumblr.com/post/69361932517
Site: Tumblr.com
Title: kopasas
Type: Unknown type (None)
Size: 0.51 MiB (536583 Bytes)
Site: Tumblr.com
Title: tumblr_mxhg13jx4n1sftq6do1_1280
Type: Portable Network Graphics (image/png)
Size: 0.51 MiB (536583 Bytes)
Downloading tumblr_mxhg13jx4n1sftq6do1_1280.png ...
100.0% ( 0.5/0.5 MB) ├████████████████████████████████████████┤[1/1] 22 MB/s
暂停与恢复下载
可以使用Ctrl+C
暂停下载.
临时的.download
文件将保存于输出目录。下次使用you-get
传入相同参数时,下载将从上次继续开始. 如果下载已经完成 (临时的.download 扩展名消失), you-get将忽略下载.
用--force/-f
强行重下载. (注意: 将覆盖同名文件或临时文件!)
设置输出文件名或路径
使用--output-dir/-o
设定路径, --output-filename/-O
设定输出文件名:
you-get -o ~/Videos -O zoo.webm 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
代理设置
使用 --http-proxy/-x
为you-get
设置HTTP
代理:
you-get -x 127.0.0.1:8087 'https://www.youtube.com/watch?v=jNQXAC9IVRw'
然而系统代理 (即系统变量http_proxy) 自动使用. 使用--no-proxy
强行关闭.
注意事项
默认情况下,下载最高清晰度视频
输入任意内容如:you-get "i love china" 可以从Google
内搜索并下载视频,youtube-dl
也有类似功能
bug
地址:https://github.com/soimort/you-get/issues
支持网站
[1]: https://github.com/soimort/you-get [2]: https://github.com/soimort/you-get/wiki/%E4%B8%AD%E6%96%87%E8%AF%B4%E6%98%8E#installation [3]: https://jscdn.cachefly.net/web/wxiou/20200623194515.png
1 条评论
Very useful article! I’ve been helping my cousin from China plan her first international trip, and Turkey is at the top of her list. We were confused by one simple but important question—do Chinese citizens need a visa for Turkey?—and your post explained it perfectly. I love how you outlined the e-Visa system and clarified what’s needed to qualify. That alone saved us so much time! Your writing is easy to follow and super informative, which isn’t always the case with travel blogs. Thanks for creating content that travelers can actually rely on. I’m looking forward to reading more of your posts as we get further into trip planning.