• Stars
    star
    185
  • Rank 208,271 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bilibili video downloader.

bilibili-get

Build Status Coverage Status npm version

youtube-dl like command-line tool resolving & downloading media files from bilibili.

Features

  • Video quality selection
  • Auto-merging video segments
  • Premium account bangumi (with -C option)

WARNING using proxy with cookie may get your account banned since March 2019.

bilibili-get supports downloading video from following type of urls:

URL Playlist Example
User-uploaded Video https://www.bilibili.com/video/av18182135
User-uploaded Video (multipart) โœ“ https://www.bilibili.com/video/av1041170
User-uploaded Video (multipart) https://www.bilibili.com/video/av1041170/index_5.html
Movie Bangumi https://www.bilibili.com/bangumi/play/ss12364/
TV Bangumi (A) โœ“ https://bangumi.bilibili.com/anime/5796
Bangumi Episode (A) https://bangumi.bilibili.com/anime/5786/play#100367
TV Bangumi (B) โœ“ https://www.bilibili.com/bangumi/play/ss5796
Bangumi Episode (B1) https://www.bilibili.com/bangumi/play/ep100611
Bangumi Episode (B2) https://www.bilibili.com/bangumi/play/ss21769#173345
TV Bangumi (C) โœ“ https://www.bilibili.com/bangumi/media/md8892/
URL Redirect https://acg.tv/av106

Installation

Install via NPM:

npm install -g bilibili-get

bilibili-get uses aria2 and ffmpeg for downloading and video segment merging. They can be easily installed with a package manager.

For Homebrew users:

brew install ffmpeg aria2

For Linux/Windows users, make sure to have aria2 > 1.23.0 installed.

Usage

bilibili-get https://www.bilibili.com/video/av18182135

bilibili-get exposes similar interface with youtube-dl.

Usage: bilibili-get [options] <url>


Options:

  -o, --output [pattern]              set output pattern (default: av%(aid)s %(title)s%(#index&&"\(")s%(index)s%(#index&&"\)")s%(#index_title&&" ")s%(index_title)s.%(ext)s)
  -f, --output-format [format]        set merged output format [flv/mkv/mp4]
  -q, --quality [value]               set video quality (default: 0)
  -l, --list-formats                  list available format/quality for video(s)
  -x, --http-proxy [server]           set HTTP proxy for metadata extractor
  -C, --cookie [cookieString]         set cookie string
  -O, --download-options [key=value]  set extra aria2c command-line options (default: )
  -d, --dry-run                       run the program without any download
  -s, --silent                        suppress video quality output
  -V, --version                       output the version number
  -h, --help                          output usage information

The -o flag accepts an output template string in python string formatting method. Besides typical string formatting options, bilibili-get supports JavaScript expressions replacement expressed by syntax like %(#1+1)d.

And some of the variables are:

  • aid - the XXXXXX in avXXXXXX
  • cid - media resource id
  • ext - extension name of the output file (can be set by -f option)
  • title - title of video or bangumi
  • index - part# of a part in video or episode# of an episode in bangumi
  • index_title - a part name or bangumi episode title
  • episode_id - id of a bangumi episode
  • bangumi_id - id of a bangumi
  • quality - quality id of resolved video
  • format - format name corresponding to the video quality

Examples

List video quality/format

bilibili-get https://www.bilibili.com/video/av18182135 -l

Quality

bilibili-get https://www.bilibili.com/video/av18182135 -q 64  # 720P
bilibili-get https://www.bilibili.com/video/av18182135 -q 80  # 1080P
bilibili-get https://www.bilibili.com/video/av18182135 -q 112 # 1080P 4Kbps

Merge parts to MKV file

bilibili-get https://www.bilibili.com/video/av18182135 -f mkv

Bangumi

bilibili-get -o 'av%(aid)s - %(title)s/%(index)s%(#index_title&&" - ")s%(index_title)s.%(ext)s' -f mkv https://www.bilibili.com/bangumi/play/ss1512

Cookie of premium account

bilibili-get -C 'DedeUserID=XXXXXX; DedeUserID__ckMd5=b199851b45c91f32; sid=XXXXXXXX; SESSDATA=cf33becc%2C1241112410%2A332c1323;' -q 112 -f mkv https://www.bilibili.com/bangumi/play/ss1512

Multiple connection download

bilibili-get https://www.bilibili.com/video/av18182135 -O split=5 -O max-connection-per-server=5

Download speed limit

bilibili-get https://www.bilibili.com/video/av18182135 -O max-download-limit=300K

License

(The MIT License)

More Repositories

1

tttfi

Middleware for IFTTT.
JavaScript
348
star
2

moshi-jsonapi

JSON API v1.0 Specification in Moshi.
Java
156
star
3

jekyll-theme-kagami

Simple and clean Jekyll theme compatible with GitHub Pages.
SCSS
150
star
4

toast-compat

Toast notification polyfill.
Java
56
star
5

52g

Index leaked password data with bloom filter.
C++
50
star
6

cpktools

cpk file tools and text extraction tools for translation works on ๅ‚ใ‚ใŒใ‚Šใƒใƒชใ‚ฑใƒผใƒณ
Python
49
star
7

onscripter

Mirror of onscripter by ogapee
C++
32
star
8

feedo

RSS reader for automation.
Python
18
star
9

flvcopycat

Joining flv files with same options (normally splitted by video sites) together losslessly
Python
18
star
10

bilibili-playurl

Get playurl from cid.
JavaScript
16
star
11

co-router

Benefit from generator on express router.
JavaScript
11
star
12

o3o_bot

Kaomoji on Telegram Bot API
Go
11
star
13

ping-chart

Ping statistics in ASCII chart.
Shell
10
star
14

openwrt-dirtydns

Simple DNS forwarder for OpenWRT.
Shell
8
star
15

ONScripter-SAO

Android Based UI Product take SAO(Animation) as prototype
C
6
star
16

XGIMI-Z6-Polar-Toybox

Customize XGIMI Z6 Polar (synsepalum_R) device.
Shell
5
star
17

abt

BitTorrent workflow with aria2.
Python
5
star
18

fontconfig

fontconfig configuration
5
star
19

vimrc

My $HOME/.vim with Git & Pathogen
Vim Script
5
star
20

mm.io

Simple demonstration of MVP with Dagger2/Android Data Binding Library and RxJava
Java
4
star
21

OreoTintRemover

Remove annoying color tint from lock-screen and notification background.
Java
4
star
22

DidiTech2016

Solution to DidiTech2016 problem using Random Forest.
Python
4
star
23

Courier-Typewritter-Fonts

Monospace font based on Courier 10 Pitch by thynson
4
star
24

dagger2-android-example

IoC on Android done right with Dagger2.
Java
4
star
25

squel-sugar

Several syntactic sugar extension to https://hiddentao.github.io/squel/ API
JavaScript
3
star
26

kisstudou

Project to download and auto convert web video from tudou,youku,bilibili
Python
3
star
27

onscripter-cn

onscripter for android forked from natdon-san
C
2
star
28

docker-wine-py

Python 2.7 for Windows in Docker.
1
star
29

iona

Lightweight library for creating interactive docs.
JavaScript
1
star
30

haskell-trains

Solutions to Haskell problems on Codewars.
Haskell
1
star
31

grunt-boilerplate

Boilerplate for grunt based frontend(f2e) workflow
JavaScript
1
star
32

onscripter_android

C
1
star
33

octrello

Integrate Trello with GitHub.
JavaScript
1
star
34

mxnet-onbuild

Automated MXNet build.
Shell
1
star