From 14716540e5bf1561fac82a61dccdca26eaff6e2a Mon Sep 17 00:00:00 2001 From: John Howe <89397553+timerring@users.noreply.github.com> Date: Wed, 15 Jan 2025 10:44:47 +0800 Subject: [PATCH] build: build version v0.1.1 --- README-en.md | 90 +++++++++++++++++++++++++++++++++++++----------- README.md | 52 +++++++++++++++++++++++++--- bilitool/cli.py | 10 +++--- pyproject.toml | 2 +- requirements.txt | 3 +- 5 files changed, 126 insertions(+), 31 deletions(-) diff --git a/README-en.md b/README-en.md index 5e497ba..977ba5c 100644 --- a/README-en.md +++ b/README-en.md @@ -2,9 +2,9 @@ [简体中文](./README.md) | English -> Welcome to use, feel free to provide feedback, and contribute to this project via PR. Please do not use it for any purpose that violates the community rules. +> Welcome to use, provide feedback, and contribute to this project via PR. Please do not use it for purposes that violate community guidelines. -`bilitool` is a Python toolkit for logging in, downloading videos, uploading videos to Bilibili, and more. It can be operated via command-line CLI or used as a library in other projects. +`bilitool` is a Python toolkit that provides functionalities such as persistent login, video download, and video upload to Bilibili. It can be operated via command-line interface (CLI) or used as a library in other projects. ## Features @@ -13,19 +13,26 @@ - `logout` Log out - `check` Check login status - `upload` Upload videos - - Supports various custom parameters for uploading - - Supports YAML configuration and parsing for video uploads + - Supports various custom parameters for upload + - Supports video upload via YAML configuration and parsing + - Displays upload progress bar - `download` Download videos + - Supports downloading by `bvid` and `avid` - Supports downloading danmaku (comments) - Supports downloading in various qualities - Supports downloading multi-part videos + - Displays download progress bar - `ip` Display request IP address - - Supports querying specified IP addresses -- `list` Query the status of past video submissions + - Supports querying specified IP address +- `list` Query the status of past uploaded videos of the account + - Supports querying videos with various statuses - If a video fails review, the reason will be displayed -- Display published video information (planned support) -- Display upload progress (in development) -- Append videos to existing videos (in development) +- `convert` Convert video IDs + - Supports conversion between `bvid` and `avid` +- `show` Display detailed video information + - Supports viewing basic video information and interaction status data +- Add more detailed log logs (planned support) +- Append videos to existing videos (planned support) ## Usage @@ -44,10 +51,10 @@ Help information: ``` usage: bilitool [-h] [-V] {login,logout,upload,check,download,list,ip} ... -The Python toolkit package and cli designed for interaction with Bilibili +The Python toolkit package and CLI designed for interaction with Bilibili positional arguments: - {login,logout,upload,check,download,list,ip} + {login,logout,upload,check,download,list,show,convert,ip} Subcommands login Login and save the cookie logout Logout the current account @@ -55,7 +62,9 @@ positional arguments: check Check if the user is logged in download Download the video list Get the uploaded video list - ip Get the ip info + show Show the video detailed info + convert Convert between avid and bvid + ip Get the IP info options: -h, --help show this help message and exit @@ -100,7 +109,7 @@ bilitool logout ### Upload -> Note: The upload function requires login first. After logging in, the login status will be remembered, so you don't need to log in again for the next upload. +> Note: The upload function requires login first. After logging in, the login status will be remembered, and you won't need to log in again for the next upload. `bilitool upload -h` prints help information: @@ -144,7 +153,7 @@ bilitool upload /path/to/your/video.mp4 -y /path/to/your/upload/template.yaml ### Download -> Note: To download videos in high quality or above, you need to log in first to obtain the download. +> Note: To download videos in high definition or above, you need to log in first to obtain the download. `bilitool download -h` prints help information: @@ -166,11 +175,11 @@ options: Example: ```bash -# Download the video with bvid, download danmaku, set quality to 1080p HD, chunk size to 1024, and download all videos if there are multiple parts +# Download the video with the bvid, download danmaku, set quality to 1080p HD, chunk size to 1024, and download all videos if there are multiple parts bilitool download bvid --danmaku --quality 80 --chunksize 1024 --multiple ``` -### Query Recent Video Submission Status +### Query Recent Video Upload Status `bilitool list -h` prints help information: @@ -186,12 +195,54 @@ options: Example: ```bash -# By default, display the recent 20 video submissions +# By default, display information of the 20 most recent uploaded videos bilitool list -# Query the recent 10 video submissions that failed review +# Query the 10 most recent videos that failed review bilitool list --size 10 --status not_pubed ``` +### Query Detailed Video Information + +`bilitool show -h` prints help information: + +``` +usage: bilitool show [-h] bvid + +positional arguments: + vid The avid or bvid of the video + +options: + -h, --help show this help message and exit +``` + +Example: + +```bash +# Query detailed video information +bilitool show +``` + +### Convert Video ID + +`bilitool convert -h` prints help information: + +``` +usage: bilitool convert [-h] vid + +positional arguments: + vid The avid or bvid of the video + +options: + -h, --help show this help message and exit +``` + +Example: + +```bash +# Convert video ID: input bvid to output avid, input avid to output bvid +bilitool convert +``` + ### Query IP Address `bilitool ip -h` prints help information: @@ -214,5 +265,4 @@ bilitool ip --ip 8.8.8.8 ## Acknowledgments -- Thanks to [bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect) for providing the API collection. -- Thanks to [biliup-rs](https://github.com/biliup/biliup-rs) for providing direction. \ No newline at end of file +- Thanks to [bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect) for providing the API collection. \ No newline at end of file diff --git a/README.md b/README.md index 57a77f1..6db0c30 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,9 @@ - 若视频审核未通过,同时会显示原因 - `convert` 查询转换视频编号 - 支持 `bvid` 和 `avid` 两种编号互转 -- 显示已发布的视频信息(预计支持) -- 添加更详细的 log 信息(预计支持) +- `show` 显示视频详细信息 + - 支持查看视频基本信息以及互动状态数据 +- 添加更详细的 log 日志(预计支持) - 追加视频到已有的视频(预计支持) ## 使用方法 @@ -53,7 +54,7 @@ usage: bilitool [-h] [-V] {login,logout,upload,check,download,list,ip} ... The Python toolkit package and cli designed for interaction with Bilibili positional arguments: - {login,logout,upload,check,download,list,ip} + {login,logout,upload,check,download,list,show,convert,ip} Subcommands login Login and save the cookie logout Logout the current account @@ -61,6 +62,8 @@ positional arguments: check Check if the user is logged in download Download the video list Get the uploaded video list + show Show the video detailed info + convert Convert between avid and bvid ip Get the ip info options: @@ -198,6 +201,48 @@ bilitool list bilitool list --size 10 --status not_pubed ``` +### 查询视频详细信息 + +`bilitool show -h ` 打印帮助信息: + +```bash +usage: bilitool show [-h] bvid + +positional arguments: + vid The avid or bvid of the video + +options: + -h, --help show this help message and exit +``` + +示例: + +```bash +# 查询视频详细信息 +bilitool show +``` + +### 查询转换视频编号 + +`bilitool convert -h ` 打印帮助信息: + +```bash +usage: bilitool convert [-h] vid + +positional arguments: + vid The avid or bvid of the video + +options: + -h, --help show this help message and exit +``` + +示例: + +```bash +# 转换视频编号:输入 bvid 输出 avid,输入 avid 输出 bvid +bilitool convert +``` + ### 查询 IP 地址 `bilitool ip -h ` 打印帮助信息: @@ -221,4 +266,3 @@ bilitool ip --ip 8.8.8.8 ## Acknowledgments - 感谢 [bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect) 提供的 API 集合。 -- 感谢 [biliup-rs](https://github.com/biliup/biliup-rs) 提供的方向。 diff --git a/bilitool/cli.py b/bilitool/cli.py index 7599b76..25568eb 100644 --- a/bilitool/cli.py +++ b/bilitool/cli.py @@ -23,7 +23,7 @@ def cli(): level=logging.INFO ) parser = argparse.ArgumentParser(description='The Python toolkit package and cli designed for interaction with Bilibili') - parser.add_argument('-V', '--version', action='version', version='bilitool 0.1.0', help='Print version information') + parser.add_argument('-V', '--version', action='version', version='bilitool 0.1.1', help='Print version information') subparsers = parser.add_subparsers(dest='subcommand', help='Subcommands') @@ -65,14 +65,14 @@ def cli(): list_parser.add_argument('--size', type=int, default=20, help='(default is 20) the size of video list') list_parser.add_argument('--status', default='pubed,not_pubed,is_pubing', help='(default is all) the status of video list: pubed, not_pubed, is_pubing') - # Convert subcommand - convert_parser = subparsers.add_parser('convert', help='Convert between avid and bvid') - convert_parser.add_argument('vid', help='The avid or bvid of the video') - # Show subcommand show_parser = subparsers.add_parser('show', help='Show the video detailed info') show_parser.add_argument('vid', help='The avid or bvid of the video') + # Convert subcommand + convert_parser = subparsers.add_parser('convert', help='Convert between avid and bvid') + convert_parser.add_argument('vid', help='The avid or bvid of the video') + # IP subcommand ip_parser = subparsers.add_parser('ip', help='Get the ip info') ip_parser.add_argument('--ip', default='', help='(default is your request ip) The ip address') diff --git a/pyproject.toml b/pyproject.toml index 5873a21..7242af7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "bilitool" # make sure your module name is unique -version = "0.1.0" +version = "0.1.1" authors = [ { name="timerring"}, ] diff --git a/requirements.txt b/requirements.txt index 0cd7c5c..dbb1d39 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ PyYAML==6.0.2 qrcode==8.0 -Requests==2.32.3 \ No newline at end of file +Requests==2.32.3 +tqdm==4.67.1 \ No newline at end of file