Homepage

GitHub PyPI Documentation Version Issues Coverage License

bgetlib is a bilibili API library.

This is not an official library. Abuse of this library may cause your bilibili account banned.

This repository is not bget.

bget is a command line bilibili video downloader tool developed by the same developer of this library, and it uses bgetlib as its core. If you want an out-of-the-box tool or don’t know how to code, please see the bget project: https://github.com/baobao1270/bget

Please note that version 2.x has all API names changed.

Install

pip install bgetlib

Usage

import bgetlib

bapi = bgetlib.BilibiliAPI()
bapi.login("cookies.txt")
downloader = bgetlib.Downloader()
fav_videos = bapi.get_favorites_all(976082846) # The Luo Tianyi's 2021 new songs collection ID

for fav_video in fav_videos:
    video = bapi.get_video(fav_video.avid)
    for part in video.parts:
        fd = downloader.download(video.avid, part.cid, "tmp/")
        transcoder = bgetlib.Transcoder("tmp/", fd)
        transcoder.save_dash("downloads/av{}.mp4".format(video.avid))

API Reference

See: API Reference

Coverage Report

See: Coverage

Change Log

See: CHANGELOG

License

This project is under the MIT License. See: LICENSE