Skip to main content

A simple tool to download videos from bilibili{*≧∀≦}

Project description

Bilibili视频下载器

 

下载

方式一

pip install sole-bili-get -i https://www.pypi.org/simple/

PS(更新版本):pip install sole-bili-get -U

方式二

git clone https://github.com/muggledy/bili-get.git
python setup.py sdist bdist_wheel
pip install dist\sole_bili_get-0.0.1-py3-none-any.whl //demo
bili-get --help

使用

C:\Users\muggledy\Downloads>bili-get https://www.bilibili.com/video/BV1CY4y1F7hP
output: C:\Users\muggledy\Downloads
  (origin url):https://www.bilibili.com/video/BV1CY4y1F7hP
       (title):p1_总耗时近一年!七爷带你一步到位看完昭和《奥特曼》系列全部345集怪兽及宇宙人们!_1初代奥特曼
        (desc):此视频送给希望一气看完昭和全奥的朋友们!
(episodes num):7
     (quality):清晰 480P(id:32), 流畅 360P(id:16)
selected download quality(MAX):32
get danmu urls success for 7 episodes
p1 danmu xml file is downloaded into C:\Users\muggledy\Downloads\bili_output\BV1CY4y1F7hP\p1_总耗时近一年!七爷带你一步到位看完昭和《奥特曼》系列全部345集怪兽及宇宙人们!_1初代奥特曼.xml
start to download p1(video:清晰 480P,852x480,avc1.64001F_581618_29.412) from https://www.bilibili.com/video/BV1CY4y1F7hP/?p=1...
100.00%|████████████████████| 下载完成【application/octet-stream】 84.96MB/84.96MB
start to download p1(audio)...
100.00%|████████████████████| 下载完成【application/octet-stream】 28.28MB/28.28MB
ffmpeg merge success, save into C:\Users\muggledy\Downloads\bili_output\BV1CY4y1F7hP\p1_总耗时近一年!七爷带你一步到位看完昭和《奥特曼》系列全部345集怪兽及宇宙人们!_1初代奥特曼.mp4
Note: this is a multi-episode video, you can download them all at once with --playlist
  • 默认是下载到当前工作路径,可以通过-o--output指定输出目录,不存在则自动创建,譬如bili-get https://www.bilibili.com/video/BV1CY4y1F7hP -o D:\workspace\bilibili。这会在--output目录下产生两个文件夹:bili_tmp/bili_output/,前者存放一些临时文件,用于记录多剧集视频的下载进度,如果下载过程中发生中断,重新执行命令可以继续下载过程(且对于尚未合成的剧集会尝试进行合成,除非指定--nomerge参数),后者则是视频、音频、弹幕文件的输出文件夹

  • 对于多剧集视频,可以指定--playlist自动下载全部剧集,只要不删除对应的bili_tmp/临时文件,可以任意重复执行下载命令,如bili-get https://www.bilibili.com/video/BV1CY4y1F7hP --playlist,也不会重复下载,如果UP主新发布了剧集,则会继续下载

  • -c--cookie用于指定您的B站Cookie信息,这样就可以下载1080P视频了

    C:\Users\muggledy\Downloads>bili-get https://www.bilibili.com/video/BV1CY4y1F7hP -c "your cookie"
    output: C:\Users\muggledy\Downloads
      (origin url):https://www.bilibili.com/video/BV1CY4y1F7hP
           (title):p1_总耗时近一年!七爷带你一步到位看完昭和《奥特曼》系列全部345集怪兽及宇宙人们!_1初代奥特曼
            (desc):此视频送给希望一气看完昭和全奥的朋友们!
    (episodes num):7
         (quality):高清 1080P(id:80), 高清 720P(id:64), 清晰 480P(id:32), 流畅 360P(id:16)
    selected download quality(MAX):80
    get danmu urls success for 7 episodes
    p1 danmu xml file is downloaded into C:\Users\muggledy\Downloads\bili_output\BV1CY4y1F7hP\p1_总耗时近一年!七爷带你一步到位看完昭和《奥特曼》系列全部345集怪兽及宇宙人们!_1初代奥特曼.xml
    start to download p1(video:高清 1080P,1920x1080,avc1.640032_2344634_29.412) from https://www.bilibili.com/video/BV1CY4y1F7hP/?p=1...
    100.00%|████████████████████| 下载完成【video/mp4】 342.48MB/342.48MB
    start to download p1(audio)...
    100.00%|████████████████████| 下载完成【video/mp4】 28.28MB/28.28MB
    ffmpeg merge success, save into C:\Users\muggledy\Downloads\bili_output\BV1CY4y1F7hP\p1_总耗时近一年!七爷带你一步到位看完昭和《奥特曼》系列全部345集怪兽及宇宙人们!_1初代奥特曼.mp4
    Note: this is a multi-episode video, you can download them all at once with --playlist
    

    Cookie获取方式如下:

  • -q--quality用于指定要下载的视频质量(清晰度),可选值有MAX(最高质量,缺省值)、MIN(最低质量)、MANUAL(手动选择视频质量)

  • --nomerge表示是否自动合成下载下来的音视频文件,默认合成,但需要提前下载ffmpeg工具(windows版本)并将其路径添加到PATH环境变量

  • --force表示强制重新下载视频,携带该参数会直接删除bili_tmp/临时文件,但不会立即删除全部已下载音视频文件,而是覆盖更新

  • --debug用于在控制台输出全部debug日志信息,不指定该参数,也会将日志输出到bili_tmp/log中以备查阅

  • 默认随视频会下载弹幕XML文件,可以使用danmu2ass做弹幕格式转换,双击Danmu2Ass.sln,用Visual Studio打开并编译,在项目Danmu2Ass目录下会生成bin文件夹,进入其中的Debug文件夹,可以看到一个Kaedei.Danmu2Ass.exe可执行文件,将视频和弹幕文件一块拖动到该可执行文件图标上去即可生成ASS字幕文件,再通过potplayer打开视频即可自动加载字幕

致谢

如果觉得本工具有用,请点个Star呗~,有bug或有改进意见请提issue,thx!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sole_bili_get-0.0.4.tar.gz (19.8 kB view hashes)

Uploaded Source

Built Distribution

sole_bili_get-0.0.4-py3-none-any.whl (18.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page