Skip to content

Commit 4e3a32e

Browse files
committed
修复错误
1 parent d93c03b commit 4e3a32e

1 file changed

Lines changed: 30 additions & 24 deletions

File tree

Task/Youth_Read.js

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
更新时间: 2021-02-27 18:22
2+
更新时间: 2021-02-27 21:00
33
Github Actions使用方法见[@lxk0301](https://raw.githubusercontent.com/lxk0301/scripts/master/githubAction.md) 使用方法大同小异
44
5-
请自行抓包,阅读文章和看视频,倒计时转一圈显示青豆到账即可,多看几篇文章和视频,获得更多包数据,抓包地址为"https://ios.baertt.com/v5/article/complete.json",在Github Actions中的Secrets新建name为'YOUTH_READ'的一个值,拷贝抓包的请求体到下面Value的文本框中,添加的请求体越多,获得青豆次数越多,本脚本不包含任何推送通知
5+
点击几篇文章和视频,自动获取阅读请求,在Github Actions中的Secrets新建name为'YOUTH_READ'的一个值,拷贝抓包的请求体到下面Value的文本框中,添加的请求体越多,获得青豆次数越多,本脚本不包含任何推送通知
66
77
多个请求体时用'&'号或者换行隔开" ‼️
88
@@ -33,20 +33,20 @@ if (!$.isNode() && !YouthBody == true) {
3333
} else {
3434
if ($.isNode()) {
3535
if (process.env.YOUTH_READ && process.env.YOUTH_READ.indexOf('&') > -1) {
36-
YouthBody = process.env.YOUTH_READ.split('&');
36+
YouthBodys = process.env.YOUTH_READ.split('&');
3737
console.log(`您选择的是用"&"隔开\n`)
3838
} else if (process.env.YOUTH_READ && process.env.YOUTH_READ.indexOf('\n') > -1) {
39-
YouthBody = process.env.YOUTH_READ.split('\n');
39+
YouthBodys = process.env.YOUTH_READ.split('\n');
4040
console.log(`您选择的是用换行隔开\n`)
4141
} else {
42-
YouthBody = [process.env.YOUTH_READ]
42+
YouthBodys = [process.env.YOUTH_READ]
4343
}
4444
} else if (!$.isNode() && YouthBody.indexOf("&") > -1) {
45-
YouthBody = YouthBody.split("&")
45+
YouthBodys = YouthBody.split("&")
4646
};
47-
Object.keys(YouthBody).forEach((item) => {
48-
if (YouthBody[item]) {
49-
ReadArr.push(YouthBody[item])
47+
Object.keys(YouthBodys).forEach((item) => {
48+
if (YouthBodys[item]) {
49+
ReadArr.push(YouthBodys[item])
5050
}
5151
})
5252
}
@@ -102,10 +102,13 @@ function bodyInfo() {
102102
$.get(batHost('article/info/get.json?' + articlebody), async(error, resp, data) => {
103103
let bodyobj = JSON.parse(data);
104104
//$.log(JSON.stringify(bodyobj,null,2))
105+
$.begin = $.begin + 1;
106+
let res = $.begin % ReadArr.length;
107+
$.setdata(res + "", 'zqbody_index');
105108
try {
106-
if (bodyobj.error_code == "200007") {
109+
if (bodyobj.error_code == "200007"&&!$.isNode()) {
110+
await removebody();
107111
$.log(bodyobj.message+"已自动删除");
108-
repeatbody = $.getdata('youth_autoread').replace("&" + articlebody, "")
109112
} else if (bodyobj.error_code == 0) {
110113
acticid = bodyobj.url.match(/\d+/)[0];
111114
artdesc = bodyobj.description
@@ -116,9 +119,8 @@ function bodyInfo() {
116119
$.log(ctype + ": " + artdesc + " ----- " + author + "\n")
117120
await $.wait(10000);
118121
await AutoRead();
119-
} else if (artArr.indexOf(acticid) > -1) {
120-
repeatbody = $.getdata('youth_autoread').replace("&" + articlebody, "");
121-
$.setdata(repeatbody, 'youth_autoread')
122+
} else if (artArr.indexOf(acticid) > -1&&!$.isNode()) {
123+
await removebody();
122124
$.log("文章ID:" + acticid + " 请求重复,已自动删除")
123125
delbody += 1;
124126
await $.wait(1000)
@@ -140,11 +142,8 @@ function AutoRead() {
140142
let readres = JSON.parse(data);
141143
//$.log(JSON.stringify(readres,null,2))
142144
if (readres.items.complete == 1) {
143-
//$.log(readres.items.max_notice)
145+
$.log(readres.items.max_notice)
144146
} else {
145-
$.begin = $.begin + 1;
146-
let res = $.begin % ReadArr.length;
147-
$.setdata(res + "", 'zqbody_index');
148147
if (readres.error_code == '0' && data.indexOf("read_score") > -1 && readres.items.read_score > 0) {
149148
console.log(`本次阅读获得${readres.items.read_score}个青豆,请等待30s后执行下一次阅读\n`);
150149
if (data.indexOf("ctype") > -1) {
@@ -171,17 +170,15 @@ function AutoRead() {
171170
}
172171
} else if (readres.error_code == '0' && data.indexOf('"score":0') > -1 && readres.items.score == 0) {
173172
$.log(`\n本次阅读获得0个青豆,等待10s即将开始下次阅读\n`);
174-
if (smallzq == "true" && articlebody !== ReadArr[0]) {
175-
smreadbody = $.getdata('youth_autoread').replace("&" + articlebody, "")
176-
$.setdata(smreadbody, 'youth_autoread')
173+
if (smallzq == "true") {
174+
await removebody();
177175
$.log("已删除第" + ($.begin) + "个请求,如无需删除请及时提前关掉boxjs内的开关,使用后即关闭")
178176
delbody += 1
179177
}
180178
} else if (readres.success == false) {
181179
console.log(`第${$.index}次阅读请求有误,请删除此请求`);
182-
if (smallzq == "true" && articlebody !== ReadArr[0]) {
183-
smreadbody = $.getdata('youth_autoread').replace("&" + articlebody, "");
184-
$.setdata(smreadbody, 'youth_autoread');
180+
if (smallzq == "true") {
181+
await removebody();
185182
$.log("已删除第" + ($.begin) + "个请求,如无需删除请及时提前关掉boxjs内的开关,使用后即关闭");
186183
delbody += 1
187184
}
@@ -192,6 +189,15 @@ function AutoRead() {
192189
})
193190
}
194191

192+
function removebody() {
193+
if (articlebody !== ReadArr[0]) {
194+
smallbody = YouthBody.replace("&" + articlebody, "");
195+
} else {
196+
smallbody = YouthBody.replace(articlebody + "&", "")
197+
}
198+
$.setdata(smallbody, 'youth_autoread')
199+
}
200+
195201
function batHost(api, body) {
196202
return {
197203
url: 'https://ios.baertt.com/v5/' + api,

0 commit comments

Comments
 (0)