Skip to content

Commit b87791b

Browse files
committed
更新说明文件: 笔误
1 parent fe9f3b9 commit b87791b

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

‎tieba/quanx/tieba.js‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const cookieName = '百度贴吧'
2+
const cookieKey = 'chavy_cookie_tieba'
3+
const cookieVal = $prefs.valueForKey(cookieKey)
4+
5+
function sign() {
6+
let url = {
7+
url: `http://tieba.baidu.com/f/like/mylike`,
8+
headers: {
9+
Cookie: cookieVal
10+
}
11+
}
12+
$task.fetch(url).then((response) => {
13+
let data = response.body
14+
let regex = /\/f\?kw=([^{'"}]*)/g
15+
for (const bar of data.matchAll(regex)) {
16+
signBar(bar)
17+
}
18+
})
19+
}
20+
21+
function signBar(bar) {
22+
let url = {
23+
url: `http://tieba.baidu.com/sign/add?ie=utf-8&kw=${bar[1]}`,
24+
headers: { Cookie: cookieVal }
25+
}
26+
$task.fetch(url).then((response) => {
27+
let data = response.body
28+
let result = JSON.parse(data)
29+
if (result.no == 0) {
30+
console.log(`正在签到: ${bar[1]}, 签到成功`)
31+
} else {
32+
console.log(`正在签到: ${bar[1]}, 错误编码: ${result.no}, 错误原因: ${result.error}`)
33+
}
34+
})
35+
}
36+
37+
sign()

0 commit comments

Comments
 (0)