Skip to content

Commit f06e6cd

Browse files
committed
quanx - 重新上传
1 parent b87791b commit f06e6cd

2 files changed

Lines changed: 29 additions & 24 deletions

File tree

‎tieba/quanx/tieba.cookie.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
const cookieName = '百度贴吧'
2-
const cookieKey = 'chavy_cookie_tieba'
3-
const cookieVal = $request.headers['Cookie']
1+
const cookieName = "百度贴吧";
2+
const cookieKey = "chavy_cookie_tieba";
3+
const cookieVal = $request.headers["Cookie"];
44

55
if (cookieVal) {
6-
let cookie = $prefs.setValueForKey(cookieVal, cookieKey)
6+
let cookie = $prefs.setValueForKey(cookieVal, cookieKey);
77
if (cookie) {
8-
let msg = `Cookie [${cookieName}] 写入成功!`
9-
$notify(msg, '', '详见日志')
8+
let msg = `Cookie [${cookieName}] 写入成功!`;
9+
$notify(msg, "", "详见日志");
1010
}
1111
}
1212

13-
$done({})
13+
$done({});

‎tieba/quanx/tieba.js‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
1-
const cookieName = '百度贴吧'
2-
const cookieKey = 'chavy_cookie_tieba'
3-
const cookieVal = $prefs.valueForKey(cookieKey)
1+
const cookieName = "百度贴吧";
2+
const cookieKey = "chavy_cookie_tieba";
3+
const cookieVal = $prefs.valueForKey(cookieKey);
44

55
function sign() {
66
let url = {
77
url: `http://tieba.baidu.com/f/like/mylike`,
88
headers: {
99
Cookie: cookieVal
1010
}
11-
}
12-
$task.fetch(url).then((response) => {
13-
let data = response.body
14-
let regex = /\/f\?kw=([^{'"}]*)/g
11+
};
12+
$task.fetch(url).then(response => {
13+
let data = response.body;
14+
let regex = /\/f\?kw=([^{'"}]*)/g;
15+
let cnt = 0;
1516
for (const bar of data.matchAll(regex)) {
16-
signBar(bar)
17+
cnt += 1;
18+
setTimeout(() => signBar(bar), cnt * 500);
1719
}
18-
})
20+
});
1921
}
2022

2123
function signBar(bar) {
2224
let url = {
2325
url: `http://tieba.baidu.com/sign/add?ie=utf-8&kw=${bar[1]}`,
26+
method: "POST",
2427
headers: { Cookie: cookieVal }
25-
}
26-
$task.fetch(url).then((response) => {
27-
let data = response.body
28-
let result = JSON.parse(data)
28+
};
29+
$task.fetch(url).then(response => {
30+
let data = response.body;
31+
let result = JSON.parse(data);
2932
if (result.no == 0) {
30-
console.log(`正在签到: ${bar[1]}, 签到成功`)
33+
console.log(`正在签到: ${bar[1]}, 签到成功`);
3134
} else {
32-
console.log(`正在签到: ${bar[1]}, 错误编码: ${result.no}, 错误原因: ${result.error}`)
35+
console.log(
36+
`正在签到: ${bar[1]}, 错误编码: ${result.no}, 错误原因: ${result.error}`
37+
);
3338
}
34-
})
39+
});
3540
}
3641

37-
sign()
42+
sign();

0 commit comments

Comments
 (0)