Skip to content

Commit f0b6a1a

Browse files
committed
更新[百度贴吧]签到脚本: 修复undefind问题
1 parent f02d3d0 commit f0b6a1a

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎tieba/tieba.js‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ function sign() {
1414
let result = JSON.parse(data)
1515
let tbs = result.data.tbs
1616
let forums = result.data.like_forum
17-
console.log(forums.length)
1817
let signinfo = {
1918
forumCnt: forums.length,
2019
signedCnt: 0,
@@ -25,25 +24,23 @@ function sign() {
2524

2625
let singIndex = 0
2726
for (const bar of forums) {
28-
let barName = decodeURIComponent(decodeURIComponent(bar.forum_name))
2927
// 已签
3028
if (bar.is_sign == 1) {
3129
signinfo.signedCnt += 1
3230
signinfo.skipedCnt += 1
33-
console.log(`签到跳过: ${barName}, 原因: 重复签到`)
31+
console.log(`签到跳过: ${bar.forum_name}, 原因: 重复签到`)
3432
}
3533
// 未签
3634
else {
3735
singIndex += 1
3836
setTimeout(
3937
() =>
4038
signBar(bar, tbs, (error, response, data) => {
41-
console.log(data)
4239
let signresult = JSON.parse(data)
4340
if (signresult.no == 0 || signresult.no == 1011) {
4441
signinfo.signedCnt += 1
4542
signinfo.successCnt += 1
46-
console.log(`签到成功: ${barName}`)
43+
console.log(`签到成功: ${bar.forum_name}`)
4744
} else {
4845
signinfo.failedCnt += 1
4946
console.log(`签到失败: ${bar[1]}, 编码: ${signresult.no}, 原因: ${signresult.error}`)
@@ -59,8 +56,10 @@ function sign() {
5956

6057
function signBar(bar, tbs, cb) {
6158
let url = {
62-
url: `http://tieba.baidu.com/sign/add?ie=utf-8&kw=${bar.forum_name}&tbs=${tbs}`,
63-
headers: { Cookie: cookieVal }
59+
url: `http://tieba.baidu.com/sign/add`,
60+
method: 'POST',
61+
headers: { Cookie: cookieVal },
62+
body: `ie=utf-8&kw=${bar.forum_name}&tbs=${tbs}`
6463
}
6564
$httpClient.post(url, cb)
6665
}

0 commit comments

Comments
 (0)