python
第三方库you-get
命令行下载工具,可下载图片音视频等。
前提安装python
环境和pip3
学习更多请访问:You-Get官网
和GitHub项目
pip3 install you-get #安装
pip3 install --upgrade you-get #升级
you-get
报错,不是内部或外部命令,也不是可运行的程序。无法使用you-get,可能是版本过于老旧
D:\Program\Coding\Python\Scripts>you-get
'you-get' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
pip3 install --upgrade you-get
更新后再次执行you-get
没问题。
D:\Program\Coding\Python\Scripts>pip3 install --upgrade you-get
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/you-get/
Collecting you-get
Downloading you_get-0.4.1545-py3-none-any.whl (228 kB)
|████████████████████████████████| 228 kB 285 kB/s
Installing collected packages: you-get
Successfully installed you-get-0.4.1545
WARNING: You are using pip version 20.2.3; however, version 21.2.4 is available.
You should consider upgrading via the 'd:\program\coding\python\python.exe -m pip install --upgrade pip' command.
看更新提示:
d:\program\coding\python\python.exe -m pip install --upgrade pip
又再次执行更新!
G:\>d:\program\coding\python\python.exe -m pip install --upgrade pip
Collecting pip
Downloading pip-21.2.4-py3-none-any.whl (1.6 MB)
|████████████████████████████████| 1.6 MB 25 kB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.2.3
Uninstalling pip-20.2.3:
Successfully uninstalled pip-20.2.3
WARNING: The scripts pip.exe, pip3.9.exe and pip3.exe are installed in 'd:\program\coding\python\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-21.2.4
执行下载命令:
you-get URL
完毕后,目录下:
每天一遍,遁入空门.flv
视频文件
每天一遍,遁入空门.cmt.xml
字幕/弹幕文件
G:\>you-get https://www.bilibili.com/video/BV1pe411W7eY/?spm_id_from=autoNext
site: Bilibili
title: 每天一遍,遁入空门
stream:
- format: flv
container: flv
quality: 高清 1080P
size: 22.6 MiB (23674289 bytes)
# download-with: you-get --format=flv [URL]
Downloading 每天一遍,遁入空门.flv ...
100% ( 22.6/ 22.6MB) ├████████████████████████████████████████┤[1/1] 549 kB/s
Downloading 每天一遍,遁入空门.cmt.xml ...
you-get -i URL
或you-get --info URL
查看要下载的视频各种清晰度,默认值等。
you-get --format=flv360 URL
选择指定清晰度
G:\>you-get -i https://www.bilibili.com/video/BV12C4y1H7i3/?spm_id_from=333.788.recommend_more_video.8
site: Bilibili
title: 希 望 家 人 没 事 儿
streams: # Available quality and codecs
[ DASH ] ____________________________________
- format: dash-flv
container: mp4
quality: 高清 1080P
size: 24.7 MiB (25879051 bytes)
# download-with: you-get --format=dash-flv [URL]
- format: dash-flv720
container: mp4
quality: 高清 720P
size: 17.2 MiB (18045279 bytes)
# download-with: you-get --format=dash-flv720 [URL]
- format: dash-flv480
container: mp4
quality: 清晰 480P
size: 11.4 MiB (11946361 bytes)
# download-with: you-get --format=dash-flv480 [URL]
- format: dash-flv360
container: mp4
quality: 流畅 360P
size: 10.6 MiB (11128105 bytes)
# download-with: you-get --format=dash-flv360 [URL]
[ DEFAULT ] _________________________________
- format: flv
container: flv
quality: 高清 1080P
size: 39.0 MiB (40944933 bytes)
# download-with: you-get --format=flv [URL]
- format: flv720
container: flv
quality: 高清 720P
size: 26.6 MiB (27893668 bytes)
# download-with: you-get --format=flv720 [URL]
- format: flv480
container: flv
quality: 清晰 480P
size: 16.9 MiB (17734507 bytes)
# download-with: you-get --format=flv480 [URL]
- format: flv360
container: flv
quality: 流畅 360P
size: 10.7 MiB (11263136 bytes)
# download-with: you-get --format=flv360 [URL]
定义下载路径:
you-get -o [new_path] [url]
windows下按ctl+C 暂停下载,生成.download文件。继续下载重新执行下载命令
强制重新下载:you-get -f [url]
进度条从0%开始
you-get -f --format=flv360 URL #重新下载URL
you-get -o G:\linux --format=flv360 URL #下载URL到指定路径
you-get "NAME"
根据名称
G:\>you-get "千千阙歌"
you-get: [error] oops, something went wrong.
you-get: don't panic, c'est la vie. please try the following steps:
you-get: (1) Rule out any network problem.
you-get: (2) Make sure you-get is up-to-date.
you-get: (3) Check if the issue is already known, on
you-get: https://github.com/soimort/you-get/wiki/Known-Bugs
you-get: https://github.com/soimort/you-get/issues
you-get: (4) Run the command with '--debug' option,
you-get: and report this issue with the full output.
you-get "NAME" --debug
打印每一步结果,方便排错。
G:\>you-get "千千阙歌" --debug
[DEBUG] get_content: https://www.google.com/search?tbm=vid&q=%E5%8D%83%E5%8D%83%E9%98%99%E6%AD%8C
...
urllib.error.URLError: <urlopen error [WinError 10060]
由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。>