使用DrissionPage模拟浏览器操作缓慢更新,目前只能获取成绩,其余接口缓慢修复
"摘下耳机时眼眶依旧会微红 戴上耳机依旧是你描绘的梦"
📖 介绍
nonebot-plugin-npu,翱翔门户成绩监控插件,能获取成绩、排名、绩点,当出现新成绩时推送给使用者
- 获取成绩、绩点、排名
- 出现新成绩、新考试时推送
- 排名变动时推送
- 宿舍电费监控
- 排考检测
- 课表提取
🔔 安装
瑞数6通过补环境模拟运行js获得cookie,故需要安装nodejs环境(execjs有问题),本人实测node12无法成功,node22.19.0成功
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt-get install -y nodejs # 若使用过apt安装过node12请先卸载 sudo apt remove nodejs libnode72 再安装新版本
法一:nb plugin安装方法[推荐]
安装插件
nb plugin install nonebot-plugin-npu
安装wkhtmltopdf
打开https://wkhtmltopdf.org/downloads.html安装
法二:pip安装
-
1.激活python环境
.\.venv\Scripts\activate (Windows) source \.venv\Scripts\activate (Ubuntu) -
2.安装
pip install nonebot-plugin-npu -
3.安装wkhtmltopdf
打开https://wkhtmltopdf.org/downloads.html安装
打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入
plugins = ["nonebot-plugin-npu"]
📣配置
在.env.prod/.env中写入以下字段,也可不填,默认值如下
# 每60分钟执行一次,执行时在60分钟内随机sleep,错开检测时间,减少服务器压力
npu_check_time: int = 60
npu_if_check_grades: bool = True
npu_begin_check_hour: int = 8
npu_end_check_hour: int = 22
# 每80分钟执行一次,执行时在80分钟内随机sleep,错开检测时间,减少服务器压力
npu_check_money_time: int = 80
npu_if_check_money: bool = False
# 每天12点执行一次,执行时在30分钟内随机sleep
npu_electric_check_time: int = 30
# 在链接上bot时就全部执行一遍,方便测试
npu_if_check_when_connect: bool = False
🎉 使用
指令表
指令列表
| 指令 | 范围 | 说明 | 示例 |
|---|---|---|---|
| /翱翔 | 私聊/艾特 | 登陆翱翔门户 | |
| /翱翔成绩 | 私聊/艾特 | 获取本学期的成绩 | |
| /翱翔排名 | 私聊/艾特 | 获取排名信息 | |
| /翱翔考试 | 私聊/艾特 | 获取未结束的考试信息 | |
| /翱翔课表 | 私聊/艾特 | 获取课表(需要搭配wake up软件使用) | |
| /翱翔本周课表 | 私聊/艾特 | 获取本周课表图片文件 | |
| /翱翔综测排名 | 私聊/艾特 | 获取综测参评中的综测排名 | |
| /翱翔退出登陆(登录) | 私聊/艾特 | 退出登陆 | |
| /翱翔全部成绩 | 私聊/艾特 | 获取全部成绩 | |
| /翱翔全部考试 | 私聊/艾特 | 获取全部考试信息 | |
| /翱翔加权百分制成绩 | 私聊/艾特 | 计算加权百分制成绩 | |
| /翱翔电费绑定 | 私聊/艾特 | 绑定宿舍,当电费小于25时会推送消息,每天中午12点检测一次 | |
| /翱翔电费查询 | 私聊/艾特 | 查询当前电费 | |
| /翱翔电费解绑 | 私聊/艾特 | 解除宿舍绑定 |
🤩致谢
翱翔门户登陆以及数据获取参考了:https://github.com/cheanus/Automation/blob/main/GradesMonitorLinux.py
Metadata
Release files for nonebot-plugin-npu 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nonebot_plugin_npu-3.0.0.tar.gz | 1.7 MB | Without provenance | Details for nonebot_plugin_npu-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nonebot_plugin_npu-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for nonebot_plugin_npu-3.0.0-py3-none-any.whl |
Total release size: 3.3 MB
Release files / nonebot_plugin_npu-3.0.0.tar.gz
| Download URL | nonebot_plugin_npu-3.0.0.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
887f63447a38c45e549a20638aeab8c3dbed2920180196038f65cef8a3939216
|
|
BLAKE2b-256 checksum How to use checksums |
d43db38496f133111160e1552162a0c3978add5355fc28e73ca79a9e0316eeca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / nonebot_plugin_npu-3.0.0-py3-none-any.whl
| Download URL | nonebot_plugin_npu-3.0.0-py3-none-any.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70a80894d6d68af6e5933a5ed0f3b5b59fa6dd07c5f945b5a282b7a33b36b4e1
|
|
BLAKE2b-256 checksum How to use checksums |
245653e2f0816565429383f351e2eaed2937c94bf1394d3478f3cb5110860a31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for nonebot-plugin-npu 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.