mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-07-22 21:13:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2bd7b15ee | ||
|
|
b4c7a83f57 | ||
|
|
72b07a0f45 | ||
|
|
4accd2df2b | ||
|
|
d1c2c61626 | ||
|
|
6b0971170e | ||
|
|
a6410df3cf | ||
|
|
25811f20a0 | ||
|
|
778d8e5ef1 | ||
|
|
156c31a3f5 | ||
|
|
051a181210 | ||
|
|
e8b9e05a65 | ||
|
|
e298970d3f | ||
|
|
1eaa188374 | ||
|
|
b36d24a4d8 | ||
|
|
3b73d6a2f5 | ||
|
|
f851ac1afe | ||
|
|
b53b698930 | ||
|
|
08d46c6f5c | ||
|
|
80ae3df933 | ||
|
|
ac397c68ec | ||
|
|
423bc24939 | ||
|
|
41b28a133e | ||
|
|
b1ead1329d | ||
|
|
e0e99a07bb | ||
|
|
30d0e8b1bd | ||
|
|
dd234691ea | ||
|
|
c3c8ffba95 | ||
|
|
ec9a11d5c0 | ||
|
|
1458c800b8 | ||
|
|
b5fdb2d247 | ||
|
|
1c8e5915d9 | ||
|
|
e845e3f7ef | ||
|
|
27eae63762 | ||
|
|
634f45a4c4 |
+1
-1
@@ -6,7 +6,7 @@
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 12
|
||||
"ecmaVersion": "latest"
|
||||
},
|
||||
"rules": {
|
||||
}
|
||||
|
||||
@@ -5,14 +5,7 @@ on:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "lib/**"
|
||||
- "main.js"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "lib/**"
|
||||
- "main.js"
|
||||
- "package.json"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
+39
-39
@@ -33,50 +33,50 @@ jobs:
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: nlts-win-x64
|
||||
path: dist/nlts-win-x64.zip
|
||||
path: dist/nlts-win-x64/
|
||||
- name: "Upload to artifact(linux)"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: nlts-linux-x64
|
||||
path: dist/nlts-linux-x64.zip
|
||||
path: dist/nlts-linux-x64/
|
||||
- name: "Upload to artifact(macos)"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: nlts-macos-x64
|
||||
path: dist/nlts-macos-x64.zip
|
||||
pkg_arm64:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Checkout codes"
|
||||
uses: actions/checkout@v2
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "16"
|
||||
- name: "Pkg this"
|
||||
run: |
|
||||
npm install
|
||||
npm run pkg_arm64
|
||||
- name: "Upload to artifact"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: nlts-linux-arm64
|
||||
path: dist/
|
||||
pkg_armv7:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "Checkout codes"
|
||||
uses: actions/checkout@v2
|
||||
- name: "Use Node.js"
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "16"
|
||||
- name: "Pkg this"
|
||||
run: |
|
||||
npm install
|
||||
npm run pkg_armv7
|
||||
- name: "Upload to artifact"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: nlts-linux-armv7
|
||||
path: dist/
|
||||
path: dist/nlts-macos-x64/
|
||||
# pkg_arm64:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: "Checkout codes"
|
||||
# uses: actions/checkout@v2
|
||||
# - name: "Use Node.js"
|
||||
# uses: actions/setup-node@v1
|
||||
# with:
|
||||
# node-version: "16"
|
||||
# - name: "Pkg this"
|
||||
# run: |
|
||||
# npm install
|
||||
# npm run pkg_arm64
|
||||
# - name: "Upload to artifact"
|
||||
# uses: actions/upload-artifact@v2
|
||||
# with:
|
||||
# name: nlts-linux-arm64
|
||||
# path: dist/
|
||||
# pkg_armv7:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: "Checkout codes"
|
||||
# uses: actions/checkout@v2
|
||||
# - name: "Use Node.js"
|
||||
# uses: actions/setup-node@v1
|
||||
# with:
|
||||
# node-version: "16"
|
||||
# - name: "Pkg this"
|
||||
# run: |
|
||||
# npm install
|
||||
# npm run pkg_armv7
|
||||
# - name: "Upload to artifact"
|
||||
# uses: actions/upload-artifact@v2
|
||||
# with:
|
||||
# name: nlts-linux-armv7
|
||||
# path: dist/
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
node_modules/
|
||||
.vscode/
|
||||
tests/
|
||||
dyids/
|
||||
dist/
|
||||
package-lock.json
|
||||
|
||||
+610
@@ -0,0 +1,610 @@
|
||||
<!-- markdownlint-disable MD036 MD024-->
|
||||
# CHANGELOG
|
||||
|
||||
## 主要变化(2.3.2)
|
||||
|
||||
* b4c7a83 docs: 更新README
|
||||
* 72b07a0 chore: 暂时去除打包到arm
|
||||
* 4accd2d fix: 根据点赞去重(#64)
|
||||
* d1c2c61 fix: 无法打包pkg_armv7
|
||||
* 6b09711 feat: 获取和储存整理好的动态信息(#64)
|
||||
## 较上一版本变化
|
||||
|
||||
[my_config.js](my_config.js)增加
|
||||
* `APIs` - 获取抽奖信息的链接字符串
|
||||
* `set_lottery_info_url` - 上传抽奖信息的链接字符串
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
|
||||
|
||||
**Full Changelog**: https://github.com/shanmiteko/LotteryAutoScript/compare/v2.3.1...v2.3.2
|
||||
|
||||
## 主要变化(2.3.1)
|
||||
|
||||
## 问题修复
|
||||
|
||||
- 该动态不能转发分享(#60)
|
||||
- 发布的动态内容未序列化(#47)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.3.0...v2.3.1>
|
||||
|
||||
## 主要变化(2.3.0)
|
||||
|
||||
- 私信检查所有未读消息
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.2.9...v2.3.0>
|
||||
|
||||
## 主要变化(2.2.9)
|
||||
|
||||
- 检查动态创建时间(#57)(#58)
|
||||
- 简单整理(#56)
|
||||
|
||||
## 问题修复
|
||||
|
||||
- 非转发动态无源用户(#54)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`增加`max_create_time`
|
||||
|
||||
**替换可执行文件和更改配置文件(建议修改)**
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.2.8...v2.2.9>
|
||||
|
||||
## 主要变化(2.2.8)
|
||||
|
||||
- 遇到过期的cookie跳过(#51)
|
||||
|
||||
## 问题修复
|
||||
|
||||
- UP关闭评论区(#52)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.2.7...v2.2.8>
|
||||
|
||||
## 主要变化(2.2.7)
|
||||
|
||||
## 问题修复
|
||||
|
||||
- 未移动分区(#50)
|
||||
- 修改线路切换逻辑
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.2.6...v2.2.7>
|
||||
|
||||
## 主要变化(2.2.6)
|
||||
|
||||
- LOG日志显示随机动态内容(#47)
|
||||
- 增加设置过滤间隔
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`增加`filter_wait`
|
||||
|
||||
**替换可执行文件和更改配置文件(建议修改)**
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.2.5...v2.2.6>
|
||||
|
||||
## 主要变化(2.2.5)
|
||||
|
||||
## 问题修复
|
||||
|
||||
- 因黑名单而关注失败(#45)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.2.4...v2.2.5>
|
||||
|
||||
## 主要变化(2.2.4)
|
||||
|
||||
- api线路切换具有记忆功能
|
||||
- 增加更多时延自定义值(#44)
|
||||
- 重构部分代码
|
||||
- 内置默认设置
|
||||
|
||||
## 问题修复
|
||||
|
||||
- 清理动态时关注列表获取失败
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`增加
|
||||
- `get_session_wait` 读取下一页私信间隔
|
||||
- `update_session_wait` 已读私信间隔
|
||||
- `get_partition_wait` 读取下一页关注列表间隔
|
||||
- `get_dynamic_detail_wait` 获取动态细节间隔
|
||||
- `random_dynamic_wait` 随机动态间隔
|
||||
|
||||
**替换可执行文件和更改配置文件(建议修改)**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.2.3...v2.2.4>
|
||||
|
||||
## 主要变化(2.2.3)
|
||||
|
||||
- clear_dynamic_type类型可以多选(#42)
|
||||
|
||||
## 问题修复
|
||||
|
||||
- 番剧动态无user_profile(#41)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`修改`clear_dynamic_type`
|
||||
|
||||
**替换可执行文件和更改配置文件(建议修改)**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.2.2...v2.2.3>
|
||||
|
||||
## 主要变化(2.2.2)
|
||||
|
||||
- 随机转发热门视频(#40)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`增加`create_dy_mode` `create_dy_type`
|
||||
|
||||
**替换可执行文件和更改配置文件(建议修改)**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.2.1...v2.2.2>
|
||||
|
||||
## 主要变化(2.2.1)
|
||||
|
||||
- 动态不存在时出错(#39)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
**Full Changelog**: <https://github.com/shanmiteko/LotteryAutoScript/compare/v2.2.0...v2.2.1>
|
||||
|
||||
## 主要变化(2.2.0)
|
||||
|
||||
- 修改转发验重逻辑
|
||||
- 可间隔插入随机动态(#33)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`增加create_dy_mode
|
||||
|
||||
**替换可执行文件和更改配置文件(建议修改)**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.1.8)
|
||||
|
||||
- 设置支持热更新(#29)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`文件格式更改
|
||||
- `my_config.js`文件格式更改
|
||||
|
||||
**替换可执行文件和更改配置文件(建议修改)**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.1.7)
|
||||
|
||||
- 设置支持热更新(#29)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`文件格式更改
|
||||
- `my_config.js`无
|
||||
|
||||
**替换可执行文件和更改env.js**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.1.6)
|
||||
|
||||
- 新增设置not_check_article(#25)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`新增设置not_check_article
|
||||
|
||||
**替换可执行文件和更改my_config.js**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.1.5)
|
||||
|
||||
- 修复之前无法更新的问题
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**仅需替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.1.4)
|
||||
|
||||
- 黑名单处理(#22)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**仅需替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.1.3)
|
||||
|
||||
- 错误码变更(#20)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**仅需替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.1.2)
|
||||
|
||||
- 支持arm平台运行
|
||||
- 改变账号异常应对策略
|
||||
- 修改dingtalk签名base64问题(#17)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**仅需替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.1.1)
|
||||
|
||||
- 获取未读私信接口变化
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**仅需替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.1.0)
|
||||
|
||||
- 修复两处问题
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**仅需替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.0.9)
|
||||
|
||||
- 账号异常自动切换线路(#14)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**仅需替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.0.8)
|
||||
|
||||
- 账号异常时未处理和发送通知
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**仅需替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化(2.0.7)
|
||||
|
||||
- 修复一处问题
|
||||
- 日志时间UTC+8(#13)
|
||||
|
||||
## 较上一版本变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**仅需替换可执行文件**
|
||||
|
||||
_如果之前版本小于上一版本,请查看**历次更新**说明_
|
||||
_[查看链接](https://github.com/shanmiteko/LotteryAutoScript/releases)_
|
||||
|
||||
## 主要变化
|
||||
|
||||
- 支持更新检查
|
||||
- 增加设置`update_loop_wait`
|
||||
|
||||
## 较上一版本(v2.0.5)变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`增加设置`update_loop_wait`
|
||||
|
||||
**替换可执行文件和更新my_config.js**
|
||||
|
||||
_如果之前版本小于2.0.5,请查看历次更新说明_
|
||||
|
||||
## 主要变化
|
||||
|
||||
- 不参与主站黑名单用户抽奖
|
||||
- my_config.js注释修改
|
||||
- 可从环境变量中读取COOKIE
|
||||
- 其他不影响功能的调整
|
||||
|
||||
## 较上一版本(v2.0.4)变化
|
||||
|
||||
- `env.js`无
|
||||
- `my_config.js`无
|
||||
|
||||
**仅需替换可执行文件**
|
||||
|
||||
## 新特性
|
||||
|
||||
中奖通知设置可设黑名单
|
||||
|
||||
## 较上一版本(v2.0.3)变化
|
||||
|
||||
`env.js`无
|
||||
`my_config.js`无
|
||||
**仅需替换可执行文件**
|
||||
|
||||
## 问题修复
|
||||
|
||||
- 评论失败未退出
|
||||
- 切割tag不精准
|
||||
|
||||
## 较上一版本(v2.0.2)变化
|
||||
|
||||
`env.js`无
|
||||
`my_config.js`无
|
||||
**仅需替换可执行文件**
|
||||
|
||||
edit: 替换release
|
||||
|
||||
## 问题修复
|
||||
|
||||
# 9
|
||||
|
||||
## 较上一版本(2.0.1)变化
|
||||
|
||||
`env.js`无
|
||||
`my_config.js`无
|
||||
**仅需替换可执行文件**
|
||||
|
||||
## 新增特性
|
||||
|
||||
增加两处自定义设置(`my_config.js`)
|
||||
|
||||
- `clear_quick_remove_attention`
|
||||
- `notice_key_words`
|
||||
|
||||
## 问题修复
|
||||
|
||||
# 7
|
||||
|
||||
## 较上一版本(2.0.0)变化
|
||||
|
||||
`env.js`无
|
||||
`my_config.js`需修改添加两处自定义设置
|
||||
除了替换可执行文件,还要修改`my_config.js`文件
|
||||
|
||||
## 新增特性
|
||||
|
||||
打乱将转发的动态顺序,防止被人认出是抽奖号
|
||||
|
||||
## 问题修复
|
||||
|
||||
修复两处潜在bug
|
||||
|
||||
## 较上一版本(1.9.9)变化
|
||||
|
||||
`env.js`无
|
||||
`my_config.js`无
|
||||
只需替换可执行文件
|
||||
|
||||
## 优化体验
|
||||
|
||||
清理动态时日志更详细
|
||||
以及其他细节处理
|
||||
|
||||
## 较上一版本(1.9.8)变化
|
||||
|
||||
`env.js`无
|
||||
`my_config.js`无
|
||||
只需替换可执行文件
|
||||
|
||||
edit: 1.9.9.1
|
||||
edit: 1.9.9.2
|
||||
|
||||
## 修复Bug
|
||||
|
||||
两级解构时第一级为undefined(表现为异常退出)
|
||||
|
||||
## 较上一版本(1.9.7)变化
|
||||
|
||||
`env.js`更改注释内容
|
||||
`my_config.js`无
|
||||
只需替换可执行文件
|
||||
|
||||
## 修复Bug
|
||||
|
||||
转发专栏内的抽奖时无法获取关注
|
||||
|
||||
## 较上一版本(1.9.6)变化
|
||||
|
||||
`env.js`无
|
||||
`my_config.js`无
|
||||
只需替换可执行文件
|
||||
|
||||
## 主要变化(1.9.6)
|
||||
|
||||
去除对unzipper的依赖
|
||||
专栏转发率达一半以上时跳过
|
||||
|
||||
## 较上一版本变更
|
||||
|
||||
`env.js`无
|
||||
`my_config.js`无
|
||||
只需替换可执行文件
|
||||
|
||||
## 主要新增功能(1.9.5)
|
||||
|
||||
可从专栏里获取抽奖动态
|
||||
|
||||
## 较上一版本变更
|
||||
|
||||
`env.js`无变化
|
||||
`my_config.js`去掉部分设置,新增部分设置
|
||||
|
||||
## 1.9.0
|
||||
|
||||
修复Bug后的稳定版(大概
|
||||
|
||||
- 21/7/21 附加bat脚本增加对小白的友好性
|
||||
|
||||
## 1.8
|
||||
|
||||
fix: 开奖时间过滤失效
|
||||
|
||||
# 1.7
|
||||
|
||||
change 修复一处bug
|
||||
change 重新上传zip
|
||||
change 重新上传zip
|
||||
|
||||
## 1.6
|
||||
|
||||
perf: 重构代码
|
||||
|
||||
- 分离动态筛选部分的网络请求和数据处理
|
||||
- 优化部分ifelse判断
|
||||
feat:
|
||||
- 新增NOT_GO_LOTTERY环境变量
|
||||
- 边转边存dyid
|
||||
- 滤除的dyid也进行存储
|
||||
fix: 修复部分bug
|
||||
|
||||
## 1.5
|
||||
|
||||
feat: 日志相关
|
||||
|
||||
- 彩色输出
|
||||
- 环境变量LOTTERY_LOG_LEVEL更改日志等级
|
||||
feat: 设置相关
|
||||
- lottery_loop_wait 抽奖循环
|
||||
- check_loop_wait 检奖循环
|
||||
- clear_loop_wait 清理循环
|
||||
|
||||
## 1.4
|
||||
|
||||
fix: 部分动态无法获取描述
|
||||
|
||||
## 1.3
|
||||
|
||||
feat: 新增loop_wait设置
|
||||
|
||||
可执行文件压缩包
|
||||
|
||||
# 命令行工具
|
||||
|
||||
可执行文件压缩包
|
||||
|
||||
可执行文件压缩包
|
||||
@@ -1,4 +1,5 @@
|
||||
# AutoScript
|
||||
|
||||
- [AutoScript](#autoscript)
|
||||
- [操作步骤](#操作步骤)
|
||||
- [获取COOKIE](#获取cookie)
|
||||
@@ -13,6 +14,7 @@
|
||||
- [检测未读信息, 已读未读信息](#检测未读信息-已读未读信息)
|
||||
- [中奖推送(可选)](#中奖推送可选)
|
||||
- [设置说明](#设置说明)
|
||||
- [Awesome](#awesome)
|
||||
|
||||
[Github仓库链接](https://github.com/shanmiteko/LotteryAutoScript)
|
||||
|
||||
@@ -21,11 +23,14 @@
|
||||
[](https://github.com/shanmiteko/LotteryAutoScript/actions/workflows/npmp.yml)
|
||||
|
||||
已实现功能:
|
||||
|
||||
- 监控用户转发
|
||||
- 监控话题页面
|
||||
- 监控专栏合集
|
||||
- 自动点赞、评论、乱序转发、@好友、带话题、可选随机动态
|
||||
- 检测是否中奖
|
||||
- 已读@
|
||||
- 已读私信
|
||||
- 清理动态关注
|
||||
- 检查更新
|
||||
- 更多功能设置请参考配置文件
|
||||
@@ -69,7 +74,7 @@ Chrome浏览器:
|
||||
.join('; ')
|
||||
.split()
|
||||
.forEach(it => copy(it) || console.log(it))
|
||||
```
|
||||
```
|
||||
|
||||
也可以采用**其他方式获取**所需的Cookie
|
||||
|
||||
@@ -82,7 +87,9 @@ Chrome浏览器:
|
||||
### 本地运行
|
||||
|
||||
#### 可执行文件
|
||||
|
||||
1. [[下载](https://github.com/shanmiteko/LotteryAutoScript/releases)|[cnpmjs镜像下载](https://github.com.cnpmjs.org/shanmiteko/LotteryAutoScript/releases)|[Fastgit镜像下载](https://hub.fastgit.org/shanmiteko/LotteryAutoScript/releases)]压缩包并解压后
|
||||
|
||||
```
|
||||
~/nlts-linux-x64
|
||||
=> tree
|
||||
@@ -92,15 +99,32 @@ Chrome浏览器:
|
||||
├── my_config.js (自定义设置文件) (!使用前必读)
|
||||
└── README.md (说明文件)
|
||||
```
|
||||
|
||||
2. 用记事本或其他编辑器修改`env.js`和`my_config.js`文件(右键选择用记事本打开)
|
||||
3. 在`env.js`中填入`COOKIE`和推送参数
|
||||
4. 在`my_config.js`中自定义设置
|
||||
5. 在当前目录下**打开终端**运行可执行文件`lottery`(勿直接点击`lottery`)
|
||||
- `lottery start` 启动抽奖
|
||||
- `lottery check` 检测中奖
|
||||
- `lottery clear` 清理动态
|
||||
|
||||
或者 新建文本文档写入`lottery start`然后更改扩展名为.bat点击运行(已自带start.bat可直接点击)
|
||||
```sh
|
||||
# unix-like
|
||||
## 进入脚本所在目录
|
||||
## 授予执行权限
|
||||
$ chmod u+x lottery
|
||||
## 启动脚本
|
||||
$ ./lottery start
|
||||
## 检测中奖
|
||||
$ ./lottery check
|
||||
## 清理关注动态
|
||||
$ ./lottery clear
|
||||
## 下载最新版本
|
||||
$ ./lottery clear
|
||||
|
||||
# windows
|
||||
## 不需要chmod
|
||||
## 把`./`换成`.\`或去掉
|
||||
## 已自带*.bat可直接点击
|
||||
```
|
||||
|
||||
7. 运行截图
|
||||

|
||||
|
||||
@@ -167,11 +191,13 @@ npm i && npm run clear
|
||||
脚本已内置定时运行功能
|
||||
|
||||
##### Linux
|
||||
|
||||
[linux系统配置与定时运行](./doc/linux_schedule.md)
|
||||
|
||||
</details>
|
||||
|
||||
### Docker
|
||||
|
||||
1.初始化
|
||||
|
||||
```bash
|
||||
@@ -179,11 +205,13 @@ curl -fsSL https://cdn.staticaly.com/gh/shanmiteko/LotteryAutoScript/main/script
|
||||
```
|
||||
|
||||
进入`lottery`文件夹
|
||||
|
||||
```bash
|
||||
cd lottery
|
||||
```
|
||||
|
||||
编辑`env.js`与`my_config.js`文件
|
||||
|
||||
- env.js 设置必要环境变量
|
||||
- my_config.js 你的设置
|
||||
|
||||
@@ -191,6 +219,7 @@ cd lottery
|
||||
> start,check,clear
|
||||
|
||||
例如:
|
||||
|
||||
```bash
|
||||
./start.sh
|
||||
```
|
||||
@@ -213,19 +242,21 @@ rm -rf lottery/
|
||||
----------------------------------------
|
||||
|
||||
## 防重复转发
|
||||
|
||||
~~存储在专栏草稿~~
|
||||
|
||||
~~脚本将转发过的动态和被过滤的动态都写入`dyids/dyid*.txt`文件中~~
|
||||
|
||||
是否点赞
|
||||
|
||||
|
||||
----------------------------------------
|
||||
|
||||
## 检测中奖
|
||||
|
||||
### 检测未读信息, 已读未读信息
|
||||
|
||||
判断依据
|
||||
|
||||
- 通过`@`信息判断
|
||||
|
||||
- 通过私信判断
|
||||
@@ -233,37 +264,45 @@ rm -rf lottery/
|
||||
关键词有限 可能会有**漏掉**的或**误报**
|
||||
|
||||
### 中奖推送(可选)
|
||||
|
||||
> 填写在env.js内
|
||||
|
||||
以下是支持的推送方式
|
||||
|
||||
| Name | 归属 | 属性 | 说明 |
|
||||
| :---------------: | :--------------------------------------------------------------------------------: | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `SCKEY` | 微信server酱推送(于2021/4月下线) | 非必须 | server酱的微信通知[官方文档](http://sc.ftqq.com/3.version) |
|
||||
| `SENDKEY` | 微信server酱(Turbo版)推送 | 非必须 | [获取SENDKEY](https://sct.ftqq.com/sendkey) [选择消息通道](https://sct.ftqq.com/forward) |
|
||||
| `BARK_PUSH` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | IOS用户下载BARK这个APP,填写内容是app提供的`设备码`,例如:https://api.day.app/123 ,那么此处的设备码就是`123`,再不懂看 [这个图](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/bark.jpg)(注:支持自建填完整链接即可) |
|
||||
| `BARK_SOUND` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | bark推送声音设置,例如`choo`,具体值请在`bark`-`推送铃声`-`查看所有铃声` |
|
||||
| `TG_BOT_TOKEN` | telegram推送 | 非必须 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写自己申请[@BotFather](https://t.me/BotFather)的Token,如`10xxx4:AAFcqxxxxgER5uw` , [具体教程](doc/TG_PUSH.md) |
|
||||
| `TG_USER_ID` | telegram推送 | 非必须 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写[@getuseridbot](https://t.me/getuseridbot)中获取到的纯数字ID, [具体教程](doc/TG_PUSH.md) |
|
||||
| `TG_PROXY_HOST` | Telegram 代理的 IP | 非必须 | 代理类型为 http。例子:http代理 http://127.0.0.1:1080 则填写 127.0.0.1 |
|
||||
| `TG_PROXY_PORT` | Telegram 代理的端口 | 非必须 | 例子:http代理 http://127.0.0.1:1080 则填写 1080 |
|
||||
| `DD_BOT_TOKEN` | 钉钉推送 | 非必须 | 钉钉推送(`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需)[官方文档](https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq) ,只需`https://oapi.dingtalk.com/robot/send?access_token=XXX` 等于`=`符号后面的XXX即可 |
|
||||
| `DD_BOT_SECRET` | 钉钉推送 | 非必须 | (`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需) ,密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的`SECXXXXXXXXXX`等字符 , 注:钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/DD_bot.png) |
|
||||
| `IGOT_PUSH_KEY` | iGot推送 | 非必须 | iGot聚合推送,支持多方式推送,确保消息可达。 [参考文档](https://wahao.github.io/Bark-MP-helper ) |
|
||||
| `QQ_SKEY` | 酷推(Cool Push)推送 | 非必须 | 推送所需的Skey,登录后获取Skey [参考文档](https://cp.xuthus.cc/) |
|
||||
| `QQ_MODE` | 酷推(Cool Push)推送 | 非必须 | 推送方式(send或group或者wx,默认send) [参考文档](https://cp.xuthus.cc/) |
|
||||
| `QYWX_KEY` | 企业微信推送 | 非必须 | 密钥,企业微信推送 webhook 后面的 key [详见官方说明文档](https://work.weixin.qq.com/api/doc/90000/90136/91770) |
|
||||
| `PUSH_PLUS_TOKEN` | pushplus推送 | 非必须 | 微信扫码登录后一对一推送或一对多推送下面的token(您的Token) [官方网站](http://pushplus.hxtrip.com/) |
|
||||
| `PUSH_PLUS_USER` | pushplus推送 | 非必须 | 一对多推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码)注:(1、需订阅者扫描二维码 2、如果您是创建群组所属人,也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送),只填`PUSH_PLUS_TOKEN`默认为一对一推送 |
|
||||
| `SMTP_HOST` | 电子邮件 | 非必须 | smtp服务器的主机名 如: `smtp.qq.com` |
|
||||
| `SMTP_PORT` | 电子邮件 | 非必须 | smtp服务器的端口 如: `465` |
|
||||
| `SMTP_USER` | 电子邮件 | 非必须 | 发送方的电子邮件 如: `xxxxxxxxx@qq.com` |
|
||||
| `SMTP_PASS` | 电子邮件 | 非必须 | smtp服务对应的授权码 |
|
||||
| `SMTP_TO_USER` | 电子邮件 | 非必须 | 接收方电子邮件 |
|
||||
| Name | 归属 | 属性 | 说明 |
|
||||
| :---------------: | :--------------------------------------------------------------------------------: | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `SCKEY` | 微信server酱推送(于2021/4月下线) | 非必须 | server酱的微信通知[官方文档](http://sc.ftqq.com/3.version) |
|
||||
| `SENDKEY` | 微信server酱(Turbo版)推送 | 非必须 | [获取SENDKEY](https://sct.ftqq.com/sendkey) [选择消息通道](https://sct.ftqq.com/forward) |
|
||||
| `BARK_PUSH` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | IOS用户下载BARK这个APP,填写内容是app提供的`设备码`,例如:<https://api.day.app/123> ,那么此处的设备码就是`123`,再不懂看 [这个图](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/bark.jpg)(注:支持自建填完整链接即可) |
|
||||
| `BARK_SOUND` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | bark推送声音设置,例如`choo`,具体值请在`bark`-`推送铃声`-`查看所有铃声` |
|
||||
| `TG_BOT_TOKEN` | telegram推送 | 非必须 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写自己申请[@BotFather](https://t.me/BotFather)的Token,如`10xxx4:AAFcqxxxxgER5uw` , [具体教程](doc/TG_PUSH.md) |
|
||||
| `TG_USER_ID` | telegram推送 | 非必须 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写[@getuseridbot](https://t.me/getuseridbot)中获取到的纯数字ID, [具体教程](doc/TG_PUSH.md) |
|
||||
| `TG_PROXY_HOST` | Telegram 代理的 IP | 非必须 | 代理类型为 http。例子:http代理 <http://127.0.0.1:1080> 则填写 127.0.0.1 |
|
||||
| `TG_PROXY_PORT` | Telegram 代理的端口 | 非必须 | 例子:http代理 <http://127.0.0.1:1080> 则填写 1080 |
|
||||
| `DD_BOT_TOKEN` | 钉钉推送 | 非必须 | 钉钉推送(`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需)[官方文档](https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq) ,只需`https://oapi.dingtalk.com/robot/send?access_token=XXX` 等于`=`符号后面的XXX即可 |
|
||||
| `DD_BOT_SECRET` | 钉钉推送 | 非必须 | (`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需) ,密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的`SECXXXXXXXXXX`等字符 , 注:钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](https://gitee.com/shanmite/LotteryAutoScript/raw/main/doc/pic/DD_bot.png) |
|
||||
| `IGOT_PUSH_KEY` | iGot推送 | 非必须 | iGot聚合推送,支持多方式推送,确保消息可达。 [参考文档](https://wahao.github.io/Bark-MP-helper ) |
|
||||
| `QQ_SKEY` | 酷推(Cool Push)推送 | 非必须 | 推送所需的Skey,登录后获取Skey [参考文档](https://cp.xuthus.cc/) |
|
||||
| `QQ_MODE` | 酷推(Cool Push)推送 | 非必须 | 推送方式(send或group或者wx,默认send) [参考文档](https://cp.xuthus.cc/) |
|
||||
| `QYWX_KEY` | 企业微信推送 | 非必须 | 密钥,企业微信推送 webhook 后面的 key [详见官方说明文档](https://work.weixin.qq.com/api/doc/90000/90136/91770) |
|
||||
| `PUSH_PLUS_TOKEN` | pushplus推送 | 非必须 | 微信扫码登录后一对一推送或一对多推送下面的token(您的Token) [官方网站](http://pushplus.hxtrip.com/) |
|
||||
| `PUSH_PLUS_USER` | pushplus推送 | 非必须 | 一对多推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码)注:(1、需订阅者扫描二维码 2、如果您是创建群组所属人,也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送),只填`PUSH_PLUS_TOKEN`默认为一对一推送 |
|
||||
| `SMTP_HOST` | 电子邮件 | 非必须 | smtp服务器的主机名 如: `smtp.qq.com` |
|
||||
| `SMTP_PORT` | 电子邮件 | 非必须 | smtp服务器的端口 如: `465` |
|
||||
| `SMTP_USER` | 电子邮件 | 非必须 | 发送方的电子邮件 如: `xxxxxxxxx@qq.com` |
|
||||
| `SMTP_PASS` | 电子邮件 | 非必须 | smtp服务对应的授权码 |
|
||||
| `SMTP_TO_USER` | 电子邮件 | 非必须 | 接收方电子邮件 |
|
||||
|
||||
----------------------------------------
|
||||
|
||||
## 设置说明
|
||||
|
||||
详见[env.example.js](./env.example.js)文件内部注释
|
||||
|
||||
详见[my_config.example.js](./my_config.example.js)文件内部注释
|
||||
|
||||
## Awesome
|
||||
相关项目
|
||||
|
||||
- [LotteryAutoScript_Station](https://github.com/spiritLHL/LotteryAutoScript_Station) - @spiritLHL
|
||||
- [sync_lottery](https://github.com/spiritLHL/sync_lottery) - @spiritLHL
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 274 KiB |
+26
-19
@@ -9,20 +9,24 @@ const bili = require('./net/bili')
|
||||
*/
|
||||
async function isMe() {
|
||||
let desp = '';
|
||||
const UnreadAtNum = await bili.getUnreadAtNum();
|
||||
const UnreadSessionNum = await bili.getUnreadSessionNum();
|
||||
const { follow_unread, unfollow_unread } = UnreadSessionNum || { unfollow_unread: 0, follow_unread: 0 };
|
||||
const
|
||||
{ notice_key_words, update_session_wait, get_session_wait } = config,
|
||||
UnreadAtNum = await bili.getUnreadAtNum(),
|
||||
UnreadSessionNum = await bili.getUnreadSessionNum(),
|
||||
{ follow_unread, unfollow_unread } = UnreadSessionNum || { unfollow_unread: 0, follow_unread: 0 };
|
||||
if (UnreadAtNum > 0) {
|
||||
log.info('中奖检测', '<-- 正在检查at');
|
||||
const MyAtInfo = await bili.getMyAtInfo();
|
||||
MyAtInfo.forEach(async AtInfo => {
|
||||
const { at_time, up_uname, business, source_content, url } = AtInfo
|
||||
desp += `发生时间: ${new Date(at_time * 1000).toLocaleString()} \n\n`
|
||||
desp += `用户: ${up_uname} \n\n`
|
||||
desp += `在${business}中@了你(${global_var.get("myUID")}) \n\n`
|
||||
desp += `原内容为: ${source_content} \n\n`
|
||||
desp += `[直达链接](${url}) \n\n`
|
||||
desp += `\n\n`
|
||||
desp += '## [at]检测结果\n\n'
|
||||
desp += '----------------------------------------------------------------\n\n'
|
||||
desp += `发生时间: ${new Date(at_time * 1000).toLocaleString()}\n\n`
|
||||
desp += `用户: ${up_uname}\n\n`
|
||||
desp += `在${business}中@了你(${global_var.get("myUID")})\n\n`
|
||||
desp += `原内容为: ${source_content}\n\n`
|
||||
desp += `[直达链接](${url})\n\n`
|
||||
desp += '----------------------------------------------------------------\n\n'
|
||||
});
|
||||
log.info('中奖检测', '--> OK');
|
||||
}
|
||||
@@ -32,22 +36,25 @@ async function isMe() {
|
||||
let MySession = await bili.getSessionInfo(type)
|
||||
for (const index of infiniteNumber()) {
|
||||
for (const Session of MySession.data) {
|
||||
const { content, sender_uid, session_ts, timestamp, unread_count, talker_id, msg_seqno } = Session;
|
||||
const { sender_uid, session_ts, timestamp, unread_count, talker_id, msg_seqno } = Session;
|
||||
session_t = session_ts;
|
||||
if (unread_count) {
|
||||
bili.updateSessionStatus(talker_id, type, msg_seqno);
|
||||
await delay(1000);
|
||||
if (judge(content, config.notice_key_words)) {
|
||||
desp += `发生时间: ${new Date(timestamp * 1000).toLocaleString()} \n\n`
|
||||
desp += `用户: ${sender_uid} \n\n`
|
||||
desp += `私信你(${global_var.get("myUID")})说: ${content} \n\n`
|
||||
desp += `[直达链接](https://message.bilibili.com/#/whisper/mid${sender_uid}) \n\n`
|
||||
desp += `\n\n`
|
||||
const content = await bili.fetch_session_msgs(talker_id, unread_count);
|
||||
if (judge(content, notice_key_words)) {
|
||||
desp += '## 私信检测结果\n\n'
|
||||
desp += '----------------------------------------------------------------\n\n'
|
||||
desp += `发生时间: ${new Date(timestamp * 1000).toLocaleString()}\n\n`
|
||||
desp += `用户: ${sender_uid}\n\n`
|
||||
desp += `私信你(${global_var.get("myUID")})说:\n${content}\n\n`
|
||||
desp += `[直达链接](https://message.bilibili.com/#/whisper/mid${sender_uid})\n\n`
|
||||
desp += '----------------------------------------------------------------\n\n'
|
||||
}
|
||||
await bili.updateSessionStatus(talker_id, type, msg_seqno);
|
||||
await delay(update_session_wait);
|
||||
}
|
||||
}
|
||||
if (MySession.has_more && index < 16) {
|
||||
await delay(3e3);
|
||||
await delay(get_session_wait);
|
||||
MySession = await bili.getSessionInfo(type, session_t)
|
||||
} else {
|
||||
break
|
||||
|
||||
+29
-17
@@ -9,20 +9,22 @@ const config = require("./data/config");
|
||||
* @returns { Promise<number[]> }
|
||||
*/
|
||||
async function getFollowList() {
|
||||
const tagid = await bili.checkMyPartition(config.clear_partition);
|
||||
const
|
||||
{ clear_partition, clear_white_list, get_partition_wait } = config,
|
||||
tagid = await bili.checkMyPartition(clear_partition);
|
||||
let rmup = [];
|
||||
if (typeof tagid === 'undefined') {
|
||||
log.info('获取关注列表', '未能成功获取关注分区id');
|
||||
return
|
||||
return rmup
|
||||
}
|
||||
let rmup = [];
|
||||
for (let index = 1; index < 42; index++) {
|
||||
const uids = await bili.getPartitionUID(tagid, index);
|
||||
await delay(2e3);
|
||||
await delay(get_partition_wait);
|
||||
if (!uids.length) break;
|
||||
rmup.push(...uids)
|
||||
}
|
||||
return config.clear_white_list.length
|
||||
? rmup.filter(uid => config.clear_white_list.split(',').indexOf(String(uid)) === -1)
|
||||
return clear_white_list.length
|
||||
? rmup.filter(uid => clear_white_list.split(',').indexOf(String(uid)) === -1)
|
||||
: rmup;
|
||||
}
|
||||
|
||||
@@ -30,7 +32,7 @@ async function getFollowList() {
|
||||
* 清理动态和关注
|
||||
*/
|
||||
async function clear() {
|
||||
const { clear_white_list, clear_max_day, clear_quick_remove_attention, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type } = config;
|
||||
const { search_wait, clear_white_list, clear_max_day, clear_quick_remove_attention, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type } = config;
|
||||
let success = true;
|
||||
const uid_list = await getFollowList();
|
||||
if (!uid_list.length) {
|
||||
@@ -63,15 +65,17 @@ async function clear() {
|
||||
|
||||
for (const page of infiniteNumber()) {
|
||||
log.info('清理动态', `开始读取第${page + 1}页`);
|
||||
const { allModifyDynamicResArray, offset } = await Searcher.checkAllDynamic(MY_UID, 1, 5 * 1000, next_offset);
|
||||
const { allModifyDynamicResArray, offset } = await Searcher.checkAllDynamic(MY_UID, 1, search_wait, next_offset);
|
||||
next_offset = offset;
|
||||
for (const [index, dyinfo] of allModifyDynamicResArray.entries()) {
|
||||
log.info('清理动态', `第${page + 1}页中的第${index + 1}个动态`)
|
||||
const { type, dynamic_id, createtime } = dyinfo || {};
|
||||
if (type === clear_dynamic_type) {
|
||||
const
|
||||
{ origin_uid } = dyinfo,
|
||||
days_ago = (Now - createtime) / 86400;
|
||||
const { type, dynamic_id, create_time, origin_uid } = dyinfo || {};
|
||||
if (typeof type !== 'undefined'
|
||||
&& clear_dynamic_type instanceof Array
|
||||
? clear_dynamic_type.includes(type)
|
||||
: clear_dynamic_type === type
|
||||
) {
|
||||
const days_ago = (Now - create_time) / 86400;
|
||||
|
||||
if (days_ago > clear_max_day) {
|
||||
/* 移除动态 */
|
||||
@@ -90,13 +94,21 @@ async function clear() {
|
||||
success = await bili.cancelAttention(origin_uid);
|
||||
}
|
||||
|
||||
if (!success) break;
|
||||
if (!success) {
|
||||
log.error("清理失败", "出现错误")
|
||||
break
|
||||
}
|
||||
/* 延时 */
|
||||
await delay(clear_remove_delay);
|
||||
} else {
|
||||
log.info('清理动态', `已设置跳过${clear_max_day}天 当前动态发布时间: ${~~days_ago}天前`)
|
||||
log.info('清理动态', `储存用户(${origin_uid})防止误删`)
|
||||
before_separate.push(origin_uid)
|
||||
log.info('清理动态', `已设置跳过${clear_max_day}天 当前动态(${dynamic_id})发布时间: ${~~days_ago}天前`)
|
||||
|
||||
if (origin_uid) {
|
||||
log.info('清理动态', `储存用户(${origin_uid})防止误删`)
|
||||
before_separate.push(origin_uid)
|
||||
} else {
|
||||
log.info('清理动态', `非转发动态`)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.info('清理动态', `此动态类型为${type} != 要清理的动态类型${clear_dynamic_type}`)
|
||||
|
||||
+98
-56
@@ -1,11 +1,12 @@
|
||||
const utils = require('../utils');
|
||||
const { log, hasEnv, shuffle, getRandomOne, delay, try_for_each } = require('../utils');
|
||||
const { send } = require('../net/http');
|
||||
const bili = require('../net/bili');
|
||||
const { sendNotify } = require('../helper/notify');
|
||||
const event_bus = require('../helper/event_bus');
|
||||
const { randomDynamic } = require('../helper/randomDynamic')
|
||||
const { Searcher } = require('./searcher');
|
||||
const global_var = require("../data/global_var");
|
||||
const config = require("../data/config");
|
||||
const { log, hasEnv } = utils;
|
||||
|
||||
/**
|
||||
* 监视器
|
||||
@@ -24,6 +25,7 @@ class Monitor extends Searcher {
|
||||
['UIDs', this.getLotteryInfoByUID.bind(this)],
|
||||
['TAGs', this.getLotteryInfoByTag.bind(this)],
|
||||
['Articles', this.getLotteryInfoByArticle.bind(this)],
|
||||
['APIs', this.getLotteryInfoByAPI.bind(this)]
|
||||
]);
|
||||
}
|
||||
/**
|
||||
@@ -51,7 +53,7 @@ class Monitor extends Searcher {
|
||||
event_bus.emit('Turn_off_the_Monitor', '评论失败')
|
||||
break
|
||||
case 21:
|
||||
event_bus.emit('Turn_on_the_Monitor')
|
||||
event_bus.emit('Turn_off_the_Monitor', '关注出错')
|
||||
break
|
||||
case 22:
|
||||
log.warn('账号异常', `UID(${global_var.get('myUID')})异常号只会对部分UP出现关注异常`)
|
||||
@@ -82,13 +84,13 @@ class Monitor extends Searcher {
|
||||
async startLottery() {
|
||||
const allLottery = await this.filterLotteryInfo()
|
||||
, len = allLottery.length
|
||||
, { dy_contents, create_dy, create_dy_mode, wait } = config;
|
||||
, { create_dy, create_dy_mode, wait, filter_wait } = config;
|
||||
|
||||
log.info('筛选动态', `筛选完毕(${len})`);
|
||||
|
||||
if (len) {
|
||||
let is_exception = false;
|
||||
for (const [index, Lottery] of utils.shuffle(allLottery).entries()) {
|
||||
for (const [index, Lottery] of shuffle(allLottery).entries()) {
|
||||
let status = 0;
|
||||
|
||||
if (Lottery.isOfficialLottery) {
|
||||
@@ -99,10 +101,12 @@ class Monitor extends Searcher {
|
||||
}
|
||||
if (ts < ts_10) {
|
||||
log.info('过滤', '已过开奖时间')
|
||||
await delay(filter_wait)
|
||||
continue
|
||||
}
|
||||
if (ts > ts_10 + config.maxday * 86400) {
|
||||
log.info('过滤', '超过指定开奖时间')
|
||||
await delay(filter_wait)
|
||||
continue
|
||||
}
|
||||
} else if (Lottery.uid[0]) {
|
||||
@@ -112,6 +116,7 @@ class Monitor extends Searcher {
|
||||
}
|
||||
if (followerNum < config.minfollower) {
|
||||
log.info('过滤', `粉丝数(${followerNum})小于指定数量`)
|
||||
await delay(filter_wait)
|
||||
continue
|
||||
}
|
||||
}
|
||||
@@ -119,16 +124,17 @@ class Monitor extends Searcher {
|
||||
if (create_dy
|
||||
&& create_dy_mode instanceof Array
|
||||
&& index > 0
|
||||
&& index % create_dy_mode[0] === 0) {
|
||||
for (let i = 0; i < create_dy_mode[1]; i++) {
|
||||
await bili.createDynamic(utils.getRandomOne(dy_contents));
|
||||
await utils.delay(2000);
|
||||
}
|
||||
&& index % getRandomOne(create_dy_mode[0]) === 0
|
||||
) {
|
||||
const number = getRandomOne(create_dy_mode[1]) || 0;
|
||||
randomDynamic(number)
|
||||
}
|
||||
|
||||
status = await this.go(Lottery)
|
||||
switch (status) {
|
||||
case 0:
|
||||
case 9:
|
||||
case 19:
|
||||
break;
|
||||
case 22:
|
||||
is_exception = true
|
||||
@@ -137,7 +143,7 @@ class Monitor extends Searcher {
|
||||
return status
|
||||
}
|
||||
|
||||
await utils.delay(wait * (Math.random() + 0.5));
|
||||
await delay(wait * (Math.random() + 0.5));
|
||||
}
|
||||
log.info('抽奖', '开始转发下一组动态');
|
||||
if (is_exception) {
|
||||
@@ -167,6 +173,9 @@ class Monitor extends Searcher {
|
||||
*/
|
||||
async filterLotteryInfo() {
|
||||
const { lottery_param, LotteryInfoMap, attentionList } = this;
|
||||
/**
|
||||
* @type {import("./searcher").LotteryInfo[]}
|
||||
*/
|
||||
let protoLotteryInfo = await LotteryInfoMap.get(lottery_param[0])(lottery_param[1]);
|
||||
|
||||
if (protoLotteryInfo === null)
|
||||
@@ -178,9 +187,13 @@ class Monitor extends Searcher {
|
||||
|
||||
/** 所有抽奖信息 */
|
||||
let alllotteryinfo = [];
|
||||
const { key_words, model, chatmodel, is_imitator, only_followed, at_users, blockword, blacklist } = config;
|
||||
const
|
||||
{ set_lottery_info_url, key_words, model, chatmodel, max_create_time, is_imitator, only_followed, at_users, blockword, blacklist } = config,
|
||||
now_ts = Date.now() / 1000;
|
||||
|
||||
/**Map<String, Boolean> */
|
||||
/**
|
||||
* @type {Map<String, Boolean>}
|
||||
*/
|
||||
let dyids_map = new Map();
|
||||
|
||||
/**去重 */
|
||||
@@ -192,16 +205,41 @@ class Monitor extends Searcher {
|
||||
return true
|
||||
});
|
||||
|
||||
if (lottery_param[0] !== "APIs" && set_lottery_info_url) {
|
||||
log.info("上传抽奖信息", "开始")
|
||||
await new Promise((resolve) => {
|
||||
send({
|
||||
url: set_lottery_info_url,
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
},
|
||||
contents: protoLotteryInfo,
|
||||
success: ({ body }) => {
|
||||
log.info("发送获取到的动态数据", body)
|
||||
resolve()
|
||||
},
|
||||
failure: err => {
|
||||
log.error("发送获取到的动态数据", err)
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/* 检查动态是否满足要求 */
|
||||
await utils.try_for_each(protoLotteryInfo, async function ({
|
||||
await try_for_each(protoLotteryInfo, async function ({
|
||||
lottery_info_type, is_liked,
|
||||
uids, uname, dyid,
|
||||
uids, uname, dyid, create_time,
|
||||
ctrl, rid, des, type,
|
||||
hasOfficialLottery
|
||||
}) {
|
||||
/* 遇到转发过就退出 */
|
||||
if (is_liked) return false;
|
||||
|
||||
/* 超过指定时间退出 */
|
||||
if (now_ts - create_time > max_create_time * 86400) return false;
|
||||
|
||||
const
|
||||
/**判断是转发源动态还是现动态 */
|
||||
uid = lottery_info_type === 'uid' ? uids[1] : uids[0],
|
||||
@@ -252,7 +290,7 @@ class Monitor extends Searcher {
|
||||
|
||||
let
|
||||
/**转发评语 */
|
||||
RandomStr = utils.getRandomOne(config.relay),
|
||||
RandomStr = getRandomOne(config.relay),
|
||||
/**控制字段 */
|
||||
new_ctrl = [];
|
||||
|
||||
@@ -321,7 +359,9 @@ class Monitor extends Searcher {
|
||||
* @param {LotteryOptions} option
|
||||
* @returns {Promise<number>}
|
||||
* 0 - 成功
|
||||
* 9 - 评论黑名单/评论区关闭/动态删除
|
||||
* 11 - 评论错误
|
||||
* 19 - 关注黑名单
|
||||
* 21 - 关注错误
|
||||
* 22 - 关注异常
|
||||
* 31 - 转发失败
|
||||
@@ -332,53 +372,55 @@ class Monitor extends Searcher {
|
||||
log.info('NOT_GO_LOTTERY', 'ON');
|
||||
return 0
|
||||
}
|
||||
|
||||
const { uid, dyid, chat_type, rid, relay_chat, ctrl } = option;
|
||||
|
||||
/* 评论 */
|
||||
if (rid && chat_type) {
|
||||
let status = 0;
|
||||
const max_retry_times = 5;
|
||||
for (let times = 0; times < max_retry_times; times++) {
|
||||
status = await bili.sendChat(rid, utils.getRandomOne(config.chat), chat_type)
|
||||
if (status === -1) {
|
||||
log.warn('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
|
||||
return 0
|
||||
let status = 0
|
||||
const
|
||||
{ chat } = config,
|
||||
retry = [...new Array(5).keys()],
|
||||
max_retry_times = retry.length;
|
||||
await try_for_each(retry, async (times) => {
|
||||
status = await bili.sendChat(rid, getRandomOne(chat), chat_type)
|
||||
switch (status) {
|
||||
case 0:
|
||||
return true
|
||||
case -1:
|
||||
log.warn('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
|
||||
return true
|
||||
default:
|
||||
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
|
||||
log.info('自动评论', `将在 ${times + 1} 分钟后再次发送评论(${times + 1}/${max_retry_times})`)
|
||||
await delay(60 * 1000 * (times + 1))
|
||||
return false
|
||||
}
|
||||
if (!status) {
|
||||
break
|
||||
}
|
||||
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
|
||||
log.info('自动评论', `将在 ${times + 1} 分钟后再次发送评论(${times + 1}/${max_retry_times})`)
|
||||
await utils.delay(60 * 1000 * (times + 1))
|
||||
}
|
||||
if (status) return 11;
|
||||
})
|
||||
if (status) return 10 + status;
|
||||
}
|
||||
|
||||
/* 关注 */
|
||||
const [u1, u2] = uid
|
||||
if (u1) {
|
||||
let status = await bili.autoAttention(u1)
|
||||
if (status) {
|
||||
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
|
||||
return 20 + status
|
||||
};
|
||||
status = await bili.movePartition(u1, this.tagid)
|
||||
if (status) {
|
||||
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
|
||||
return 20 + status
|
||||
};
|
||||
if (u2) {
|
||||
utils.delay(5000)
|
||||
status = await bili.autoAttention(u2)
|
||||
if (status) {
|
||||
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
|
||||
return 20 + status
|
||||
};
|
||||
status = await bili.movePartition(u2, this.tagid)
|
||||
if (status) {
|
||||
log.error('抽奖信息', `uid: ${uid},dyid: ${dyid}`)
|
||||
return 20 + status
|
||||
};
|
||||
}
|
||||
if (uid.length) {
|
||||
let status = 0
|
||||
await try_for_each(uid, async (u) => {
|
||||
status = await bili.autoAttention(u)
|
||||
switch (status) {
|
||||
case 0:
|
||||
if (await bili.movePartition(u, this.tagid)) {
|
||||
log.error('抽奖信息', `uid: ${u},dyid: ${dyid}`)
|
||||
}
|
||||
return false
|
||||
case -1:
|
||||
case 2:
|
||||
log.warn('抽奖信息', `uid: ${u},dyid: ${dyid}`)
|
||||
return true
|
||||
default:
|
||||
log.error('抽奖信息', `uid: ${u},dyid: ${dyid}`)
|
||||
return true
|
||||
}
|
||||
})
|
||||
if (status) return 20 + status
|
||||
}
|
||||
|
||||
/* 点赞 */
|
||||
|
||||
+106
-31
@@ -1,6 +1,7 @@
|
||||
const utils = require('../utils');
|
||||
const bili = require('../net/bili');
|
||||
const config = require("../data/config");
|
||||
const { send } = require("../net/http");
|
||||
const { article_scan_page, not_check_article, get_dynamic_detail_wait, uid_scan_page, search_wait, tag_scan_page } = require("../data/config");
|
||||
|
||||
const { log } = utils
|
||||
|
||||
@@ -11,14 +12,14 @@ const { log } = utils
|
||||
* @property {number} uid
|
||||
* @property {string} uname
|
||||
* @property {boolean} is_liked
|
||||
* @property {number} createtime 10
|
||||
* @property {number} create_time 10
|
||||
* @property {string} rid_str
|
||||
* @property {string} dynamic_id
|
||||
* @property {number} type
|
||||
* @property {string} description
|
||||
* @property {boolean} hasOfficialLottery
|
||||
* @property {Array<Object.<string,string|number>>} ctrl
|
||||
*
|
||||
* @property {number} origin_create_time 10
|
||||
* @property {number} origin_uid
|
||||
* @property {string} origin_uname
|
||||
* @property {string} origin_rid_str
|
||||
@@ -27,6 +28,20 @@ const { log } = utils
|
||||
* @property {string} origin_description
|
||||
* @property {boolean} origin_hasOfficialLottery
|
||||
*
|
||||
* 整理后的抽奖信息
|
||||
* @typedef {object} LotteryInfo
|
||||
* @property {string} lottery_info_type
|
||||
* @property {number} create_time
|
||||
* @property {boolean} is_liked
|
||||
* @property {number[]} uids `[uid,ouid]`
|
||||
* @property {string} uname
|
||||
* @property {Array<{}>} ctrl
|
||||
* @property {string} dyid
|
||||
* @property {string} rid
|
||||
* @property {string} des
|
||||
* @property {number} type
|
||||
* @property {boolean} hasOfficialLottery 是否官方
|
||||
*
|
||||
* @param {object} dynamic_detail_card
|
||||
* @return {UsefulDynamicInfo}
|
||||
*/
|
||||
@@ -35,18 +50,18 @@ function parseDynamicCard(dynamic_detail_card) {
|
||||
/**临时储存单个动态中的信息 */
|
||||
let obj = {};
|
||||
const { desc, card, extension, extend_json } = dynamic_detail_card
|
||||
, { is_liked, user_profile } = desc
|
||||
, { info } = user_profile
|
||||
, { is_liked = 1, user_profile = {} } = desc
|
||||
, { info = {} } = user_profile
|
||||
, cardToJson = strToJson(card)
|
||||
, { item } = cardToJson;
|
||||
/* 转发者的UID */
|
||||
obj.uid = info.uid
|
||||
obj.uid = desc.uid
|
||||
/* 转发者的name */
|
||||
obj.uname = info.uname
|
||||
obj.uname = info.uname || ''
|
||||
/* 动态是否点过赞 */
|
||||
obj.is_liked = is_liked > 0
|
||||
/* 动态的ts10 */
|
||||
obj.createtime = desc.timestamp
|
||||
obj.create_time = desc.timestamp
|
||||
/* 动态类型 */
|
||||
obj.type = desc.type
|
||||
/* 用于发送评论 */
|
||||
@@ -65,6 +80,8 @@ function parseDynamicCard(dynamic_detail_card) {
|
||||
const { origin_extension, origin } = cardToJson
|
||||
, originToJson = strToJson(origin)
|
||||
, { user, item } = originToJson;
|
||||
/* 源动态的ts10 */
|
||||
obj.origin_create_time = desc.origin.timestamp;
|
||||
/* 被转发者的UID */
|
||||
obj.origin_uid = desc.origin.uid;
|
||||
/* 被转发者的rid(用于发评论) */
|
||||
@@ -131,20 +148,6 @@ function modifyDynamicRes(res) {
|
||||
*/
|
||||
class Searcher {
|
||||
constructor() { }
|
||||
/**
|
||||
* 整理后的抽奖信息
|
||||
* @typedef {object} LotteryInfo
|
||||
* @property {string} lottery_info_type
|
||||
* @property {boolean} is_liked
|
||||
* @property {number[]} uids `[uid,ouid]`
|
||||
* @property {string} uname
|
||||
* @property {Array<{}>} ctrl
|
||||
* @property {string} dyid
|
||||
* @property {string} rid
|
||||
* @property {string} des
|
||||
* @property {number} type
|
||||
* @property {boolean} hasOfficialLottery 是否官方
|
||||
*/
|
||||
/**
|
||||
* 检查指定用户的所有的动态信息
|
||||
* @param {number} hostuid 指定的用户UID
|
||||
@@ -215,7 +218,7 @@ class Searcher {
|
||||
*/
|
||||
async getLotteryInfoByUID(UID) {
|
||||
log.info('获取动态', `开始获取用户${UID}的动态信息`);
|
||||
const { allModifyDynamicResArray } = await Searcher.checkAllDynamic(UID, config.uid_scan_page, config.search_wait);
|
||||
const { allModifyDynamicResArray } = await Searcher.checkAllDynamic(UID, uid_scan_page, search_wait);
|
||||
|
||||
let { length } = allModifyDynamicResArray
|
||||
|
||||
@@ -234,17 +237,18 @@ class Searcher {
|
||||
const results = await pre
|
||||
, { origin_dynamic_id } = cur;
|
||||
|
||||
log.info('获取动态', `查看源动态(${origin_dynamic_id})的细节 (${length--})`)
|
||||
log.info('获取动态', `查看源动态(${origin_dynamic_id})是否点赞 (${length--})`)
|
||||
|
||||
const card = await bili.getOneDynamicByDyid(origin_dynamic_id)
|
||||
|
||||
if (card) {
|
||||
await utils.delay(2000)
|
||||
await utils.delay(get_dynamic_detail_wait)
|
||||
|
||||
const { is_liked } = parseDynamicCard(card)
|
||||
|
||||
return [...results, {
|
||||
lottery_info_type: 'uid',
|
||||
create_time: cur.origin_create_time,
|
||||
is_liked,
|
||||
uids: [cur.uid, cur.origin_uid],
|
||||
uname: cur.origin_uname,
|
||||
@@ -288,7 +292,7 @@ class Searcher {
|
||||
let mDRdata = modDR.modifyDynamicResArray;
|
||||
let next_offset = modDR.nextinfo.next_offset;
|
||||
|
||||
for (let index = 0; index < config.tag_scan_page; index++) {
|
||||
for (let index = 0; index < tag_scan_page; index++) {
|
||||
log.info('获取动态', `读取第${index + 1}页动态`);
|
||||
const
|
||||
newdy = await bili.getOneDynamicInfoByTag(tag_name, next_offset),
|
||||
@@ -299,11 +303,12 @@ class Searcher {
|
||||
mDRdata.push.apply(mDRdata, _modify.modifyDynamicResArray);
|
||||
next_offset = _modify.nextinfo.next_offset;
|
||||
|
||||
await utils.delay(config.search_wait);
|
||||
await utils.delay(search_wait);
|
||||
}
|
||||
const fomatdata = mDRdata.map(o => {
|
||||
return {
|
||||
lottery_info_type: 'tag',
|
||||
create_time: o.create_time,
|
||||
is_liked: o.is_liked,
|
||||
uids: [o.uid, o.origin_uid],
|
||||
uname: o.uname,
|
||||
@@ -326,7 +331,7 @@ class Searcher {
|
||||
*/
|
||||
async getLotteryInfoByArticle(key_words) {
|
||||
log.info('获取动态', `开始获取含关键词${key_words}的专栏信息`);
|
||||
const cvs = (await bili.searchArticlesByKeyword(key_words)).slice(0, config.article_scan_page);
|
||||
const cvs = (await bili.searchArticlesByKeyword(key_words)).slice(0, article_scan_page);
|
||||
|
||||
/**存储所有专栏中的dyid */
|
||||
let dyinfos = [];
|
||||
@@ -349,12 +354,12 @@ class Searcher {
|
||||
/**遍历某专栏中的dyids */
|
||||
for (const dyid of dyids_set) {
|
||||
if (dyid.length === utils.dyid_length) {
|
||||
log.info('获取动态', `查看专栏中所提及动态(${dyid})的细节 (${length--})`)
|
||||
log.info('获取动态', `查看专栏中所提及动态(${dyid})是否点赞 (${length--})`)
|
||||
|
||||
const card = await bili.getOneDynamicByDyid(dyid)
|
||||
|
||||
if (card) {
|
||||
await utils.delay(2000)
|
||||
await utils.delay(get_dynamic_detail_wait)
|
||||
|
||||
const parsed_card = parseDynamicCard(card)
|
||||
, { is_liked } = parsed_card;
|
||||
@@ -364,7 +369,7 @@ class Searcher {
|
||||
_weight += 1;
|
||||
}
|
||||
|
||||
if (_weight >= weight && !config.not_check_article) {
|
||||
if (_weight >= weight && !not_check_article) {
|
||||
log.warn('获取动态', `1/2动态曾经转过,该专栏或已查看,故中止`)
|
||||
_dyinfos = []
|
||||
break
|
||||
@@ -381,6 +386,7 @@ class Searcher {
|
||||
const fomatdata = dyinfos.map(o => {
|
||||
return {
|
||||
lottery_info_type: 'article',
|
||||
create_time: o.create_time,
|
||||
is_liked: o.is_liked,
|
||||
uids: [o.uid, o.origin_uid],
|
||||
uname: o.uname,
|
||||
@@ -396,6 +402,75 @@ class Searcher {
|
||||
|
||||
return fomatdata
|
||||
}
|
||||
|
||||
/**
|
||||
* 从特定格式的api响应数据中获取抽奖信息
|
||||
* @param {string} api
|
||||
* @returns {Promise<LotteryInfo[] | null>}
|
||||
*/
|
||||
getLotteryInfoByAPI(api) {
|
||||
return new Promise((resolve) => {
|
||||
if (api) {
|
||||
const { strToJson } = utils;
|
||||
log.info('获取动态', `开始获取链接(${api})中的抽奖信息`)
|
||||
send({
|
||||
url: api,
|
||||
config: {
|
||||
redirect: true
|
||||
},
|
||||
method: 'GET',
|
||||
success: ({ body }) => {
|
||||
if (body.err_msg) {
|
||||
log.error("从API响应数据中获取抽奖信息", body.err_msg)
|
||||
resolve(null)
|
||||
} else {
|
||||
const raw_lottery_info = strToJson(body).lottery_info;
|
||||
|
||||
if (raw_lottery_info) {
|
||||
let { length } = raw_lottery_info;
|
||||
if (length) {
|
||||
const lottery_info = raw_lottery_info
|
||||
.reduce(async (pre, cur) => {
|
||||
const results = await pre
|
||||
, { dyid } = cur;
|
||||
|
||||
log.info('获取动态', `查看动态(${dyid})是否点赞 (${length--})`)
|
||||
|
||||
const card = await bili.getOneDynamicByDyid(dyid)
|
||||
|
||||
if (card) {
|
||||
await utils.delay(get_dynamic_detail_wait)
|
||||
|
||||
const { is_liked } = parseDynamicCard(card)
|
||||
|
||||
cur.is_liked = is_liked
|
||||
|
||||
return [...results, cur]
|
||||
}
|
||||
|
||||
return results
|
||||
|
||||
}, Promise.resolve([]))
|
||||
|
||||
resolve(lottery_info)
|
||||
return
|
||||
}
|
||||
}
|
||||
log.error("从API响应数据中获取抽奖信息", "非Json数据或没有lottery_info或lottery为空")
|
||||
resolve(null)
|
||||
}
|
||||
},
|
||||
failure: err => {
|
||||
log.error("从API响应数据中获取抽奖信息", err)
|
||||
resolve(null)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
log.warn('获取动态', `链接为空`)
|
||||
resolve(null)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+325
-1
@@ -1,6 +1,327 @@
|
||||
const { config_file } = require('../utils');
|
||||
|
||||
const config = {
|
||||
/**
|
||||
* 监视更转的用户uid
|
||||
*/
|
||||
UIDs: [],
|
||||
|
||||
/**
|
||||
* 监视的专栏关键词
|
||||
*/
|
||||
Articles: [],
|
||||
|
||||
/**
|
||||
* 监视的tag
|
||||
*/
|
||||
TAGs: [],
|
||||
|
||||
/**
|
||||
* 从API接口中获取抽奖信息
|
||||
* @typedef {object} LotteryInfo
|
||||
* @property {string} lottery_info_type
|
||||
* @property {number} create_time
|
||||
* @property {boolean} is_liked
|
||||
* @property {number[]} uids `[uid,ouid]`
|
||||
* @property {string} uname
|
||||
* @property {Array<{}>} ctrl
|
||||
* @property {string} dyid
|
||||
* @property {string} rid
|
||||
* @property {string} des
|
||||
* @property {number} type
|
||||
* @property {boolean} hasOfficialLottery 是否官方
|
||||
* @typedef RespondBody
|
||||
* @property {string} err_msg 错误信息
|
||||
* @property {LotteryInfo[]} lottery_info
|
||||
* API传回数据类型 {RespondBody}
|
||||
* 获取抽奖信息的链接字符串
|
||||
*/
|
||||
APIs: [],
|
||||
|
||||
/**
|
||||
* API发送数据类型 {LotteryInfo[]}
|
||||
* 上传抽奖信息的链接字符串
|
||||
*/
|
||||
set_lottery_info_url: "",
|
||||
|
||||
/**
|
||||
* 动态中的关键词(表示须同时满足以下条件)
|
||||
* 符合js正则表达式的字符串
|
||||
*/
|
||||
key_words: [
|
||||
"[抽奖]",
|
||||
"[转关].*[转关]"
|
||||
],
|
||||
|
||||
/**
|
||||
* - '00' 关闭自动抽奖
|
||||
* - '10' 只转发官方抽奖
|
||||
* - '01' 只转发非官方抽奖
|
||||
* - '11' 都转
|
||||
*/
|
||||
model: '11',
|
||||
|
||||
/**
|
||||
* - '00'关闭自动评论
|
||||
* - '10'只评论官抽
|
||||
* - '01'只评论非官抽
|
||||
* - '11'都评论
|
||||
*/
|
||||
chatmodel: '01',
|
||||
|
||||
/**
|
||||
* - 动态创建时间
|
||||
* - 多少天前
|
||||
*/
|
||||
max_create_time: 60,
|
||||
|
||||
/**
|
||||
* 不加判断的转发所监视的uid转发的动态
|
||||
*/
|
||||
is_imitator: false,
|
||||
|
||||
/**
|
||||
* - 在uid里检索的页数
|
||||
*/
|
||||
uid_scan_page: 3,
|
||||
|
||||
/**
|
||||
* - 在tag里检索的页数
|
||||
*/
|
||||
tag_scan_page: 3,
|
||||
|
||||
/**
|
||||
* - 获取专栏数量
|
||||
*/
|
||||
article_scan_page: 3,
|
||||
|
||||
/**
|
||||
* - 不检查专栏是否看过,若选择检查可以提高检测效率
|
||||
* - 默认false(检查)
|
||||
*/
|
||||
not_check_article: false,
|
||||
|
||||
/**
|
||||
* - 开奖时间距离现在的最大天数
|
||||
* - 默认不限制
|
||||
*/
|
||||
maxday: Infinity,
|
||||
|
||||
/**
|
||||
* - 循环等待时间(指所有操作完毕后的休眠时间)
|
||||
* - 单位毫秒
|
||||
*/
|
||||
lottery_loop_wait: 0,
|
||||
check_loop_wait: 0,
|
||||
clear_loop_wait: 0,
|
||||
update_loop_wait: 0,
|
||||
|
||||
/**
|
||||
* - 转发间隔时间
|
||||
* - 单位毫秒
|
||||
* - 上下浮动50%
|
||||
*/
|
||||
wait: 30 * 1000,
|
||||
|
||||
/**
|
||||
* - 检索动态间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
search_wait: 2000,
|
||||
|
||||
/**
|
||||
* - 读取下一页私信间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
get_session_wait: 3000,
|
||||
|
||||
/**
|
||||
* - 已读私信间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
update_session_wait: 1000,
|
||||
|
||||
/**
|
||||
* - 读取下一页关注列表间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
get_partition_wait: 2000,
|
||||
|
||||
/**
|
||||
* - 获取动态细节间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
get_dynamic_detail_wait: 2000,
|
||||
|
||||
/**
|
||||
* - 过滤间隔(开奖时间/粉丝数)
|
||||
* - 单位毫秒
|
||||
*/
|
||||
filter_wait: 1000,
|
||||
|
||||
/**
|
||||
* - 随机动态间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
random_dynamic_wait: 2000,
|
||||
|
||||
/**
|
||||
* - up主粉丝数限制
|
||||
*/
|
||||
minfollower: 1000,
|
||||
|
||||
/**
|
||||
* - 只转发已关注的
|
||||
*/
|
||||
only_followed: false,
|
||||
|
||||
/**
|
||||
* - 是否发送随机动态(防止被开奖机过滤)
|
||||
*/
|
||||
create_dy: false,
|
||||
|
||||
/**
|
||||
* 随机动态类型
|
||||
* - 0 自定义文字与图片
|
||||
* - 1 推荐视频
|
||||
* - -1 混合
|
||||
*/
|
||||
create_dy_type: 0,
|
||||
|
||||
/**
|
||||
* - 结束运行时发送随机动态的数量
|
||||
*/
|
||||
create_dy_num: 1,
|
||||
|
||||
/**
|
||||
* - 随机动态内容
|
||||
* - 类型 `content[]`
|
||||
* @typedef Picture
|
||||
* @property {string} img_src 站内源
|
||||
* @property {number} img_width
|
||||
* @property {number} img_height
|
||||
* @param { string | Picture[] } content
|
||||
*/
|
||||
dy_contents: ['[doge]', '[doge][doge]'],
|
||||
|
||||
/**
|
||||
* - 每转发x条抽奖动态就发送x条随机动态
|
||||
* - @example [[10,11,9],[6,8,9]] 每转发9,10,11条抽奖动态就发送6,8,9条随机动态
|
||||
*/
|
||||
create_dy_mode: [[0], [0]],
|
||||
|
||||
/**
|
||||
* 转发时[at]的用户
|
||||
*/
|
||||
at_users: [['转发抽奖娘', 294887687], ['你的工具人老公', 100680137]],
|
||||
|
||||
/**
|
||||
* - 自动同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json
|
||||
* - 英文逗号分隔 如: 1,2,3
|
||||
*/
|
||||
blacklist: '',
|
||||
|
||||
/**
|
||||
* 屏蔽词
|
||||
*/
|
||||
blockword: ["脚本抽奖", "恭喜", "结果", "抽奖号", "钓鱼", "涨粉"],
|
||||
|
||||
/**
|
||||
* 转发评语
|
||||
*/
|
||||
relay: ['转发动态'],
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
chat: [
|
||||
'[OK]', '[星星眼]', '[歪嘴]', '[喜欢]', '[偷笑]', '[笑]', '[喜极而泣]', '[辣眼睛]', '[吃瓜]', '[奋斗]',
|
||||
'永不缺席 永不中奖 永不放弃!', '万一呢', '在', '冲吖~', '来了', '万一', '[保佑][保佑]', '从未中,从未停', '[吃瓜]', '[抠鼻][抠鼻]',
|
||||
'来力', '秋梨膏', '[呲牙]', '从不缺席', '分子', '可以', '恰', '不会吧', '1', '好',
|
||||
'rush', '来来来', 'ok', '冲', '凑热闹', '我要我要[打call]', '我还能中!让我中!!!', '大家都散了吧,已经抽完了,是我的', '我是天选之子', '给我中一次吧!',
|
||||
'坚持不懈,迎难而上,开拓创新!', '[OK][OK]', '我来抽个奖', '中中中中中中', '[doge][doge][doge]', '我我我',
|
||||
],
|
||||
|
||||
/**
|
||||
* - 抽奖UP用户分组id(网页端点击分区后地址栏中的tagid)
|
||||
* - 自动获取
|
||||
*/
|
||||
partition_id: 0,
|
||||
|
||||
/**
|
||||
* 是否关注异常
|
||||
*/
|
||||
is_exception: false,
|
||||
|
||||
/**
|
||||
* - 中奖通知关键词(满足一个就推送)
|
||||
* - 符合js正则表达式的字符串
|
||||
* - 若以 ~ 开头则表示为黑名单规则
|
||||
* - 优先级递增
|
||||
*/
|
||||
notice_key_words: [
|
||||
"~预约成功|预约主题",
|
||||
"中奖|获得|填写|写上|提供|收货地址|支付宝账号|码|大会员"
|
||||
],
|
||||
|
||||
/**
|
||||
* - 清理白名单uid或dyid
|
||||
* - 英文逗号分隔 如: 1,2,3
|
||||
*/
|
||||
clear_white_list: '',
|
||||
|
||||
/**
|
||||
* - 取关分区
|
||||
* - 默认为: 此处存放因抽奖临时关注的up
|
||||
*/
|
||||
clear_partition: '',
|
||||
|
||||
/**
|
||||
* 清理多少天之前的动态或关注
|
||||
*/
|
||||
clear_max_day: 30,
|
||||
|
||||
/**
|
||||
* - 快速移除关注
|
||||
* - 不加判断只去除关注
|
||||
*/
|
||||
clear_quick_remove_attention: false,
|
||||
|
||||
/**
|
||||
* 是否移除动态
|
||||
*/
|
||||
clear_remove_dynamic: true,
|
||||
|
||||
/**
|
||||
* 是否移除关注
|
||||
*/
|
||||
clear_remove_attention: true,
|
||||
|
||||
/**
|
||||
* 清除动态延时(毫秒)
|
||||
*/
|
||||
clear_remove_delay: 8000,
|
||||
|
||||
/**
|
||||
* 清除动态类型
|
||||
*
|
||||
* | 动态类型 | type值 |
|
||||
* | :------- |:----- |
|
||||
* | 无 | `0` |
|
||||
* | 转发 | `1` |
|
||||
* | 含图片 | `2` |
|
||||
* | 无图纯文字 | `4` |
|
||||
* | 视频 | `8` |
|
||||
* | 番剧 | `512` |
|
||||
* | 活动 | `2048` |
|
||||
* | 专栏 | `64` |
|
||||
*
|
||||
* @example
|
||||
* 1
|
||||
* [1,2,4]
|
||||
*/
|
||||
clear_dynamic_type: [1],
|
||||
|
||||
/**
|
||||
* 原始设置
|
||||
* @returns {Object}
|
||||
@@ -9,6 +330,7 @@ const config = {
|
||||
delete require.cache[config_file];
|
||||
return require(config_file)
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} n
|
||||
*/
|
||||
@@ -18,10 +340,12 @@ const config = {
|
||||
this.setObject(new_config)
|
||||
}
|
||||
},
|
||||
|
||||
init() {
|
||||
this.setObject(this.raw_config()["default_config"])
|
||||
},
|
||||
setObject(o) {
|
||||
|
||||
setObject(o = {}) {
|
||||
Object.entries(o).forEach(([k, v]) => this[k] = v)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { getRemoteConfig, createDir, createFile } = require("../utils");
|
||||
const { getRemoteConfig } = require("../utils");
|
||||
const config = require("../data/config");
|
||||
|
||||
const key_map = new Map([['DedeUserID', 'myUID'], ['bili_jct', 'csrf']]);
|
||||
@@ -15,9 +15,8 @@ let global_var = {
|
||||
* 全局变量初始化
|
||||
* 更新config
|
||||
* @param {string} cookie
|
||||
* @param {number} n
|
||||
*/
|
||||
async init(cookie, n) {
|
||||
async init(cookie) {
|
||||
if (cookie) {
|
||||
config.updata(process.env.NUMBER);
|
||||
|
||||
@@ -29,11 +28,12 @@ let global_var = {
|
||||
this.set(key_map.get(_item[0]), _item[1]);
|
||||
});
|
||||
|
||||
const { UIDs = [], TAGs = [], Articles = [] } = config;
|
||||
const { UIDs = [], TAGs = [], Articles = [], APIs = [] } = config;
|
||||
this.set('Lottery', [
|
||||
...UIDs.map(it => ['UIDs', it]),
|
||||
...TAGs.map(it => ['TAGs', it]),
|
||||
...Articles.map(it => ['Articles', it])
|
||||
...Articles.map(it => ['Articles', it]),
|
||||
...APIs.map(it => ['APIs', it])
|
||||
]);
|
||||
this.set('remoteconfig', await getRemoteConfig());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
const config = require("../data/config");
|
||||
const bili = require("../net/bili");
|
||||
const utils = require("../utils");
|
||||
|
||||
/**
|
||||
* 随机动态
|
||||
* @param {number} num
|
||||
* @returns
|
||||
*/
|
||||
async function randomDynamic(num) {
|
||||
const { create_dy_type, dy_contents, random_dynamic_wait } = config;
|
||||
|
||||
if (create_dy_type === -1 || create_dy_type === 0 || typeof create_dy_type === 'undefined') {
|
||||
for (let index = 0; index < num; index++) {
|
||||
await bili.createDynamic(utils.getRandomOne(dy_contents));
|
||||
await utils.delay(random_dynamic_wait);
|
||||
}
|
||||
}
|
||||
|
||||
if (create_dy_type === -1 || create_dy_type === 1) {
|
||||
let videos = await bili.getTopRcmd()
|
||||
for (let index = 0; videos.length < num; index++) {
|
||||
videos.push(...await bili.getTopRcmd())
|
||||
}
|
||||
|
||||
await utils.try_for_each(videos, async ([uid, aid]) => {
|
||||
if (num--) {
|
||||
await bili.shareVideo(uid, aid)
|
||||
await utils.delay(random_dynamic_wait)
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = { randomDynamic }
|
||||
+2
-6
@@ -1,10 +1,10 @@
|
||||
const utils = require('./utils');
|
||||
const bili = require('./net/bili');
|
||||
const event_bus = require('./helper/event_bus');
|
||||
const global_var = require('./data/global_var');
|
||||
const { Searcher } = require('./core/searcher');
|
||||
const { Monitor } = require('./core/monitor');
|
||||
const config = require('./data/config');
|
||||
const { randomDynamic } = require('./helper/randomDynamic');
|
||||
const { log } = utils;
|
||||
|
||||
async function createRandomDynamic(num) {
|
||||
@@ -12,10 +12,7 @@ async function createRandomDynamic(num) {
|
||||
log.info('随机动态', `准备创建${num}条随机动态`);
|
||||
const Dynamic = await Searcher.checkAllDynamic(global_var.get("myUID"), 1);
|
||||
if ((Dynamic.allModifyDynamicResArray[0] || { type: 0 }).type === 1) {
|
||||
for (let index = 0; index < num; index++) {
|
||||
await bili.createDynamic(utils.getRandomOne(config.dy_contents));
|
||||
await utils.delay(2000);
|
||||
}
|
||||
await randomDynamic(num)
|
||||
} else {
|
||||
log.info('随机动态', '已有非抽奖动态故无需创建');
|
||||
}
|
||||
@@ -39,7 +36,6 @@ function start() {
|
||||
return;
|
||||
}
|
||||
if (times.value() === lotterys.length) {
|
||||
await createRandomDynamic(config.create_dy_num);
|
||||
log.info('抽奖', '所有动态转发完毕');
|
||||
times.clear();
|
||||
event_bus.emit('Turn_off_the_Monitor', '目前无抽奖信息,过一会儿再来看看吧')
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
module.exports = Object.freeze({
|
||||
DYNAMIC_LIKE_THUMB: 'https://api.vc.bilibili.com/dynamic_like/v1/dynamic_like/thumb',
|
||||
DYNAMIC_REPOST_REPOST: 'https://api.vc.bilibili.com/dynamic_repost/v1/dynamic_repost/repost',
|
||||
DYNAMIC_REPOST_SHARE: 'https://api.vc.bilibili.com/dynamic_repost/v1/dynamic_repost/share',
|
||||
DYNAMIC_SVR_CREATE_DRAW: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create_draw',
|
||||
DYNAMIC_SVR_CREATE: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create',
|
||||
DYNAMIC_SVR_GET_DYNAMIC_DETAIL: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail',
|
||||
DYNAMIC_SVR_RM_DYNAMIC: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/rm_dynamic',
|
||||
DYNAMIC_SVR_SPACE_HISTORY: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history',
|
||||
FETCH_SESSION_MSGS: 'https://api.vc.bilibili.com/svr_sync/v1/svr_sync/fetch_session_msgs',
|
||||
FEED_GET_ATTENTION_LIST: 'https://api.vc.bilibili.com/feed/v1/feed/get_attention_list',
|
||||
FEED_SETUSERFOLLOW: 'https://api.vc.bilibili.com/feed/v1/feed/SetUserFollow',
|
||||
LOTTERY_SVR_LOTTERY_NOTICE: 'https://api.vc.bilibili.com/lottery_svr/v1/lottery_svr/lottery_notice',
|
||||
@@ -25,6 +27,7 @@ module.exports = Object.freeze({
|
||||
SESSION_SVR_UPDATE_ACK: 'https://api.vc.bilibili.com/session_svr/v1/session_svr/update_ack',
|
||||
SPACE_MYINFO: 'https://api.bilibili.com/x/space/myinfo',
|
||||
TAG_INFO: 'https://api.bilibili.com/x/tag/info',
|
||||
TOP_RCMD: "https://api.bilibili.com/x/web-interface/index/top/rcmd",
|
||||
TOPIC_SVR_TOPIC_HISTORY: 'https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_history',
|
||||
TOPIC_SVR_TOPIC_NEW: 'https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_new',
|
||||
WEB_INTERFACE_CARD: 'https://api.bilibili.com/x/web-interface/card',
|
||||
|
||||
+631
-509
File diff suppressed because it is too large
Load Diff
+5
-4
@@ -26,7 +26,7 @@
|
||||
* @property {string} url 完整链接
|
||||
* @property {boolean} [stream] 是否流式数据
|
||||
* @property {RequestConfig} [config] 设置
|
||||
* @property {string} [proxy] 代理 IP:PORT
|
||||
* @property {string} [proxy] HTTP代理 IP:PORT
|
||||
* @property {Object.<string, string|number>} [query] 查询选项
|
||||
* @property {Object.<string, string|number> | string} [contents] 内容
|
||||
* @property {HttpHeaders} [headers] 请求头
|
||||
@@ -65,11 +65,12 @@ function send(detail) {
|
||||
const { timeout, wait, retry, redirect, retry_times } = config;
|
||||
const thisURL = new URL(url)
|
||||
, content = formatContents(headers["content-type"], contents)
|
||||
, request = thisURL.protocol === 'https:' ? https_request : http_request;
|
||||
, request = (thisURL.protocol === 'https:') && !proxy ? https_request : http_request;
|
||||
let options = {
|
||||
timeout,
|
||||
method: method.toUpperCase(),
|
||||
host: thisURL.host,
|
||||
hostname: thisURL.hostname,
|
||||
port: thisURL.port,
|
||||
path: thisURL.pathname + thisURL.search + thisURL.hash,
|
||||
headers,
|
||||
};
|
||||
@@ -82,7 +83,7 @@ function send(detail) {
|
||||
if (proxy) {
|
||||
options.headers.host = thisURL.host;
|
||||
options.path = thisURL.href;
|
||||
[options.hostname, options.port] = proxy.split(':');
|
||||
[options.host, options.port] = proxy.split(':');
|
||||
}
|
||||
const req = request(options, res => {
|
||||
let protodata = '';
|
||||
|
||||
+18
-4
@@ -77,10 +77,10 @@ const utils = {
|
||||
},
|
||||
/**
|
||||
* 延时函数
|
||||
* @param {number} time ms
|
||||
* @param {number} [time] ms
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
delay(time) {
|
||||
delay(time = 1000) {
|
||||
utils.log.info('时延', `${~~time}ms`);
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
@@ -141,7 +141,7 @@ const utils = {
|
||||
return array;
|
||||
},
|
||||
/**
|
||||
* 关键词判断
|
||||
* 关键词判断 优先级递增
|
||||
* @param {string} text
|
||||
* @param {string[]} key_words startwith '~' 表示黑名单
|
||||
* @return {boolean}
|
||||
@@ -177,7 +177,21 @@ const utils = {
|
||||
* @param {String} [split] 分隔符
|
||||
*/
|
||||
proPrint(msg, split = ' ') {
|
||||
console.log([msg].flat().join(split))
|
||||
if (msg instanceof Array) {
|
||||
msg = msg.join(split)
|
||||
}
|
||||
console.log(msg)
|
||||
},
|
||||
/**
|
||||
* @param {Array<string>} msg
|
||||
* @returns
|
||||
*/
|
||||
rainbow(msg) {
|
||||
const
|
||||
colors = ['red', 'yellow', 'green', 'cyan', 'blue', 'magenta'],
|
||||
colorsCount = colors.length;
|
||||
|
||||
this.proPrint(msg.map(it => it.split('').map((l, i) => chalk[colors[i % colorsCount]](l)).join('')), '\n')
|
||||
},
|
||||
debug(context, msg) {
|
||||
if (this.level > 3) {
|
||||
|
||||
@@ -88,7 +88,8 @@ async function main() {
|
||||
return `提供了错误的[OPTIONS] -> ${mode}\n\n` + help_msg
|
||||
}
|
||||
} else {
|
||||
return 'Cookie已失效, 切换账号时不要点击退出账号而应直接删除Cookie退出'
|
||||
log.error('Cookie已失效', '切换账号时不要点击退出账号而应直接删除Cookie退出')
|
||||
return ''
|
||||
}
|
||||
} else {
|
||||
return '请查看README文件, 在env.js指定位置填入cookie'
|
||||
@@ -142,7 +143,7 @@ function initConfig() {
|
||||
}
|
||||
|
||||
(async function () {
|
||||
log.proPrint(metainfo, '\n')
|
||||
log.rainbow(metainfo)
|
||||
|
||||
if (initEnv() || initConfig()) return;
|
||||
|
||||
|
||||
+96
-10
@@ -28,6 +28,36 @@ module.exports = Object.freeze({
|
||||
'抽奖',
|
||||
],
|
||||
|
||||
/**
|
||||
* 从API接口中获取抽奖信息
|
||||
* @typedef {object} LotteryInfo
|
||||
* @property {string} lottery_info_type
|
||||
* @property {number} create_time
|
||||
* @property {boolean} is_liked
|
||||
* @property {number[]} uids `[uid,ouid]`
|
||||
* @property {string} uname
|
||||
* @property {Array<{}>} ctrl
|
||||
* @property {string} dyid
|
||||
* @property {string} rid
|
||||
* @property {string} des
|
||||
* @property {number} type
|
||||
* @property {boolean} hasOfficialLottery 是否官方
|
||||
* @typedef RespondBody
|
||||
* @property {string} err_msg 错误信息
|
||||
* @property {LotteryInfo[]} lottery_info
|
||||
* API传回数据类型 {RespondBody}
|
||||
* 获取抽奖信息的链接字符串
|
||||
* @example
|
||||
* "https://raw.fastgit.org/spiritLHL/sync_lottery/master/archive_datas/datas.json"
|
||||
*/
|
||||
APIs: [],
|
||||
|
||||
/**
|
||||
* API发送数据类型 {LotteryInfo[]}
|
||||
* 上传抽奖信息的链接字符串
|
||||
*/
|
||||
set_lottery_info_url: "",
|
||||
|
||||
/**
|
||||
* 动态中的关键词(表示须同时满足以下条件)
|
||||
* 符合js正则表达式的字符串
|
||||
@@ -53,6 +83,12 @@ module.exports = Object.freeze({
|
||||
*/
|
||||
chatmodel: '01',
|
||||
|
||||
/**
|
||||
* - 动态创建时间
|
||||
* - 多少天前
|
||||
*/
|
||||
max_create_time: 60,
|
||||
|
||||
/**
|
||||
* 不加判断的转发所监视的uid转发的动态
|
||||
*/
|
||||
@@ -105,7 +141,43 @@ module.exports = Object.freeze({
|
||||
* - 检索动态间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
search_wait: 1000,
|
||||
search_wait: 2000,
|
||||
|
||||
/**
|
||||
* - 读取下一页私信间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
get_session_wait: 3000,
|
||||
|
||||
/**
|
||||
* - 已读私信间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
update_session_wait: 1000,
|
||||
|
||||
/**
|
||||
* - 读取下一页关注列表间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
get_partition_wait: 2000,
|
||||
|
||||
/**
|
||||
* - 获取动态细节间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
get_dynamic_detail_wait: 2000,
|
||||
|
||||
/**
|
||||
* - 过滤间隔(开奖时间/粉丝数)
|
||||
* - 单位毫秒
|
||||
*/
|
||||
filter_wait: 1000,
|
||||
|
||||
/**
|
||||
* - 随机动态间隔
|
||||
* - 单位毫秒
|
||||
*/
|
||||
random_dynamic_wait: 2000,
|
||||
|
||||
/**
|
||||
* - up主粉丝数限制
|
||||
@@ -122,17 +194,19 @@ module.exports = Object.freeze({
|
||||
*/
|
||||
create_dy: false,
|
||||
|
||||
/**
|
||||
* 随机动态类型
|
||||
* - 0 自定义文字与图片
|
||||
* - 1 推荐视频
|
||||
* - -1 混合
|
||||
*/
|
||||
create_dy_type: 0,
|
||||
|
||||
/**
|
||||
* - 结束运行时发送随机动态的数量
|
||||
*/
|
||||
create_dy_num: 1,
|
||||
|
||||
/**
|
||||
* - 每转发x条抽奖动态就发送x条随机动态
|
||||
* - @example [6,1] 每转发6条抽奖动态就发送1条随机动态
|
||||
*/
|
||||
create_dy_mode: [0, 0],
|
||||
|
||||
/**
|
||||
* - 随机动态内容
|
||||
* - 类型 `content[]`
|
||||
@@ -144,6 +218,12 @@ module.exports = Object.freeze({
|
||||
*/
|
||||
dy_contents: ['[doge]', '[doge][doge]'],
|
||||
|
||||
/**
|
||||
* - 每转发x条抽奖动态就发送x条随机动态
|
||||
* - @example [[10,11,9],[6,8,9]] 每转发9,10,11条抽奖动态就发送6,8,9条随机动态
|
||||
*/
|
||||
create_dy_mode: [[0], [0]],
|
||||
|
||||
/**
|
||||
* 转发时[at]的用户
|
||||
*/
|
||||
@@ -191,10 +271,11 @@ module.exports = Object.freeze({
|
||||
* - 中奖通知关键词(满足一个就推送)
|
||||
* - 符合js正则表达式的字符串
|
||||
* - 若以 ~ 开头则表示为黑名单规则
|
||||
* - 优先级递增
|
||||
*/
|
||||
notice_key_words: [
|
||||
"中奖|获得|填写|写上|提供|收货地址|支付宝账号|码|大会员",
|
||||
"~有奖预约通知"
|
||||
"~预约成功|预约主题",
|
||||
"中奖|获得|填写|写上|提供|收货地址|支付宝账号|码|大会员"
|
||||
],
|
||||
|
||||
/**
|
||||
@@ -245,10 +326,15 @@ module.exports = Object.freeze({
|
||||
* | 含图片 | `2` |
|
||||
* | 无图纯文字 | `4` |
|
||||
* | 视频 | `8` |
|
||||
* | 番剧 | `512` |
|
||||
* | 活动 | `2048` |
|
||||
* | 专栏 | `64` |
|
||||
*
|
||||
* @example
|
||||
* 1
|
||||
* [1,2,4]
|
||||
*/
|
||||
clear_dynamic_type: 1
|
||||
clear_dynamic_type: [1]
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lottery-auto-script",
|
||||
"version": "2.2.1",
|
||||
"version": "2.3.2",
|
||||
"description": "自动参与B站动态抽奖",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
@@ -45,11 +45,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/shanmiteko/AutoScript#readme",
|
||||
"devDependencies": {
|
||||
"eslint": "^7.17.0",
|
||||
"pkg": "^5.2.1"
|
||||
"eslint": "^8.1.0",
|
||||
"pkg": "^5.4.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^4.1.1",
|
||||
"nodemailer": "^6.5.0"
|
||||
"chalk": "^4.1.2",
|
||||
"nodemailer": "^6.7.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
./lottery update
|
||||
|
||||
if [[ -r "latest_version.zip" ]]; then
|
||||
unzip latest_version.zip
|
||||
rm latest_version.zip
|
||||
chmod u+x lottery
|
||||
fi
|
||||
Reference in New Issue
Block a user