mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
fix: 两级解构时第一级为undefined
This commit is contained in:
parent
6c08cee944
commit
e7ab5790cd
11
README.md
11
README.md
@ -76,12 +76,13 @@ Chrome浏览器:
|
||||
lottery.exe 可执行文件
|
||||
my_config.js 自定义设置文件
|
||||
```
|
||||
2. `env.js`中填入`COOKIE`和推送参数
|
||||
3. `my_config.js`中自定义设置
|
||||
4. 在当前目录下打开终端运行可执行文件`lottery`
|
||||
5. 输入`lottery start`启动抽奖|`lottery check`检测中奖|`lottery clear`清理动态
|
||||
2. 用记事本或其他编辑器修改`env.js`和`my_config.js`文件(右键选择用记事本打开)
|
||||
3. 在`env.js`中填入`COOKIE`和推送参数
|
||||
4. 在`my_config.js`中自定义设置
|
||||
5. 在当前目录下**打开终端**运行可执行文件`lottery`(勿直接点击`lottery`)
|
||||
6. 键入`lottery start`启动抽奖|`lottery check`检测中奖|`lottery clear`清理动态
|
||||
> 或者新建文本文档写入`lottery start`然后更改扩展名为.bat点击运行
|
||||
6. 运行截图
|
||||
7. 运行截图
|
||||

|
||||
|
||||
#### 以源码方式运行
|
||||
|
||||
@ -27,6 +27,16 @@ const account_parm = {
|
||||
|
||||
/**
|
||||
* 为防止环境变量过长, 请将多账号填在此处
|
||||
* @example
|
||||
* ```js
|
||||
* {
|
||||
* COOKIE: "",
|
||||
* NUMBER: 2,
|
||||
* CLEAR: true,
|
||||
* WAIT: 60 * 1000,
|
||||
* },
|
||||
* ```
|
||||
* 请按照以上格式将参数依次填写在下方
|
||||
*/
|
||||
const multiple_account_parm = [
|
||||
{
|
||||
@ -35,12 +45,6 @@ const multiple_account_parm = [
|
||||
CLEAR: true,
|
||||
WAIT: 60 * 1000,
|
||||
},
|
||||
// {
|
||||
// COOKIE: "",
|
||||
// NUMBER: 2,
|
||||
// CLEAR: true,
|
||||
// WAIT: 60 * 1000,
|
||||
// },
|
||||
]
|
||||
|
||||
/**
|
||||
|
||||
@ -86,9 +86,8 @@ function parseDynamicCard(dynamic_detail_card) {
|
||||
*/
|
||||
function modifyDynamicRes(res) {
|
||||
const
|
||||
strToJson = Util.strToJson
|
||||
, { data, code } = strToJson(res)
|
||||
, { cards = [], has_more, offset } = data;
|
||||
{ data = {}, code } = Util.strToJson(res),
|
||||
{ cards = [], has_more, offset } = data;
|
||||
|
||||
if (code !== 0) {
|
||||
log.error('处理动态数据', '获取动态数据出错,可能是访问太频繁 \n' + res);
|
||||
@ -301,13 +300,14 @@ class Public {
|
||||
const
|
||||
content = await BiliAPI.getOneArticleByCv(cv),
|
||||
dyids = content.match(/(?<=t.bilibili.com\/)[0-9]+/g) || [],
|
||||
dyids_set = [...new Set(dyids)],
|
||||
/**判断此专栏是否查看过的权重 */
|
||||
weight = dyids.length / 2;
|
||||
weight = dyids_set.length / 2;
|
||||
|
||||
let { length } = dyids;
|
||||
let { length } = dyids_set;
|
||||
|
||||
log.info('获取动态', `提取专栏(${cv})中提及的dyid(${length})`)
|
||||
for (const dyid of dyids) {
|
||||
for (const dyid of dyids_set) {
|
||||
let _weight = 0;
|
||||
const isRelayed = await MyStorage.searchDyid(dyid);
|
||||
if (isRelayed) {
|
||||
@ -322,7 +322,7 @@ class Public {
|
||||
if (!isRelayed) {
|
||||
log.info('获取动态', `查看动态(${dyid})的细节 (${length--})`)
|
||||
const res = await BiliAPI.getOneDynamicByDyid(dyid)
|
||||
, { code, data } = Util.strToJson(res)
|
||||
, { code, data = {} } = Util.strToJson(res)
|
||||
, { card } = data;
|
||||
|
||||
if (code !== 0) {
|
||||
|
||||
@ -69,7 +69,7 @@ const Util = {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
delay(time) {
|
||||
Util.log.info('时延', `${time}ms`);
|
||||
Util.log.info('时延', `${~~time}ms`);
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user