PT站点自动签到工具 - 优化版本,支持多线程和彩色日志
Project description
PT站点自动签到工具 v0.3.0
用于自动签到PT站点,从项目madwind/flexget_qbittorrent_mod迁移而来,移除了FlexGet框架依赖和qBittorrent相关功能,专注于自动签到功能。
🎉 v0.3.0 新特性
- 🎨 彩色日志支持 - INFO绿色、WARN黄色、ERROR红色,日志更清晰
- 🚀 多线程签到 - 支持并发执行,提升签到效率
- 📊 详细签到状态 - 区分签到成功/OCR验证码签到成功/模拟登录成功
- 🎯 优化用户界面 - 统一命令输出格式,使用emoji图标
- 🔧 代码质量提升 - 规范化代码格式,提升可维护性
功能特性
- ✅ 支持100+个PT站点自动签到
- ✅ Cookie自动备份和管理
- ✅ 彩色日志记录和详细错误处理
- ✅ 支持验证码识别(百度OCR)
- ✅ 多线程并发签到,提升效率
- ✅ 智能签到状态分类和追踪
- ✅ 命令行界面,易于使用
- ✅ 标准Python包结构,支持pip安装
安装说明
环境要求
- Python 3.8+
方式一:本地安装
# 克隆项目
git clone https://github.com/your-username/pt-checkin.git
cd pt-checkin
# 安装
pip install .
方式二:PyPI安装(未来支持)
# 从PyPI安装(计划中)
pip install pt-checkin
# 验证安装
pt-checkin --help
配置文件
复制配置示例文件并编辑:
cp config_example.yml config.yml
编辑 config.yml,配置你的站点信息。配置示例文件包含了详细的说明和常见站点模板。
配置说明
基础配置
# 基础设置
max_workers: 1 # 最大并发线程数
user_agent: 'Mozilla/5.0...' # 浏览器标识
get_messages: true # 是否获取站内消息
get_details: true # 是否获取用户详情
cookie_backup: true # 是否备份
站点配置
支持两种配置方式:
简单配置(仅Cookie)
sites:
chdbits: 'your_cookie_string_here'
hdchina: 'your_cookie_string_here'
详细配置
sites:
dmhy:
cookie: 'your_cookie_string_here'
username: 'your_username'
comment: 'daily_sign_in_comment'
skyey2:
login:
username: 'your_username'
password: 'your_password'
百度OCR配置(可选)
用于验证码识别:
baidu_ocr_app_id: 'your_app_id'
baidu_ocr_api_key: 'your_api_key'
baidu_ocr_secret_key: 'your_secret_key'
使用方法
命令行使用(推荐,开发模式安装后可用)
核心命令
# 执行签到任务(主要命令)
pt-checkin run
# 仅签到指定站点
pt-checkin run -s sjtu
# 强制重新签到
pt-checkin run --force
# 模拟运行(不实际执行)
pt-checkin run --dry-run
测试命令
# 测试配置文件
pt-checkin test
# 测试单个站点
pt-checkin test-site sjtu
# 启用调试模式测试
pt-checkin test-site sjtu --debug
状态管理
# 查看今日签到状态
pt-checkin status
# 显示失败次数统计
pt-checkin status --show-failed
# 清除今日所有签到状态
pt-checkin status --clear
# 清除指定站点状态
pt-checkin status --clear-site sjtu
调试功能
# 显示所有站点概览
pt-checkin debug
# 调试指定站点
pt-checkin debug -s sjtu
# 显示完整配置信息
pt-checkin debug --show-config
# 启用详细日志模式(彩色输出)
pt-checkin -v run
通知功能
# 获取签到结果通知
pt-checkin get-notification
# 仅显示标题
pt-checkin get-notification --title-only
# JSON格式输出
pt-checkin get-notification --format json
🎨 新版本特性说明
彩色日志
- INFO级别:绿色显示,记录正常操作
- WARN级别:黄色显示,记录警告信息
- ERROR级别:红色显示,记录错误信息
多线程签到
通过配置文件设置并发数:
max_workers: 3 # 同时签到的站点数量,默认为1
详细签到状态
- 签到成功:普通签到方式
- OCR验证码签到成功:需要验证码识别的站点
- 模拟登录成功:需要模拟浏览器的站点
全局选项
# 使用自定义配置文件
pt-checkin -c my_config.yml run
# 详细日志输出
pt-checkin -v run
通知消息获取
# 获取签到结果通知消息(简单模式)
pt-checkin get-notification
# 获取详细通知消息(包含详细信息)
pt-checkin get-notification --detailed
# 获取JSON格式通知
pt-checkin get-notification --format json
# 仅获取标题
pt-checkin get-notification --title-only
青龙面板使用(定时执行)
青龙面板安装配置
1. 订阅导入:使用青龙面板的订阅功能导入脚本
ql repo https://github.com/wuyaos/pt_checkin.git "ck_" "" "config_example.yml" "ql" "py"
2. 配置文件设置:
- 将
config_example.yml复制为config.yml - 根据实际情况修改
config.yml中的站点配置信息
3. 依赖安装:
- 在青龙面板 → 依赖管理 → Python3 中添加依赖:
pt-checkin - 确保环境中已安装pt-checkin包
项目结构
pt-checkin/
├── src/pt_checkin/ # 主包目录
│ ├── __init__.py # 包初始化
│ ├── cli.py # 命令行界面
│ ├── core/ # 核心模块
│ │ ├── __init__.py
│ │ ├── config_manager.py # 配置管理
│ │ ├── scheduler.py # 任务调度
│ │ ├── executor.py # 执行器
│ │ ├── entry.py # 签到条目
│ │ └── signin_status.py # 状态管理
│ ├── base/ # 基础功能
│ │ ├── __init__.py
│ │ ├── sign_in.py # 签到基类
│ │ ├── request.py # 网络请求
│ │ ├── work.py # 工作流
│ │ ├── message.py # 消息基类
│ │ └── detail.py # 详情基类
│ ├── sites/ # 站点实现(100+个站点)
│ │ ├── __init__.py
│ │ ├── sjtu.py # 上海交大PT站
│ │ ├── dmhy.py # 动漫花园
│ │ ├── byr.py # 北邮人PT
│ │ └── ... # 更多站点
│ ├── schema/ # 站点架构
│ │ ├── __init__.py
│ │ ├── nexusphp.py # NexusPHP架构
│ │ ├── gazelle.py # Gazelle架构
│ │ ├── private_torrent.py # 私有种子基类
│ │ └── ... # 更多架构
│ └── utils/ # 工具类
│ ├── __init__.py
│ ├── net_utils.py # 网络工具
│ ├── baidu_ocr.py # 百度OCR
│ └── ... # 更多工具
├── qinglong/ # 青龙面板专用目录
│ ├── ck_ptsites.py # 青龙面板签到脚本
│ ├── notify.py # 简化通知模块
│ ├── config.yml # 青龙面板配置
│ └── README.md # 青龙面板使用说明
├── config_example.yml # 配置示例
├── pyproject.toml # 项目配置
├── LICENSE # 许可证
└── README.md # 说明文档
更新日志
目前对需要ocr 验证码签到的暂未适配(除了opencd)
v0.1.0 (青龙面板优化版)
- 🎉 加入青龙面板支持
- ✨ 添加
get-notification命令支持简单/详细模式 - ✨ 添加消息详细程度控制功能
- 📚 完善青龙面板使用文档和示例
v0.0.1
- 🎉 重构为标准Python包结构
- ✨ 添加pip安装支持
- ✨ 添加全局命令行工具
pt-checkin - ✨ 添加更多命令行选项和状态管理
- 📚 更新文档和使用说明
许可证
本项目继承原FlexGet插件的许可证。
致谢
- 感谢madwind/flexget_qbittorrent_mod项目的作者
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
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 pt_checkin-0.3.0.tar.gz.
File metadata
- Download URL: pt_checkin-0.3.0.tar.gz
- Upload date:
- Size: 86.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
350a77ce5d10056241a6b232f6e480c4da03773f3c0eda8cc2adcb1edf0d0a73
|
|
| MD5 |
507b469a615b5d2e31ee189fa850e6a2
|
|
| BLAKE2b-256 |
e1e3e411fb5bea100db537f7a636f8841ea71bb9aedf0b0bee161b3ad43f3944
|
Provenance
The following attestation bundles were made for pt_checkin-0.3.0.tar.gz:
Publisher:
build-release.yml on wuyaos/pt_checkin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pt_checkin-0.3.0.tar.gz -
Subject digest:
350a77ce5d10056241a6b232f6e480c4da03773f3c0eda8cc2adcb1edf0d0a73 - Sigstore transparency entry: 394791527
- Sigstore integration time:
-
Permalink:
wuyaos/pt_checkin@64827451b8b8d7153ba734ebe6bdba7d87376229 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/wuyaos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-release.yml@64827451b8b8d7153ba734ebe6bdba7d87376229 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pt_checkin-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pt_checkin-0.3.0-py3-none-any.whl
- Upload date:
- Size: 157.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1e9c74dfdf49d71a69f4c086162a35c119cbb1be5c8e89c69b2db3e21959a8d
|
|
| MD5 |
3e461d8cd39bd0587259ffd8a05b89bd
|
|
| BLAKE2b-256 |
0dd5c0d0d6120a87cc937df2fe2c8feb41da332dff25b0336c6634d627710906
|
Provenance
The following attestation bundles were made for pt_checkin-0.3.0-py3-none-any.whl:
Publisher:
build-release.yml on wuyaos/pt_checkin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pt_checkin-0.3.0-py3-none-any.whl -
Subject digest:
d1e9c74dfdf49d71a69f4c086162a35c119cbb1be5c8e89c69b2db3e21959a8d - Sigstore transparency entry: 394791555
- Sigstore integration time:
-
Permalink:
wuyaos/pt_checkin@64827451b8b8d7153ba734ebe6bdba7d87376229 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/wuyaos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-release.yml@64827451b8b8d7153ba734ebe6bdba7d87376229 -
Trigger Event:
workflow_dispatch
-
Statement type: