mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-07-22 21:13:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6adc42ae23 | ||
|
|
588feba10b | ||
|
|
5d5858f82b | ||
|
|
1526519e86 | ||
|
|
69c297ecaa | ||
|
|
201770573e | ||
|
|
16c113fd87 | ||
|
|
50887948b4 | ||
|
|
54af8444db | ||
|
|
b568208990 | ||
|
|
62768ddc71 | ||
|
|
101df0a7a6 | ||
|
|
f8829b5d4b | ||
|
|
be6552a321 | ||
|
|
83e19d44e3 | ||
|
|
c238c27d7d | ||
|
|
8addc9078d | ||
|
|
288851b491 | ||
|
|
ddcfceecef |
@@ -1,5 +1,36 @@
|
||||
<!-- markdownlint-disable MD036 MD024-->
|
||||
# CHANGELOG
|
||||
## 主要变化(2.8.9)
|
||||
* 588feba docs: update readme
|
||||
* 5d5858f fix: 无法已读未关注未读私信
|
||||
* 1526519 docs: 添加gotify推送说明
|
||||
* 69c297e feat: 添加Gotify推送
|
||||
* 2017705 feat: autoAttention API增加对重复关注的处理
|
||||
* 16c113f docs: update readme
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.8)
|
||||
* 54af844 fix: 专栏无法获取
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.7)
|
||||
* 62768dd fix: 修改win脚本
|
||||
* 101df0a fix: login等待时间过长
|
||||
* f8829b5 fix: 清理动态检索动态延时
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.6)
|
||||
* 83e19d4 docs: 扫码登陆使用说明
|
||||
* c238c27 fix:多账号login添加时延进行间隔
|
||||
* 8addc90 fix:登录跳过执行正常状态的账号
|
||||
* 288851b feat: 扫码登录获取移动端的CK更新账号,带sid可减小掉号频率
|
||||
* ddcfcee fix: 移除公共黑名单设置
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.8.5)
|
||||
* 0024b19 feat: 移除远程设置启用自动更新
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
- [AutoScript](#autoscript)
|
||||
- [操作步骤](#操作步骤)
|
||||
- [获取COOKIE](#获取cookie)
|
||||
- [扫码登陆](#扫码登陆)
|
||||
- [手动获取](#手动获取)
|
||||
- [本地运行](#本地运行)
|
||||
- [可执行文件](#可执行文件)
|
||||
- [以源码方式运行](#以源码方式运行)
|
||||
@@ -54,6 +56,14 @@
|
||||
|
||||
### 获取COOKIE
|
||||
|
||||
#### 扫码登陆
|
||||
|
||||
在`env.js`文件填`COOKIE`的对应位置写入`"DedeUserID=你的UID"`即可使用`lottery login`扫码自动获取Cookie
|
||||
|
||||
`COOKIE`中包含`DedeUserID=你的UID`的都会被自动替换
|
||||
|
||||
#### 手动获取
|
||||
|
||||
进入[B站主页](https://www.bilibili.com/)获取Cookie用于登录
|
||||
|
||||
Chrome浏览器:
|
||||
@@ -122,11 +132,12 @@ buvid3亦可不填 使用随机生成值
|
||||
acount 查看帐号信息
|
||||
clear 清理动态和关注
|
||||
update 检查更新
|
||||
login 扫码登录更新CK
|
||||
help 帮助信息
|
||||
```
|
||||
|
||||
1. 运行截图
|
||||

|
||||

|
||||
|
||||
#### 以源码方式运行
|
||||
|
||||
@@ -192,6 +203,8 @@ buvid3亦可不填 使用随机生成值
|
||||
| `SMTP_USER` | 电子邮件 | 发送方的电子邮件 如: `xxxxxxxxx@qq.com` |
|
||||
| `SMTP_PASS` | 电子邮件 | smtp服务对应的授权码 |
|
||||
| `SMTP_TO_USER` | 电子邮件 | 接收方电子邮件 |
|
||||
| `GOTIFY_URL` | gotify推送 | gotify消息推送地址(例如 http://localhost:8008/message),[官方文档](https://gotify.net/docs/) |
|
||||
| `GOTIFY_APPKEY` | gotify推送 | 一个gotify application的token,[官方文档](https://gotify.net/docs/) |
|
||||
|
||||
----------------------------------------
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
1.初始化
|
||||
|
||||
```bash
|
||||
curl -fsSL https://cdn.staticaly.com/gh/shanmiteko/LotteryAutoScript/main/script/docker/init.sh | sudo sh
|
||||
curl -fsSL https://ghproxy.com/https://raw.githubusercontent.com/shanmiteko/LotteryAutoScript/main/script/docker/init.sh | sudo bash
|
||||
```
|
||||
|
||||
进入`lottery`文件夹
|
||||
|
||||
+7
-5
@@ -12,12 +12,12 @@ module.exports = Object.freeze({
|
||||
* ## 调试相关
|
||||
* - `LOTTERY_LOG_LEVEL` 输出日志等级 Error<Warn<Info<Debug 1<2<3<4
|
||||
* - `NOT_GO_LOTTERY` 关闭抽奖行为
|
||||
*
|
||||
*
|
||||
* ## 多账号
|
||||
* 1. 将 ENABLE_MULTIPLE_ACCOUNT 的值改为true
|
||||
* 2. 将账号信息依次填写于 multiple_account_parm 中, 参考例子类推
|
||||
* - `WAIT` 表示下一个账号运行等待时间(毫秒)
|
||||
*
|
||||
*
|
||||
* **按顺序依次执行, 防止访问频繁封禁IP**
|
||||
*/
|
||||
account_parm: {
|
||||
@@ -37,7 +37,7 @@ module.exports = Object.freeze({
|
||||
/**
|
||||
* 为防止环境变量过长, 请将多账号填在此处
|
||||
* 以 **大括号内容** 为模板依次复制(包含大括号),逗号分割
|
||||
*
|
||||
*
|
||||
* ```txt
|
||||
* [
|
||||
* {
|
||||
@@ -92,6 +92,8 @@ module.exports = Object.freeze({
|
||||
SMTP_PORT: "",
|
||||
SMTP_USER: "",
|
||||
SMTP_PASS: "",
|
||||
SMTP_TO_USER: ""
|
||||
SMTP_TO_USER: "",
|
||||
GOTIFY_URL: "",
|
||||
GOTIFY_APPKEY: ""
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
+1
-2
@@ -84,12 +84,11 @@ async function isMe(num) {
|
||||
}
|
||||
if (follow_unread) {
|
||||
log.info('中奖检测', '<-- 正在检查已关注者的私信')
|
||||
await check(1)
|
||||
}
|
||||
if (unfollow_unread) {
|
||||
log.info('中奖检测', '<-- 正在检查未关注者的私信')
|
||||
await check(2)
|
||||
}
|
||||
await check("1")
|
||||
log.info('中奖检测', '--> OK');
|
||||
}
|
||||
if (desp) {
|
||||
|
||||
@@ -108,6 +108,7 @@ async function clear() {
|
||||
log.error("清理失败", "出现错误")
|
||||
break
|
||||
}
|
||||
|
||||
/* 延时 */
|
||||
await delay(clear_remove_delay);
|
||||
} else {
|
||||
@@ -124,6 +125,8 @@ async function clear() {
|
||||
log.info('清理动态', `此动态类型为${type} != 要清理的动态类型${clear_dynamic_type}`)
|
||||
}
|
||||
}
|
||||
/* 延时 */
|
||||
await delay(clear_remove_delay);
|
||||
log.info('清理动态', `第${page + 1}页(${allModifyDynamicResArray.length})中的转发动态与关注全部处理成功`)
|
||||
if (next_offset === '0' || !success) break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ class Monitor extends Searcher {
|
||||
event_bus.emit('Turn_off_the_Monitor', '关注出错')
|
||||
break;
|
||||
case 3001:
|
||||
event_bus.emit('Turn_off_the_Monitor', '分区移动出错')
|
||||
event_bus.emit('Turn_off_the_Monitor', '分区移动出错 可于设置处关闭移动分区')
|
||||
break;
|
||||
case 2004:
|
||||
case 4005:
|
||||
|
||||
@@ -305,12 +305,6 @@ const config = {
|
||||
*/
|
||||
blacklist: '',
|
||||
|
||||
/**
|
||||
* - 自动同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json
|
||||
* - 使用公共黑名单
|
||||
*/
|
||||
use_public_blacklist: true,
|
||||
|
||||
/**
|
||||
* 屏蔽词
|
||||
*/
|
||||
|
||||
+53
-2
@@ -80,6 +80,13 @@ let SMTP_USER = '';
|
||||
let SMTP_PASS = '';
|
||||
let SMTP_TO_USER = '';
|
||||
|
||||
// ====================================Gotify======================================
|
||||
// 官方文档:https://gotify.net/docs/pushmsg
|
||||
// 此处填你的Gotify消息推送地址(例如:http://localhost/message)
|
||||
let GOTIFY_URL = '';
|
||||
// 此处填你想推送的Application的Token(不包含推送时额外添加的前缀 Bearer )
|
||||
let GOTIFY_APPKEY = '';
|
||||
|
||||
//==========================云端环境变量的判断与接收=========================
|
||||
if (process.env.SCKEY) {
|
||||
SCKEY = process.env.SCKEY;
|
||||
@@ -190,6 +197,13 @@ if (process.env.SMTP_TO_USER) {
|
||||
SMTP_TO_USER = process.env.SMTP_TO_USER;
|
||||
}
|
||||
|
||||
if (process.env.GOTIFY_URL) {
|
||||
GOTIFY_URL = process.env.GOTIFY_URL;
|
||||
if (process.env.GOTIFY_APPKEY) {
|
||||
GOTIFY_APPKEY = process.env.GOTIFY_APPKEY
|
||||
}
|
||||
}
|
||||
|
||||
//==========================云端环境变量的判断与接收=========================
|
||||
|
||||
async function sendNotify(text, desp, params = {}) {
|
||||
@@ -223,7 +237,9 @@ async function sendNotify(text, desp, params = {}) {
|
||||
// Qmsg
|
||||
qmsg(text, desp),
|
||||
//电子邮件
|
||||
email(text, desp)
|
||||
email(text, desp),
|
||||
// Gotify
|
||||
gotifyNotify(text, desp)
|
||||
])
|
||||
}
|
||||
|
||||
@@ -820,6 +836,41 @@ function pushPlusNotify(text, desp) {
|
||||
})
|
||||
}
|
||||
|
||||
function gotifyNotify(text, desp) {
|
||||
return new Promise(resolve => {
|
||||
if (GOTIFY_APPKEY) {
|
||||
send({
|
||||
method: 'POST',
|
||||
url: GOTIFY_URL,
|
||||
contents: {
|
||||
title: text,
|
||||
message: desp,
|
||||
},
|
||||
config: {
|
||||
retry: false
|
||||
},
|
||||
headers: {
|
||||
accept: 'application/json, text/plain, */*',
|
||||
'content-type': 'application/json',
|
||||
'authorization': 'Bearer ' + GOTIFY_APPKEY
|
||||
},
|
||||
success: () => {
|
||||
// HTTP 响应码 200 就说明成功了
|
||||
log.info('发送通知', 'Gotify 发送通知消息成功')
|
||||
resolve();
|
||||
},
|
||||
failure: err => {
|
||||
log.error('发送通知', 'Gotify 发送通知调用API失败!!' + err)
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
log.debug('发送通知', '您未提供Gotify推送所需的GOTIFY_APPKEY,取消Gotify推送消息通知');
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function qmsg(text, desp) {
|
||||
return new Promise(resolve => {
|
||||
if (QMSG_KEY) {
|
||||
@@ -889,4 +940,4 @@ async function email(text, desp) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { sendNotify }
|
||||
module.exports = { sendNotify }
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
const { login } = require('./login');
|
||||
const { isMe } = require('./check');
|
||||
const { clear } = require('./clear');
|
||||
const { start } = require('./lottery');
|
||||
@@ -24,4 +25,4 @@ async function checkCookie(num) {
|
||||
}
|
||||
|
||||
|
||||
module.exports = { start, isMe, clear, checkCookie, account }
|
||||
module.exports = { login, start, isMe, clear, checkCookie, account }
|
||||
@@ -0,0 +1,58 @@
|
||||
const { readFileSync, writeFileSync } = require('fs');
|
||||
const { log, env_file } = require("./utils");
|
||||
|
||||
/**
|
||||
* 扫码登陆
|
||||
* @param {string} num
|
||||
*/
|
||||
async function login(num) {
|
||||
try {
|
||||
const { pcLogin } = require('@catlair/blogin');
|
||||
const loginInfo = await pcLogin();
|
||||
if (!loginInfo) {
|
||||
log.error("扫码登陆", "失败/取消");
|
||||
return;
|
||||
}
|
||||
log.info("扫码登陆", "登录成功");
|
||||
JSON.stringify(loginInfo, null, 2);
|
||||
const uid = `${loginInfo.mid}`;
|
||||
const cookie = `${loginInfo.cookie}`;
|
||||
log.info("账号UID", uid);
|
||||
log.info("Cookie", cookie);
|
||||
if (replaceCookie(env_file, uid, cookie)) {
|
||||
log.info("扫码登陆", `账号${num}已进行cookie自动更新,如未能生效请手动复制在env.js内替换。路径:${env_file}`);
|
||||
}
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 正则检索uid更新cookie
|
||||
* @param {string} filePath
|
||||
* @param {string} uid
|
||||
* @param {string} oldCK
|
||||
*/
|
||||
function replaceCookie(filePath, uid, oldCK) {
|
||||
try {
|
||||
const content = readFileSync(filePath, 'utf-8');
|
||||
const DedeUserID = `DedeUserID=${uid}`;
|
||||
const reg = new RegExp(`['"]?COOKIE['"]?:\\s?['"](.*${DedeUserID}.*)['"]`, 'g');
|
||||
const newCK = content.replaceAll(reg, substring => {
|
||||
let quote = substring.at(0) || '';
|
||||
/['"]/.test(quote) || (quote = '');
|
||||
const quote2 = oldCK.includes("'")
|
||||
? '"'
|
||||
: substring.match(/^['"]?COOKIE['"]?:\s?(['"])/)?.[1] || '"';
|
||||
return `${quote}COOKIE${quote}: ${quote2}${oldCK}${quote2}`;
|
||||
});
|
||||
if (content === newCK) return false;
|
||||
writeFileSync(filePath, newCK);
|
||||
return true;
|
||||
} catch (error) {
|
||||
log.error("扫码登陆", error);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = { login }
|
||||
+1
-1
@@ -20,7 +20,7 @@ module.exports = Object.freeze({
|
||||
MSGFEED_AT: 'https://api.bilibili.com/x/msgfeed/at',
|
||||
MSGFEED_REPLAY: 'https://api.bilibili.com/x/msgfeed/reply',
|
||||
MSGFEED_UNREAD: 'https://api.bilibili.com/x/msgfeed/unread',
|
||||
READ_CV: 'https://www.bilibili.com/read/cv{{cv}}',
|
||||
READ_CV: 'https://www.bilibili.com/read/cv{{cv}}/',
|
||||
RELATION_BATCH_MODIFY: 'https://api.bilibili.com/x/relation/batch/modify',
|
||||
RELATION_MODIFY: 'https://api.bilibili.com/x/relation/modify',
|
||||
RELATION_STAT: 'https://api.bilibili.com/x/relation/stat',
|
||||
|
||||
+25
-22
@@ -259,11 +259,11 @@ const bili_client = {
|
||||
* @property {number} sender_uid
|
||||
* @property {number} talker_id
|
||||
* @property {number} msg_seqno
|
||||
*
|
||||
*
|
||||
* @typedef SessionInfo
|
||||
* @property {number} has_more
|
||||
* @property {SessionData[]} data
|
||||
*
|
||||
*
|
||||
* @param {number} session_type 1 已关注 2 未关注 3 应援团
|
||||
* @param {string} [ts_16]
|
||||
* @returns {Promise<SessionInfo>}
|
||||
@@ -397,7 +397,7 @@ const bili_client = {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @param {string} short_id
|
||||
* @param {string} short_id
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async shortDynamicIdToDyid(short_id) {
|
||||
@@ -737,6 +737,8 @@ const bili_client = {
|
||||
return [false, 4, '账号异常']
|
||||
case 22009:
|
||||
return [false, 5, '关注已达上限']
|
||||
case 22014:
|
||||
return [false, 6, '已经关注用户,无法重复关注']
|
||||
default:
|
||||
return [true, 1, `未知错误\n${responseText}`]
|
||||
}
|
||||
@@ -748,12 +750,13 @@ const bili_client = {
|
||||
* @param {Number} uid
|
||||
* 被关注者的UID
|
||||
* @returns {Promise<number>}
|
||||
* - 成功 0
|
||||
* - 未知错误 1
|
||||
* - 您已被对方拉入黑名单 2
|
||||
* - 黑名单用户无法关注 3
|
||||
* - 账号异常 4
|
||||
* - 关注已达上限 5
|
||||
* - 成功 0
|
||||
* - 未知错误 1
|
||||
* - 您已被对方拉入黑名单 2
|
||||
* - 黑名单用户无法关注 3
|
||||
* - 账号异常 4
|
||||
* - 关注已达上限 5
|
||||
* - 已经关注用户 6
|
||||
*/
|
||||
autoAttention(uid) {
|
||||
return this._autoAttention.run(uid)
|
||||
@@ -763,8 +766,8 @@ const bili_client = {
|
||||
* @param {number} uid
|
||||
* @param {number} tagid 关注分区的ID
|
||||
* @returns {Promise<number>}
|
||||
* - 成功 0
|
||||
* - 失败 1
|
||||
* - 成功 0
|
||||
* - 失败 1
|
||||
*/
|
||||
async movePartition(uid, tagid) {
|
||||
const responseText = await post({
|
||||
@@ -816,7 +819,7 @@ const bili_client = {
|
||||
* 动态自动点赞
|
||||
* @param {string} dyid
|
||||
* @returns {Promise<number>}
|
||||
* - 成功 0
|
||||
* - 成功 0
|
||||
* - 未知错误 1
|
||||
* - 点赞异常 2
|
||||
* - 点赞频繁 3
|
||||
@@ -865,11 +868,11 @@ const bili_client = {
|
||||
* @param {string} [msg]
|
||||
* 动态的ID
|
||||
* @returns {Promise<number>}
|
||||
* - 成功 0
|
||||
* - 未知错误 1
|
||||
* - 该动态不能转发分享 2
|
||||
* - 请求数据发生错误,请刷新或稍后重试 3
|
||||
* - 操作太频繁了,请稍后重试 4
|
||||
* - 成功 0
|
||||
* - 未知错误 1
|
||||
* - 该动态不能转发分享 2
|
||||
* - 请求数据发生错误,请刷新或稍后重试 3
|
||||
* - 操作太频繁了,请稍后重试 4
|
||||
*/
|
||||
async autoRelay(uid, dyid, msg = '转发动态', ctrl = '[]') {
|
||||
const len = msg.length;
|
||||
@@ -912,7 +915,7 @@ const bili_client = {
|
||||
/**
|
||||
* 预约抽奖
|
||||
* @param {string} reserve_id
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
async reserve_lottery(reserve_id) {
|
||||
const
|
||||
@@ -1238,9 +1241,9 @@ const bili_client = {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 检查分区
|
||||
* 不存在指定分区时创建
|
||||
* 获取到tagid添加为对象的属性
|
||||
* 检查分区
|
||||
* 不存在指定分区时创建
|
||||
* 获取到tagid添加为对象的属性
|
||||
* @param {string} [name]
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
@@ -1332,4 +1335,4 @@ const bili_client = {
|
||||
};
|
||||
|
||||
|
||||
module.exports = bili_client
|
||||
module.exports = bili_client
|
||||
|
||||
@@ -16,6 +16,9 @@ const metainfo = [
|
||||
let multiple_account = [];
|
||||
/**循环等待时间 */
|
||||
let loop_wait = 0;
|
||||
/**账号状态标记 1正常 -1失效 */
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let ck_flag = 0
|
||||
|
||||
/**
|
||||
* @returns {Promise<string>} 错误信息
|
||||
@@ -38,7 +41,11 @@ async function main() {
|
||||
if (err_msg) {
|
||||
return err_msg
|
||||
} else {
|
||||
await delay(acco.WAIT);
|
||||
if (ck_flag === 1) {
|
||||
await delay(acco.WAIT);
|
||||
} else {
|
||||
await delay(3 * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,15 +56,16 @@ async function main() {
|
||||
await global_var.init(COOKIE, NUMBER);
|
||||
|
||||
/**引入基础功能 */
|
||||
const { start, isMe, clear, account, checkCookie } = require("./lib/index");
|
||||
const { start, isMe, clear, account, checkCookie, login } = require("./lib/index");
|
||||
|
||||
log.info('main', '当前为第' + NUMBER + '个账号');
|
||||
log._cache.length = 0
|
||||
|
||||
const mode = process.env.lottery_mode;
|
||||
const help_msg = "用法: lottery [OPTIONS]\n\nOPTIONS:\n\tstart 启动抽奖\n\tcheck 中奖检查\n\tacount 查看帐号信息\n\tclear 清理动态和关注\n\tlogin 扫码登录更新CK\n\tupdate 检查更新\n\thelp 帮助信息";
|
||||
if (await checkCookie(NUMBER)) {
|
||||
const mode = process.env.lottery_mode;
|
||||
const help_msg = "用法: lottery [OPTIONS]\n\nOPTIONS:\n\tstart 启动抽奖\n\tcheck 中奖检查\n\tacount 查看帐号信息\n\tclear 清理动态和关注\n\tupdate 检查更新\n\thelp 帮助信息";
|
||||
const { lottery_loop_wait, check_loop_wait, clear_loop_wait, save_lottery_info_to_file } = require("./lib/data/config");
|
||||
ck_flag = 1;
|
||||
switch (mode) {
|
||||
case 'start':
|
||||
log.info('抽奖', '开始运行');
|
||||
@@ -79,6 +87,9 @@ async function main() {
|
||||
await clear();
|
||||
}
|
||||
break;
|
||||
case 'login':
|
||||
log.info('登录状态', '正常,跳过扫码');
|
||||
break;
|
||||
case 'help':
|
||||
return help_msg
|
||||
case 'account':
|
||||
@@ -92,7 +103,12 @@ async function main() {
|
||||
}
|
||||
} else {
|
||||
log.error('Cookie已失效', '切换账号时不要点击退出账号而应直接删除Cookie退出')
|
||||
return
|
||||
ck_flag = -1;
|
||||
if (mode === "login") {
|
||||
log.info('登陆', '开始扫码');
|
||||
await login(NUMBER);
|
||||
await delay(1000);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return '请查看README文件, 在env.js指定位置填入cookie'
|
||||
@@ -174,7 +190,7 @@ function initConfig() {
|
||||
if (initEnv() || initConfig()) return;
|
||||
await main()
|
||||
}
|
||||
log.info('结束运行', '未在config.js中设置休眠时间')
|
||||
log.info('结束运行', '未在my_config.js中设置休眠时间')
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
|
||||
@@ -310,12 +310,6 @@ module.exports = Object.freeze({
|
||||
*/
|
||||
blacklist: '',
|
||||
|
||||
/**
|
||||
* - 自动同步 https://gitee.com/shanmite/lottery-notice/raw/master/notice.json
|
||||
* - 使用公共黑名单
|
||||
*/
|
||||
use_public_blacklist: true,
|
||||
|
||||
/**
|
||||
* 屏蔽词
|
||||
*/
|
||||
|
||||
+4
-2
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"name": "lottery-auto-script",
|
||||
"version": "2.8.5",
|
||||
"version": "2.8.9",
|
||||
"description": "自动参与B站动态抽奖",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"login": "node main.js login",
|
||||
"start": "node main.js start",
|
||||
"test": "node test/index.js",
|
||||
"clear": "node main.js clear",
|
||||
@@ -46,6 +47,7 @@
|
||||
"chalk": "^4.1.2",
|
||||
"http-proxy-agent": "^7.0.0",
|
||||
"https-proxy-agent": "^7.0.0",
|
||||
"nodemailer": "^6.7.0"
|
||||
"nodemailer": "^6.7.0",
|
||||
"@catlair/blogin": "^0.0.8"
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -12,7 +12,8 @@ TARGET_DIR="dist"
|
||||
BIN_NAME="lottery"
|
||||
|
||||
create_win_bat() {
|
||||
echo "@echo off && lottery $1 && pause"
|
||||
echo "set NODE_SKIP_PLATFORM_CHECK=1" >>$2
|
||||
echo "lottery $1 & pause" >>$2
|
||||
}
|
||||
|
||||
if [ -d "$TARGET_DIR" ]; then
|
||||
@@ -49,9 +50,9 @@ for file in "$TARGET_DIR/"*; do
|
||||
cp $TEMPLATE_CONFIG_FILE "$TMPDIR.d/$CONFIG_FILE"
|
||||
cp $TEMPLATE_ENV_FILE "$TMPDIR.d/$ENV_FILE"
|
||||
if [ "$(echo $file | grep '.exe')" ]; then
|
||||
BATS=("start" "check" "clear" "account" "update")
|
||||
BATS=("start" "check" "clear" "account" "update" "login")
|
||||
for item in "${BATS[@]}"; do
|
||||
create_win_bat "${item}" >"$TMPDIR.d/$item.bat"
|
||||
create_win_bat "${item}" "$TMPDIR.d/$item.bat"
|
||||
done
|
||||
mv "$TMPDIR.d/$BIN_NAME" "$TMPDIR.d/$BIN_NAME.exe"
|
||||
else
|
||||
|
||||
@@ -188,3 +188,25 @@ docker image rm -f shanmite/lottery_auto_docker
|
||||
echo "see you next time!"
|
||||
EOF
|
||||
chmod +x remove_all.sh
|
||||
|
||||
echo "create login.sh"
|
||||
cat >login.sh <<EOF
|
||||
#!$(which env) bash
|
||||
NAME=shanmite-lottery-login
|
||||
if [[ -z "\$(docker ps -a | grep \$NAME)" ]]; then
|
||||
docker run \\
|
||||
-v $PWD/$ENV_FILE:/lottery/$ENV_FILE \\
|
||||
-v $PWD/$CONFIG_FILE:/lottery/$CONFIG_FILE \\
|
||||
--network host \\
|
||||
--name \$NAME \\
|
||||
$DOCKER_REPO \\
|
||||
login
|
||||
else
|
||||
echo "container \$NAME already existed"
|
||||
echo "history logs -> docker logs \$NAME"
|
||||
echo "close this -> docker stop \$NAME"
|
||||
echo "login \$NAME"
|
||||
docker login \$NAME
|
||||
fi
|
||||
EOF
|
||||
chmod +x login.sh
|
||||
@@ -40,6 +40,7 @@ create start
|
||||
create check
|
||||
create clear
|
||||
create account
|
||||
create login
|
||||
|
||||
cd $NAME
|
||||
npm i
|
||||
|
||||
@@ -45,6 +45,10 @@ const { parseDynamicCard } = require('../lib/core/searcher');
|
||||
async () => {
|
||||
assert.equal(await bili_client.autolike("761391835139538967"), 4)
|
||||
},
|
||||
// 7
|
||||
async () => {
|
||||
assert(await bili_client.rmDynamic("835102428771647513"))
|
||||
},
|
||||
])
|
||||
|
||||
console.log("api.test ... ok!");
|
||||
|
||||
@@ -3,7 +3,7 @@ const bili_client = require("../lib/net/bili");
|
||||
const util = require('./util');
|
||||
|
||||
(async () => {
|
||||
await util.par_run([], [
|
||||
await util.par_run([0], [
|
||||
// 0
|
||||
async () => {
|
||||
let info = await bili_client.getOneArticleByCv(22112353);
|
||||
|
||||
Reference in New Issue
Block a user