B站中的教学视频大都有许多分集,而且可能涉及到版权,过不了多久可能会失效,最好的办法就是先保存下来再说。
这里介绍的you-get可以下载许多视频网站的视频,在此仅介绍B站的下法。
虽然速度基本在120~200kB/s,但还是可以接受吧
第一步:安装Python3,过程略......
第二步:安装you-get,从cmd输入pip install you-get 即可,如果安装失败,试试如下命令:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple you-get
第三版:从cmd输入命令
you-get -l -o f:\codetutor\youxi https://www.bilibili.com/video/BV1YZ4y1u73F
-l 参数表示下载全播放列表 也可以写全用 --playlist
-o f:\codetutor\youxi 表示将下载的视频存储到哪个目标文件夹,这里是存到f:\codetutor\youxi,如果不指定则下载到当前目录
https://www.bilibili.com/video/BV1YZ4y1u73F 表示要下载的视频地址
可选参数 --format=dash-flv720 表示下载的视频格式是720p, 这个可以不写,因为默认下载的是最高清格式
---------------------------------------------
※ 如果中途因为网络或者其它原因下载失败, 可重新运行该命令,断点续传(自动跳过已经下载的列表中的分集)
※ 更好的办法是:如果是从第43集下载失败, 则运行you-get -l -o f:\codetutor\youxi https://www.bilibili.com/video/BV1YZ4y1u73F?p=43
则它会从第43集开始断点续传, 下载完43集后自动下载之后的44集、45集......
---------------------------------------------
如果仅需要下载list中的某单个视频,在av号的后面加上?p=x(x是第几个视频),这里就不要加 -l 参数了
you-get https://www.bilibili.com/video/BV1YZ4y1u73F?p=43
------------------------------------------------
※ you-get 基本操作命令:
usage: you-get [OPTION]... URL...
A tiny downloader that scrapes the web
optional arguments:
-V, --version Print version and exit #显示版本并退出
-h, --help Print this help message and exit #显示基本命令
Dry-run options: (no actual downloading) #空运行/预检操作(没有实际下载内容)
-i, --info Print extracted information #显示提取下载信息
-u, --ur Print extracted information with URLs #获得页面所有可下载URL列表
--json Print extracted URLs in JSON format #获得以JSON格式的页面所有可下载信息
Download options: #下载选项
-n, --no-merge Do not merge video part #不合并视频
--no-caption Do not download captions (subtitles, lyrics, danmaku,...) #不下载其他文件(字幕,歌词,弹幕等)
-f, --force Force overwriting existing files #覆盖存在的文件
--skip-existing-file-size-check Skip existing file without checking file size #
-F STREAM_ID, --format STREAM_ID Set video format to STREAM_ID #选择下载哪种清晰度的视频
-O FILE, --output-filename FILE Set output filename #设定输出文件名
-o DIR, --output-dir DIR Set output directory #设定输出路径
-p PLAYER, --player PLAYER Stream extracted URL to a PLAYER #将提取的真实地址传给播放器
-c COOKIES_FILE, --cookies COOKIES_FILE Load cookies.txt or cookies.sqlite #导入cookies.txt或cookies.sqlite(firefox下使用export-cookies插件)
-t SECONDS, --timeout SECONDS Set socket timeout #设置代理的timeout
-d, --debug Show traceback and other debug info #显示traceback和其他的debug信息
-I FILE, --input-file FILE Read non-playlist URLs from FILE #仅下载链接的视频不下载列表
-P PASSWORD, --password PASSWORD Set video visit password to PASSWORD #
-l, --playlist Prefer to download a playlist #下载列表
-a, --auto-rename Auto rename same name different files #
-k, --insecure ignore ssl errors #
Proxy options: #代理选项
-x HOST:PORT, --http-proxy HOST:PORT Use an HTTP proxy for downloading #使用HTTP代理下载
-y HOST:PORT, --extractor-proxy HOST:PORT Use an HTTP proxy for extracting only #仅对真实地址视频文件的下载使用HTTP代理
--no-proxy Never use a proxy #不使用代理
-s HOST:PORT, --socks-proxy HOST:PORT Use an SOCKS5 proxy for downloading #使用SOCKS5协议代理
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)