Skip to main content

Login and upload videos to bilibili

Project description

biliupload

简体中文 | English

如果您觉得项目不错,欢迎 :star: ,欢迎使用并给我提更多需求以及反馈。欢迎 PR 贡献此项目。

biliupload 是一个 python 的工具库,用于登录,上传,下载视频到 bilibili,可以使用命令行操作,也可以作为其他项目的库使用。

功能

  • 持久记忆存储登录状态
    • 支持导出 cookies.json 用于其他项目
  • 退出登录 logout
  • 检查登录状态 check
  • 上传视频 upload
    • 支持多种自定义参数上传
    • 支持上传视频的 yaml 配置与解析
  • 下载视频 download
    • 支持下载弹幕
    • 支持下载多种画质
    • 支持下载多 p 视频
  • 显示上传进度(正在开发)
  • 追加视频到已有的视频(正在开发)
  • 显示已发布的视频信息(预计支持)

使用方法

安装

推荐 Python 版本 >= 3.10.

pip install biliupload

或者你也可以下载编译好的 cli 工具直接运行 下载地址

帮助信息:

usage: biliupload [-h] [-V] {login,logout,upload,check,download} ...

Python implementation of biliup

positional arguments:
  {login,logout,upload,check,download}
                        Subcommands
    login               Login and save the cookie
    logout              Logout the current account
    upload              Upload the video
    check               Check if the user is logged in
    download            Download the video

options:
  -h, --help            show this help message and exit
  -V, --version         Print version information

登录

biliupload login

然后你可以扫描二维码或点击链接登录,如果输入命令时加上 --export 参数,则会导出 cookie.json 文件到当前目录(cookie.json 文件可以用于其他项目)。

biliupload login -h 打印帮助信息:

usage: biliupload login [-h] [--export]

options:
  -h, --help  show this help message and exit
  --export    (default is false) export the login cookie file

检查登录状态

检查当前登录的账号名称

biliupload check

退出登录

退出登录后,同时会使 cookies.json 文件失效(如果登录时使用了 --export 参数导出了 cookies)。

biliupload logout

上传

注意:上传功能需要先登录,登录后会记忆登录状态,下次上传时不需要再次登录。

biliupload upload -h 打印帮助信息:

usage: biliupload upload [-h] [-y YAML] [--copyright COPYRIGHT] [--title TITLE] [--desc DESC] [--tid TID] [--tag TAG] [--line LINE] [--source SOURCE] [--cover COVER]
                         [--dynamic DYNAMIC]
                         video_path

positional arguments:
  video_path            (required) the path to video file

options:
  -h, --help            show this help message and exit
  -y YAML, --yaml YAML  The path to yaml file(if yaml file is provided, the arguments below will be ignored)
  --copyright COPYRIGHT
                        (default is 2) 1 for original, 2 for reprint
  --title TITLE         (default is video name) The title of video
  --desc DESC           (default is empty) The description of video
  --tid TID             (default is 138) For more info to the type id, refer to https://biliup.github.io/tid-ref.html
  --tag TAG             (default is biliupload) video tags, separated by comma
  --line LINE           (default is bda2) line refer to https://biliup.github.io/upload-systems-analysis.html
  --source SOURCE       (default is 来源于网络) The source of video (if your video is re-print)
  --cover COVER         (default is empty) The cover of video (if you want to customize, set it as the path to your cover image)
  --dynamic DYNAMIC     (default is empty) The dynamic information

示例:

你可以参考 template/example-config.yaml 了解更多的 yaml 模板。

# 视频路径是必需的
biliupload upload /path/to/your/video.mp4

# 使用命令行参数上传视频
biliupload upload /path/to/your/video.mp4 --title "test" --desc "test" --tid 138 --tag "test" --line bda2

# 使用 yaml 配置上传视频
biliupload upload /path/to/your/video.mp4 -y /path/to/your/upload/template.yaml

下载

注意:如果要下载高清以上画质的视频,需要先登录才能获取下载。

biliupload download -h 打印帮助信息:

usage: biliupload download [-h] [--danmaku] [--quality QUALITY] [--chunksize CHUNKSIZE] [--multiple] bvid

positional arguments:
  bvid                  (required) the bvid of video

options:
  -h, --help            show this help message and exit
  --danmaku             (default is false) download the danmaku of video
  --quality QUALITY     (default is 64) the resolution of video
  --chunksize CHUNKSIZE
                        (default is 1024) the chunk size of video
  --multiple            (default is false) download the multiple videos if have set

示例:

# 下载序号为 bvid 的视频,并下载弹幕,设置画质为 1080p 高清,分段大小为 1024,如果有多 p,则一次性下载所有视频
biliupload download bvid --danmaku --quality 80 --chunksize 1024 --multiple

Acknowledgments

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

biliupload-0.0.4.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

biliupload-0.0.4-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file biliupload-0.0.4.tar.gz.

File metadata

  • Download URL: biliupload-0.0.4.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for biliupload-0.0.4.tar.gz
Algorithm Hash digest
SHA256 28d24e33c3bea45d4e49acfd0a09e89b8f8a0e0773fcaa4fd21d3a309393bb7f
MD5 8e03761545f31a504fe2a3e8c24a641a
BLAKE2b-256 c1c7efa4953dc5a3c25ec27f67af786064a2aba686d7e07c7c5544b5b6bdb98c

See more details on using hashes here.

File details

Details for the file biliupload-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: biliupload-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for biliupload-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9885026e4458e43d89fa91c7d89edda07561ec5da482ee235d384fa911b8a03e
MD5 da09ecea8e752ada0523144ed642a8cc
BLAKE2b-256 f57f2e88419781426211e2382155f3f7a2bae3ccb3d5af95ca98bca3380ee479

See more details on using hashes here.

Supported by

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