you-get下载B站视频
库存
you-get介绍
-
you-get是一个命令行工具,可以下载知名网站的视频
-
支持的网站有
https://github.com/soimort/you-get#supported-sites
-
B站、优酷、iqiyi等号称都支持(未测试)
-
you-get安装
-
pip安装即可
pip install you-get
-
安装完毕可以在python主目录下看到you-get.exe
-
B站视频下载
若有侵权,联系删除
单个视频
-
我们打开命令行就可以直接下载该视频
you-get https://www.bilibili.com/video/BV1EW411u7th?p=1
you-get: This is a multipart video. (use --playlist to download all parts.)
site: Bilibili
title: 【计算机科学速成课】[40集全/精校] - Crash Course Computer Science (P1. 1. 计算机早期历史-Early Computing)
stream:
- format: dash-flv
container: mp4
quality: 高清 1080P
size: 95.9 MiB (100564888 bytes)
# download-with: you-get --format=dash-flv [URL]
Downloading 【计算机科学速成课】(40集全-精校) - Crash Course Computer Science (P1. 1. 计算机早期历史-Early Comput.mp4 ...
100% ( 95.9/ 95.9MB) ├████████████████████████████████████████┤[2/2] 9 MB/s
Merging video parts... Merged into 【计算机科学速成课】(40集全-精校) - Crash Course Computer Science (P1. 1. 计算机早期历史-Early Comput.mp4
Downloading 【计算机科学速成课】(40集全-精校) - Crash Course Computer Science (P1. 1. 计算机早期历史-Early Comput.cmt.xml ... -
观察输出信息,可以看到我们下载了1个视频,还有xml文件
-
如果不需要xml
you-get --playlist --no-caption https://www.bilibili.com/video/BV1EW411u7th?p=1
系列视频
所谓的系列视频就是尾部的?p=1是连续的
以前没有这个参数的时候我还写了个python代码封装了下,现在直接就用参数搞定了。
-
头部有个提示非常重要:This is a multipart video. (use --playlist to download all parts.)
-
我们可以使用命令下载所有该系列的视频
you-get --playlist https://www.bilibili.com/video/BV1EW411u7th?p=1
视频列表
-
比如码农高天的《不基础的python基础》
https://www.bilibili.com/video/BV1ju411z7Sy/?spm_id_from=333.788&vd_source=d61c58dca32c5d3ac2ed193c3abdd530
-
附录:命令行参数
-
你可以忽略这部分
-
参数可以通过you-get --help得到,常用的并不多。
-
-O FILE 输出到指定文件名
-
-o DIR 输出到某个目录下
-
Download options:
-n, --no-merge Do not merge video parts
--no-caption Do not download captions (subtitles, lyrics, danmaku, ...)
--postfix Postfix downloaded files with unique identifiers
-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
-t SECONDS, --timeout SECONDS
Set socket timeout
-d, --debug Show traceback and other debug info
-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
-m, --m3u8 download video using an m3u8 url
Playlist optional options:
--first FIRST the first number
--last LAST the last number
--size PAGE_SIZE, --page-size PAGE_SIZE
the page size number
Proxy options:
-x HOST:PORT, --http-proxy HOST:PORT
Use an HTTP proxy for downloading
-y HOST:PORT, --extractor-proxy HOST:PORT
Use an HTTP proxy for extracting only
--no-proxy Never use a proxy
-s HOST:PORT or USERNAME:PASSWORD@HOST:PORT, --socks-proxy HOST:PORT or USERNAME:PASSWORD@HOST:PORT
Use an SOCKS5 proxy for downloading