bili-dl 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
bili_dl-1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2025] [WavesMan]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include LICENSE
2
+ include README.md
3
+ include requirements.txt
4
+ include config/*.json
5
+ recursive-include config *.json
bili_dl-1.0.1/PKG-INFO ADDED
@@ -0,0 +1,257 @@
1
+ Metadata-Version: 2.4
2
+ Name: bili-dl
3
+ Version: 1.0.1
4
+ Summary: 一个功能强大的B站视频下载工具,支持最高清晰度下载和自动合并
5
+ Home-page: https://github.com/WavesMan/bili-download
6
+ Author: B站视频下载器
7
+ Author-email:
8
+ License: MIT License
9
+ Project-URL: Homepage, https://github.com/WavesMan/bili-downloader
10
+ Project-URL: BugTracker, https://github.com/WavesMan/bili-downloader/issues
11
+ Project-URL: Source, https://github.com/WavesMan/bili-downloader
12
+ Keywords: bilibili,video,download,b站,视频下载
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Operating System :: OS Independent
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: requests>=2.28.0
26
+ Requires-Dist: qrcode>=7.3.1
27
+ Requires-Dist: Pillow>=9.3.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: black>=22.10.0; extra == "dev"
30
+ Requires-Dist: flake8>=5.0.0; extra == "dev"
31
+ Requires-Dist: mypy>=0.991; extra == "dev"
32
+ Requires-Dist: pytest>=7.2.0; extra == "dev"
33
+ Dynamic: home-page
34
+ Dynamic: license-file
35
+ Dynamic: requires-python
36
+
37
+ # B站视频下载器 (bili-downloader)
38
+
39
+ [![PyPI version](https://img.shields.io/pypi/v/bili-dl.svg)](https://pypi.org/project/bili-dl/)
40
+ [![Python versions](https://img.shields.io/pypi/pyversions/bili-dl.svg)](https://pypi.org/project/bili-dl/)
41
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
42
+
43
+ 一个功能强大的B站视频下载工具,支持最高清晰度下载和自动合并。
44
+
45
+ ## ✨ 功能特性
46
+
47
+ - 🎯 **智能清晰度选择**: 自动获取账号权限内的最高清晰度视频
48
+ - 🔐 **多种登录方式**: 支持二维码登录和Cookie登录
49
+ - 🔍 **Cookie状态检查**: 自动验证Cookie可用性,失效时提示重新登录
50
+ - 📦 **自动合并**: 支持DASH格式视频的自动音视频合并
51
+ - 🚀 **多线程下载**: 支持多线程并发下载,提高下载速度
52
+ - 📁 **智能文件管理**: 按BV号自动组织文件结构
53
+ - 📊 **元数据保存**: 自动保存视频信息和下载元数据
54
+ - ⚡ **断点续传**: 支持下载中断后继续下载
55
+ - 🏗️ **模块化架构**: 清晰的命令分离和职责划分
56
+
57
+ ## 📦 安装
58
+
59
+ ### 通过 pip 安装
60
+
61
+ ```bash
62
+ pip install bili-dl
63
+ ```
64
+
65
+ ### 从源码安装
66
+
67
+ ```bash
68
+ git clone https://github.com/WavesMan/bili-download.git
69
+ cd bili-downloader
70
+ pip install -e .
71
+ ```
72
+
73
+ ## 🚀 快速开始
74
+
75
+ ### 基本使用
76
+
77
+ ```bash
78
+ # 查看帮助信息
79
+ bili-dl --help
80
+
81
+ # 查看特定命令帮助
82
+ bili-dl download --help
83
+ bili-dl login --help
84
+ bili-dl status --help
85
+
86
+ # 下载单个视频(需要先登录)
87
+ bili-dl download BV1A6aRz4EBU
88
+
89
+ # 指定输出目录
90
+ bili-dl download BV1A6aRz4EBU --output ./my_videos
91
+
92
+ # 指定清晰度 (80=1080P, 112=1080P+, 120=4K)
93
+ bili-dl download BV1A6aRz4EBU --quality 112
94
+
95
+ # 禁用自动合并
96
+ bili-dl download BV1A6aRz4EBU --no-merge
97
+
98
+ # 登录B站账号
99
+ bili-dl login
100
+
101
+ # 检查登录状态
102
+ bili-dl status
103
+ ```
104
+
105
+ ### 配置说明
106
+
107
+ 首次运行会自动创建配置文件 `~/.bili-downloader/config.json`,您可以编辑此文件来自定义设置:
108
+
109
+ ```json
110
+ {
111
+ "user": {
112
+ "cookies": {},
113
+ "session_data": {}
114
+ },
115
+ "download": {
116
+ "output_dir": "downloads",
117
+ "timeout": 30,
118
+ "retry_times": 3,
119
+ "chunk_size": 8192
120
+ },
121
+ "ffmpeg": {
122
+ "auto_merge": true,
123
+ "ffmpeg_path": "ffmpeg"
124
+ },
125
+ "debug": {
126
+ "enable_logging": false,
127
+ "log_level": "INFO"
128
+ }
129
+ }
130
+ ```
131
+
132
+ ## 🔧 高级用法
133
+
134
+ ### 作为Python模块使用
135
+
136
+ ```python
137
+ from bili_downloader.commands import handle_download_command, handle_login_command
138
+ from bili_downloader.services.login_manager import login_manager
139
+
140
+ # 初始化配置
141
+ from bili_downloader.config.config_manager import init_config
142
+ init_config()
143
+
144
+ # 登录
145
+ login_manager.init_login()
146
+
147
+ # 下载视频
148
+ success = handle_download_command("BV1A6aRz4EBU", output_dir="./videos")
149
+ if success:
150
+ print("下载成功!")
151
+ ```
152
+
153
+ ### 批量下载
154
+
155
+ ```python
156
+ from bili_downloader.commands import handle_download_command
157
+
158
+ video_list = [
159
+ "BV1A6aRz4EBU",
160
+ "BV1B6bRz5FCV",
161
+ "BV1C7cSx6GDW"
162
+ ]
163
+
164
+ for bvid in video_list:
165
+ handle_download_command(bvid)
166
+ ```
167
+
168
+ ## 📁 文件结构
169
+
170
+ 下载完成后,文件会按以下结构组织:
171
+
172
+ ```
173
+ downloads/
174
+ └── BV1A6aRz4EBU/
175
+ ├── 视频标题_video.m4s # 视频流文件
176
+ ├── 视频标题_audio.m4s # 音频流文件
177
+ ├── 视频标题.mp4 # 最终合并的视频文件
178
+ └── metadata.json # 视频元数据信息
179
+ ```
180
+
181
+ 项目代码结构:
182
+
183
+ ```
184
+ bili-downloader/
185
+ ├── commands/ # 命令处理模块
186
+ │ ├── download_command.py # 下载命令处理
187
+ │ ├── login_command.py # 登录命令处理
188
+ │ └── status_command.py # 状态检查命令
189
+ ├── modules/ # 核心功能模块
190
+ │ ├── login_manager.py # 登录管理
191
+ │ ├── video_info.py # 视频信息获取
192
+ │ ├── stream_downloader.py # 流下载器
193
+ │ └── ffmpeg_integration.py # FFmpeg集成
194
+ ├── services/ # 服务层
195
+ │ └── __init__.py
196
+ ├── utils/ # 工具函数
197
+ │ └── common_utils.py
198
+ ├── config/ # 配置管理
199
+ │ └── config_manager.py
200
+ └── main.py # 主入口点
201
+ ```
202
+
203
+ ## ⚙️ 依赖要求
204
+
205
+ - Python 3.7+
206
+ - requests >= 2.28.0
207
+ - qrcode >= 7.3.1
208
+ - Pillow >= 9.3.0
209
+ - ffmpeg (用于视频合并,可选但推荐)
210
+
211
+ ## 🔍 常见问题
212
+
213
+ ### Q: 如何安装 ffmpeg?
214
+
215
+ **Windows:**
216
+ 1. 下载 ffmpeg: https://ffmpeg.org/download.html
217
+ 2. 解压并添加 bin 目录到系统 PATH
218
+
219
+ **macOS:**
220
+ ```bash
221
+ brew install ffmpeg
222
+ ```
223
+
224
+ **Linux (Ubuntu/Debian):**
225
+ ```bash
226
+ sudo apt install ffmpeg
227
+ ```
228
+
229
+ ### Q: 登录失败怎么办?
230
+
231
+ 使用 login 命令重新登录:
232
+ ```bash
233
+ bili-dl login
234
+ ```
235
+
236
+ ### Q: Cookie失效怎么办?
237
+
238
+ 程序会自动检测Cookie状态,如果失效会在下载时提示重新登录。
239
+
240
+ ### Q: 下载速度慢怎么办?
241
+
242
+ 可以尝试:
243
+ 1. 检查网络连接
244
+ 2. 使用更好的网络环境
245
+ 3. 调整配置中的超时和重试参数
246
+
247
+ ## 📄 许可证
248
+
249
+ 本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情。
250
+
251
+ ## 🤝 贡献
252
+
253
+ 欢迎提交 Issue 和 Pull Request!
254
+
255
+ ## ⚠️ 免责声明
256
+
257
+ 本项目仅用于学习和研究目的,请勿用于商业用途。下载的视频请遵守相关法律法规和B站用户协议。
@@ -0,0 +1,221 @@
1
+ # B站视频下载器 (bili-downloader)
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/bili-dl.svg)](https://pypi.org/project/bili-dl/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/bili-dl.svg)](https://pypi.org/project/bili-dl/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ 一个功能强大的B站视频下载工具,支持最高清晰度下载和自动合并。
8
+
9
+ ## ✨ 功能特性
10
+
11
+ - 🎯 **智能清晰度选择**: 自动获取账号权限内的最高清晰度视频
12
+ - 🔐 **多种登录方式**: 支持二维码登录和Cookie登录
13
+ - 🔍 **Cookie状态检查**: 自动验证Cookie可用性,失效时提示重新登录
14
+ - 📦 **自动合并**: 支持DASH格式视频的自动音视频合并
15
+ - 🚀 **多线程下载**: 支持多线程并发下载,提高下载速度
16
+ - 📁 **智能文件管理**: 按BV号自动组织文件结构
17
+ - 📊 **元数据保存**: 自动保存视频信息和下载元数据
18
+ - ⚡ **断点续传**: 支持下载中断后继续下载
19
+ - 🏗️ **模块化架构**: 清晰的命令分离和职责划分
20
+
21
+ ## 📦 安装
22
+
23
+ ### 通过 pip 安装
24
+
25
+ ```bash
26
+ pip install bili-dl
27
+ ```
28
+
29
+ ### 从源码安装
30
+
31
+ ```bash
32
+ git clone https://github.com/WavesMan/bili-download.git
33
+ cd bili-downloader
34
+ pip install -e .
35
+ ```
36
+
37
+ ## 🚀 快速开始
38
+
39
+ ### 基本使用
40
+
41
+ ```bash
42
+ # 查看帮助信息
43
+ bili-dl --help
44
+
45
+ # 查看特定命令帮助
46
+ bili-dl download --help
47
+ bili-dl login --help
48
+ bili-dl status --help
49
+
50
+ # 下载单个视频(需要先登录)
51
+ bili-dl download BV1A6aRz4EBU
52
+
53
+ # 指定输出目录
54
+ bili-dl download BV1A6aRz4EBU --output ./my_videos
55
+
56
+ # 指定清晰度 (80=1080P, 112=1080P+, 120=4K)
57
+ bili-dl download BV1A6aRz4EBU --quality 112
58
+
59
+ # 禁用自动合并
60
+ bili-dl download BV1A6aRz4EBU --no-merge
61
+
62
+ # 登录B站账号
63
+ bili-dl login
64
+
65
+ # 检查登录状态
66
+ bili-dl status
67
+ ```
68
+
69
+ ### 配置说明
70
+
71
+ 首次运行会自动创建配置文件 `~/.bili-downloader/config.json`,您可以编辑此文件来自定义设置:
72
+
73
+ ```json
74
+ {
75
+ "user": {
76
+ "cookies": {},
77
+ "session_data": {}
78
+ },
79
+ "download": {
80
+ "output_dir": "downloads",
81
+ "timeout": 30,
82
+ "retry_times": 3,
83
+ "chunk_size": 8192
84
+ },
85
+ "ffmpeg": {
86
+ "auto_merge": true,
87
+ "ffmpeg_path": "ffmpeg"
88
+ },
89
+ "debug": {
90
+ "enable_logging": false,
91
+ "log_level": "INFO"
92
+ }
93
+ }
94
+ ```
95
+
96
+ ## 🔧 高级用法
97
+
98
+ ### 作为Python模块使用
99
+
100
+ ```python
101
+ from bili_downloader.commands import handle_download_command, handle_login_command
102
+ from bili_downloader.services.login_manager import login_manager
103
+
104
+ # 初始化配置
105
+ from bili_downloader.config.config_manager import init_config
106
+ init_config()
107
+
108
+ # 登录
109
+ login_manager.init_login()
110
+
111
+ # 下载视频
112
+ success = handle_download_command("BV1A6aRz4EBU", output_dir="./videos")
113
+ if success:
114
+ print("下载成功!")
115
+ ```
116
+
117
+ ### 批量下载
118
+
119
+ ```python
120
+ from bili_downloader.commands import handle_download_command
121
+
122
+ video_list = [
123
+ "BV1A6aRz4EBU",
124
+ "BV1B6bRz5FCV",
125
+ "BV1C7cSx6GDW"
126
+ ]
127
+
128
+ for bvid in video_list:
129
+ handle_download_command(bvid)
130
+ ```
131
+
132
+ ## 📁 文件结构
133
+
134
+ 下载完成后,文件会按以下结构组织:
135
+
136
+ ```
137
+ downloads/
138
+ └── BV1A6aRz4EBU/
139
+ ├── 视频标题_video.m4s # 视频流文件
140
+ ├── 视频标题_audio.m4s # 音频流文件
141
+ ├── 视频标题.mp4 # 最终合并的视频文件
142
+ └── metadata.json # 视频元数据信息
143
+ ```
144
+
145
+ 项目代码结构:
146
+
147
+ ```
148
+ bili-downloader/
149
+ ├── commands/ # 命令处理模块
150
+ │ ├── download_command.py # 下载命令处理
151
+ │ ├── login_command.py # 登录命令处理
152
+ │ └── status_command.py # 状态检查命令
153
+ ├── modules/ # 核心功能模块
154
+ │ ├── login_manager.py # 登录管理
155
+ │ ├── video_info.py # 视频信息获取
156
+ │ ├── stream_downloader.py # 流下载器
157
+ │ └── ffmpeg_integration.py # FFmpeg集成
158
+ ├── services/ # 服务层
159
+ │ └── __init__.py
160
+ ├── utils/ # 工具函数
161
+ │ └── common_utils.py
162
+ ├── config/ # 配置管理
163
+ │ └── config_manager.py
164
+ └── main.py # 主入口点
165
+ ```
166
+
167
+ ## ⚙️ 依赖要求
168
+
169
+ - Python 3.7+
170
+ - requests >= 2.28.0
171
+ - qrcode >= 7.3.1
172
+ - Pillow >= 9.3.0
173
+ - ffmpeg (用于视频合并,可选但推荐)
174
+
175
+ ## 🔍 常见问题
176
+
177
+ ### Q: 如何安装 ffmpeg?
178
+
179
+ **Windows:**
180
+ 1. 下载 ffmpeg: https://ffmpeg.org/download.html
181
+ 2. 解压并添加 bin 目录到系统 PATH
182
+
183
+ **macOS:**
184
+ ```bash
185
+ brew install ffmpeg
186
+ ```
187
+
188
+ **Linux (Ubuntu/Debian):**
189
+ ```bash
190
+ sudo apt install ffmpeg
191
+ ```
192
+
193
+ ### Q: 登录失败怎么办?
194
+
195
+ 使用 login 命令重新登录:
196
+ ```bash
197
+ bili-dl login
198
+ ```
199
+
200
+ ### Q: Cookie失效怎么办?
201
+
202
+ 程序会自动检测Cookie状态,如果失效会在下载时提示重新登录。
203
+
204
+ ### Q: 下载速度慢怎么办?
205
+
206
+ 可以尝试:
207
+ 1. 检查网络连接
208
+ 2. 使用更好的网络环境
209
+ 3. 调整配置中的超时和重试参数
210
+
211
+ ## 📄 许可证
212
+
213
+ 本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情。
214
+
215
+ ## 🤝 贡献
216
+
217
+ 欢迎提交 Issue 和 Pull Request!
218
+
219
+ ## ⚠️ 免责声明
220
+
221
+ 本项目仅用于学习和研究目的,请勿用于商业用途。下载的视频请遵守相关法律法规和B站用户协议。