mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-07-22 21:13:47 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5447c9ae69 | ||
|
|
f5f63bcc91 | ||
|
|
1832f6d52b | ||
|
|
717d8cf281 |
@@ -1,5 +1,12 @@
|
||||
<!-- markdownlint-disable MD036 MD024-->
|
||||
# CHANGELOG
|
||||
## 主要变化(2.9.5)
|
||||
* f5f63bc fix: 官方抽奖判断未获取到内容 (#445)
|
||||
* 1832f6d feat: 增加多账号的代理 (#433)
|
||||
* 717d8cf fix: 换源gitlab
|
||||
|
||||
_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_
|
||||
|
||||
## 主要变化(2.9.4)
|
||||
* 2f5990f fix: 动态ID字符串长度超过18
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
1.初始化
|
||||
|
||||
```bash
|
||||
curl -fsSL https://ghproxy.com/https://raw.githubusercontent.com/shanmiteko/LotteryAutoScript/main/script/docker/init.sh | sudo bash
|
||||
curl -fsSL https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main/script/docker/init.sh | sudo bash
|
||||
```
|
||||
|
||||
进入`lottery`文件夹
|
||||
|
||||
+5
-1
@@ -64,7 +64,11 @@ module.exports = Object.freeze({
|
||||
NUMBER: 1,
|
||||
CLEAR: true,
|
||||
WAIT: 60 * 1000,
|
||||
ACCOUNT_UA: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'
|
||||
ACCOUNT_UA: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
|
||||
PROXY_HOST:'',//代理ip
|
||||
PROXY_PORT:'',//代理ip端口
|
||||
PROXY_USER:'',//代理ip账号
|
||||
PROXY_PASS:'',//代理ip密码
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
+52
-23
@@ -103,22 +103,41 @@ function parseDynamicCard(data) {
|
||||
/* 转发描述 */
|
||||
obj.description = '';
|
||||
let _total_len = 0;
|
||||
ditem?.modules?.module_dynamic?.desc?.rich_text_nodes.forEach(node => {
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_AT') {
|
||||
obj.ctrl.push({
|
||||
data: node.rid,
|
||||
location: _total_len,
|
||||
length: node.text.length,
|
||||
type: 1
|
||||
});
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.hasOfficialLottery = true;
|
||||
}
|
||||
obj.description += node.orig_text;
|
||||
_total_len += node.text.length;
|
||||
});
|
||||
if (Array.isArray(ditem?.modules?.module_dynamic?.desc?.rich_text_nodes)) {
|
||||
ditem?.modules?.module_dynamic?.desc?.rich_text_nodes.forEach(node => {
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_AT') {
|
||||
obj.ctrl.push({
|
||||
data: node.rid,
|
||||
location: _total_len,
|
||||
length: node.text.length,
|
||||
type: 1
|
||||
});
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.hasOfficialLottery = true;
|
||||
}
|
||||
obj.description += node.orig_text;
|
||||
_total_len += node.text.length;
|
||||
});
|
||||
} else {
|
||||
ditem?.modules?.module_dynamic?.major?.opus?.summary?.rich_text_nodes.forEach(node => {
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_AT') {
|
||||
obj.ctrl.push({
|
||||
data: node.rid,
|
||||
location: _total_len,
|
||||
length: node.text.length,
|
||||
type: 1
|
||||
});
|
||||
}
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.hasOfficialLottery = true;
|
||||
}
|
||||
obj.description += node.orig_text;
|
||||
_total_len += node.text.length;
|
||||
});
|
||||
}
|
||||
/* 预约抽奖信息 */
|
||||
obj.reserve_id = ditem?.modules?.module_dynamic?.additional?.reserve?.rid || 0;
|
||||
obj.reserve_lottery_text = ditem?.modules?.module_dynamic?.additional?.reserve?.title || '信息丢失';
|
||||
@@ -166,13 +185,23 @@ function parseDynamicCard(data) {
|
||||
obj.origin_hasOfficialLottery = false;
|
||||
/* 转发描述 */
|
||||
obj.origin_description = '';
|
||||
ditem?.orig?.modules?.module_dynamic?.desc?.rich_text_nodes.forEach(node => {
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.origin_hasOfficialLottery = true;
|
||||
}
|
||||
obj.origin_description += node.orig_text;
|
||||
});
|
||||
if (Array.isArray(ditem?.orig?.modules?.module_dynamic?.desc?.rich_text_nodes)) {
|
||||
ditem?.orig?.modules?.module_dynamic?.desc?.rich_text_nodes.forEach(node => {
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.origin_hasOfficialLottery = true;
|
||||
}
|
||||
obj.origin_description += node.orig_text;
|
||||
});
|
||||
} else {
|
||||
ditem?.orig.modules?.module_dynamic?.major?.opus?.summary?.rich_text_nodes.forEach(node => {
|
||||
/* 是否有官方抽奖 */
|
||||
if (node.type === 'RICH_TEXT_NODE_TYPE_LOTTERY') {
|
||||
obj.origin_hasOfficialLottery = true;
|
||||
}
|
||||
obj.origin_description += node.orig_text;
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
log.error('动态卡片解析', e);
|
||||
|
||||
+28
-7
@@ -98,6 +98,7 @@ const utils = {
|
||||
return _c(restNum - 1, argsList.concat(x));
|
||||
};
|
||||
}
|
||||
|
||||
return _c(func.length, []);
|
||||
},
|
||||
/**
|
||||
@@ -121,7 +122,9 @@ const utils = {
|
||||
let c = {
|
||||
i: 0,
|
||||
next: () => c.i++,
|
||||
clear: () => { c.i = 0; },
|
||||
clear: () => {
|
||||
c.i = 0;
|
||||
},
|
||||
value: () => c.i
|
||||
};
|
||||
return c;
|
||||
@@ -130,7 +133,7 @@ const utils = {
|
||||
* 无限序列
|
||||
* `[0..]`
|
||||
*/
|
||||
*infiniteNumber() {
|
||||
* infiniteNumber() {
|
||||
for (let index = 0; ; index++) {
|
||||
yield index;
|
||||
}
|
||||
@@ -178,7 +181,7 @@ const utils = {
|
||||
/**
|
||||
* 是否有指定环境变量
|
||||
* @param {string} env_name
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
hasEnv(env_name) {
|
||||
return process.env[env_name] ? true : false;
|
||||
@@ -278,7 +281,7 @@ const utils = {
|
||||
},
|
||||
/**
|
||||
* 验证码识别
|
||||
* @param {string} url
|
||||
* @param {string} url
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
ocr(url) {
|
||||
@@ -340,7 +343,7 @@ const utils = {
|
||||
/**
|
||||
* 是否存在文件或目录
|
||||
* @param {string} path
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
hasFileOrDir(path) {
|
||||
try {
|
||||
@@ -414,7 +417,7 @@ const utils = {
|
||||
/**
|
||||
* 追加lotteryinfo
|
||||
* @param {string} from
|
||||
* @param {import("./core/searcher").LotteryInfo[]} lottery_info
|
||||
* @param {import('./core/searcher').LotteryInfo[]} lottery_info
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
async appendLotteryInfoFile(from, lottery_info) {
|
||||
@@ -435,7 +438,7 @@ const utils = {
|
||||
/**
|
||||
* 读取lottery_info
|
||||
* @param {string} filename
|
||||
* @return {Promise<import("./core/searcher").LotteryInfo[]>}
|
||||
* @return {Promise<import('./core/searcher').LotteryInfo[]>}
|
||||
*/
|
||||
readLotteryInfoFile(filename) {
|
||||
return new Promise((resolve) => {
|
||||
@@ -471,6 +474,24 @@ const utils = {
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
getIpInfo() {
|
||||
return new Promise((resolve) => {
|
||||
send({
|
||||
url: 'https://myip.qq.com/',
|
||||
method: 'GET',
|
||||
success: res => resolve(res.body),
|
||||
failure: err => resolve(err)
|
||||
});
|
||||
});
|
||||
},
|
||||
printIpInfo(beforeProxy) {
|
||||
const printMessage = beforeProxy ? '当前IP----->' : '代理后IP=======>';
|
||||
utils.getIpInfo().then(res => {
|
||||
console.log(printMessage + res);
|
||||
}).catch((err) => {
|
||||
console.error('获取' + printMessage + '地址失败', err);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
const { version: ve, env_file, config_file, log, hasEnv, delay, hasFileOrDir, clearLotteryInfo } = require('./lib/utils');
|
||||
|
||||
const {
|
||||
version: ve,
|
||||
env_file,
|
||||
config_file,
|
||||
log,
|
||||
hasEnv,
|
||||
delay,
|
||||
hasFileOrDir,
|
||||
clearLotteryInfo, printIpInfo
|
||||
} = require('./lib/utils');
|
||||
const { HttpsProxyAgent } = require('https-proxy-agent');
|
||||
const request = require('https');
|
||||
const metainfo = [
|
||||
' _ _ _ _____ _ _ ',
|
||||
' | | | | | | / ____| (_) | | ',
|
||||
@@ -31,6 +41,7 @@ async function main() {
|
||||
: JSON.parse(MULTIPLE_ACCOUNT_PARM);
|
||||
|
||||
process.env.ENABLE_MULTIPLE_ACCOUNT = '';
|
||||
let localhost = request.globalAgent;
|
||||
|
||||
for (const acco of muti_acco) {
|
||||
process.env.COOKIE = acco.COOKIE;
|
||||
@@ -38,6 +49,19 @@ async function main() {
|
||||
process.env.CLEAR = acco.CLEAR;
|
||||
process.env.NOTE = acco.NOTE;
|
||||
process.env.ACCOUNT_UA = acco.ACCOUNT_UA;
|
||||
if (acco.PROXY_HOST) {
|
||||
printIpInfo(true);
|
||||
//http://ip:port
|
||||
//http://user:pwd@ip:port'
|
||||
const proxyUrl = acco.PROXY_USER
|
||||
? 'http://' + acco.PROXY_USER + ':' + acco.PROXY_PASS + '@' + acco.PROXY_HOST + ':' + acco.PROXY_PORT
|
||||
: 'http://' + acco.PROXY_HOST + ':' + acco.PROXY_PORT;
|
||||
request.globalAgent = new HttpsProxyAgent(proxyUrl);
|
||||
printIpInfo(false);
|
||||
}else {
|
||||
//未设置还原
|
||||
request.globalAgent = localhost;
|
||||
}
|
||||
const err_msg = await main();
|
||||
if (err_msg) {
|
||||
return err_msg;
|
||||
@@ -48,8 +72,8 @@ async function main() {
|
||||
await delay(3 * 1000);
|
||||
}
|
||||
}
|
||||
request.globalAgent = localhost;
|
||||
}
|
||||
|
||||
/**多账号状态还原 */
|
||||
process.env.ENABLE_MULTIPLE_ACCOUNT = ENABLE_MULTIPLE_ACCOUNT;
|
||||
} else if (COOKIE) {
|
||||
@@ -65,7 +89,12 @@ async function main() {
|
||||
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 { lottery_loop_wait, check_loop_wait, clear_loop_wait, save_lottery_info_to_file } = require('./lib/data/config');
|
||||
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':
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lottery-auto-script",
|
||||
"version": "2.9.4",
|
||||
"version": "2.9.5",
|
||||
"description": "自动参与B站动态抽奖",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -37,7 +37,7 @@ CONFIG_FILE=my_config.js
|
||||
# docker仓库
|
||||
DOCKER_REPO=shanmite/lottery_auto_docker
|
||||
# cdn
|
||||
CDN=https://cdn.staticaly.com/gh/shanmiteko/LotteryAutoScript/main
|
||||
CDN=https://gitlab.com/shanmiteko/LotteryAutoScript/-/raw/main
|
||||
# env.example.js文件
|
||||
ENV_EXAMPLE="$CDN/env.example.js"
|
||||
# my_config.example.js文件
|
||||
|
||||
Reference in New Issue
Block a user