基于Docker版本的迅雷API客户端,可作为NAStool的下载器插件使用
Project description
pyxunlei
基于Docker版本的Xunlei API Client,可作为 NAStool 的下载器插件使用。
支持版本
python@3.10 迅雷Docker@3.21.0
创建虚拟环境并安装依赖
poetry shell
poetry install
使用方法
from pyxunlei import XunleiClient
# 初始化时支持以下参数:
# host (str): 域名或IP
# port (int): 端口号
# ssl (bool): 是否启动HTTPS
# device_name (str): 设备名称,当同一个账号下绑定了多个远程迅雷,可指定设备名称,设备名称可在迅雷APP查看
# 例如:群晖-xunlei
# device_name为空时使用第一个设备.
# download_root_dir(str): 下载根目录的目录名称,可以在web页面上查看,如不填写则默认选择第一个(一般是迅雷下载)
xunlei_client = XunLeiClient(
'192.168.1.21', 2345, device_name="群晖-xunlei-")
# 获取已完成任务列表
completed_tasks = xunlei_client.completed_tasks()
# 获取未完成任务列表
uncompleted_tasks = xunlei_client.uncompleted_tasks()
# 提交磁力链接
magnetic_link = "磁力链接"
sub_dir = "子目录" # 为空时则不创建子目录
preprocess_file = xunlei_client.filter_file_by_size # 指定预处理文件函数,可使用内置的filter_file_by_size过滤掉小于500M以及大于40G的文件
xunlei_client.download_magnetic(magnetic_link, sub_dir, preprocess_file)
# 提交种子链接
torrent_file_path = "your.torrent" # 种子文件路径
xunlei_client.download_torrent(torrent_file_path, sub_dir, preprocess_file)
# 任务管理
task_id = "任务ID" # 创建任务时会返回task_id
# 暂停任务
xunlei_client.pause_task(task_id)
# 开始/继续任务
xunlei_client.start_task(task_id)
# 删除任务
xunlei_client.delete_task(task_id)
注意事项
- 需要先安装并运行 Docker版迅雷
- 默认使用admin/admin作为登录凭证,如有修改请更新代码中的认证信息
- 可以拿来作为集成到NAStool下载器插件使用
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
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 pyxunlei_for_nastool-0.1.0.tar.gz.
File metadata
- Download URL: pyxunlei_for_nastool-0.1.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.10.16 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8801d9d46dddf2c9cece3ea524f84e6b63b409d85d2cf154cf06444791844c35
|
|
| MD5 |
2d37a1e6df77ed752bb373fbf7d625a9
|
|
| BLAKE2b-256 |
7f80e048c8a8f2d25fcb97206342c7dfea830237f1b6d9e2bb3d6588547dbdf5
|
File details
Details for the file pyxunlei_for_nastool-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyxunlei_for_nastool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.10.16 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3658885b0c949a79bbdb90003ea16c887109b32557d279a8b330bb7729f78211
|
|
| MD5 |
9d24bc34221b6240c7ea05fe8cf9a8a9
|
|
| BLAKE2b-256 |
16bde9bc301c89424a14bbc6e779d58b54b4a1af2cc5263e9a196aaa054eaa99
|