Multi-threaded downloader with Rich progress bars
Project description
DLB - 多线程下载工具库
基于 Python 开发的高效多线程下载工具,支持进度显示和智能配置
功能特性
- 多线程加速:支持自定义并发线程数 (
-j参数) - 可视化进度:使用 Rich 库实现美观的终端进度条,显示下载速度和剩余时间
- 智能配置:自动保存用户设置到
~/.dlb.json - 多语言支持:自动适配中英文界面
- Cookie 支持:可通过配置或命令行设置请求 Cookies
- 断点续传:支持自动续传未完成的下载任务
- 下载重试:支持失败自动重试,采用指数退避策略
- 日志记录:自动记录下载日志到
~/.dlb/logs/dlb.log
安装方式
通过 PyPI 安装 (推荐)
pip install beiane-dlb
从 Gitee 仓库安装
pip install git+https://gitee.com/byusistudio/dlb.git
开发版安装
git clone https://gitee.com/byusistudio/dlb.git
cd dlb
pip install -e .
快速开始
基础下载
dlb https://example.com/file1.zip https://example.com/file2.zip
高级用法
# 指定输出目录和线程数
dlb -o ./downloads -j 8 https://example.com/large-file.iso
# 设置 Cookie 并保存配置
dlb --cookie "session=abc123" --set-config -j 4
# 批量下载视频文件
dlb $(seq -f "https://video-site.com/video_%03d.mp4" 1 100)
配置文件
默认配置文件路径:~/.dlb.json
{
"language": "auto",
"max_workers": 5,
"max_downloads": 10,
"cookies": "",
"placeholder": false,
"timeout": 30,
"chunk_size": 1048576,
"retries": 3
}
配置项说明:
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| language | string | auto | 界面语言,可选值:auto、zh_CN、en_US |
| max_workers | int | 5 | 最大并发线程数 |
| max_downloads | int | 10 | 最大同时下载数量 |
| cookies | string | "" | HTTP 请求 Cookie |
| placeholder | bool | false | 是否创建占位文件 |
| timeout | int | 30 | 连接超时时间(秒) |
| chunk_size | int | 1048576 | 下载块大小(字节),默认 1MB |
| retries | int | 3 | 失败重试次数 |
构建与发布
环境准备
创建 .env 文件并配置 PyPI token:
PYPI_TOKEN=your_pypi_token_here
Linux / macOS
bash build.sh
Windows
build.bat
项目结构
dlb/
├── dlb/
│ ├── __init__.py # 包初始化
│ ├── cli.py # 命令行接口
│ ├── config.py # 配置管理
│ ├── core.py # 核心下载逻辑
│ ├── i18n.py # 国际化支持
│ ├── logger.py # 日志记录
│ └── locales/ # 翻译文件
│ ├── en_US.json
│ └── zh_CN.json
├── build.sh # Linux/macOS 构建脚本
├── build.bat # Windows 构建脚本
├── .env.example # 环境变量模板
├── pyproject.toml # 项目配置
├── setup.py # 安装配置
└── README.md # 项目说明
版权与协议
Copyright © 2025 北啊呢
本项目采用 MIT 开源协议,您可以自由地:
- 使用、复制、修改本软件
- 进行再分发和商业使用
项目地址
访问 Gitee 仓库获取最新代码:
gitee.com/byusistudio/dlb
贡献指南
欢迎通过以下方式参与贡献:
- 提交 Issue 报告问题
- Fork 仓库后发起 Pull Request
- 完善多语言翻译文件
- 编写测试用例
技术支持
如遇使用问题,请优先查阅:
dlb --help
或提交 Issue 至项目仓库,我们将尽快为您解答。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
beiane_dlb-0.3.0.tar.gz
(9.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file beiane_dlb-0.3.0.tar.gz.
File metadata
- Download URL: beiane_dlb-0.3.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51ac3d19553f5a3cb2b40a2000f2090145e47a0378207f5d816f1597a7ccb455
|
|
| MD5 |
3788cc5a49941245693dce20a938bd15
|
|
| BLAKE2b-256 |
7841c6de70931b7989265489e17fd0e653990e7b0ff8159d20c6a8fc9faeec37
|
File details
Details for the file beiane_dlb-0.3.0-py3-none-any.whl.
File metadata
- Download URL: beiane_dlb-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e52a2553e387c5d16971a18d670318ad81d1be699524344aa835c8dc49002977
|
|
| MD5 |
688d8671db9e129f155dd55a32dbb244
|
|
| BLAKE2b-256 |
81900b076fbde9c19aed655045ffcbac80bff1c38805905fdf5a6d7d513f579b
|