MCPcopy Create free account
hub / github.com/chavyleung/scripts / tieba

Function tieba

tieba/tieba.js:18–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17// 贴吧
18function tieba() {
19 return new Promise((resove) => {
20 const url = { url: 'https://tieba.baidu.com/mo/q/newmoindex', headers: { Cookie: $.VAL_cookies } }
21 $.get(url, async (err, resp, data) => {
22 try {
23 const _data = JSON.parse(data)
24 // 处理异常
25 if (_data.no !== 0) {
26 throw new Error(`获取清单失败! 原因: ${_data.error}`)
27 }
28 // 组装数据
29 $.bars = []
30 $.tieba = { tbs: _data.data.tbs }
31 _data.data.like_forum.forEach((bar) => $.bars.push(barWrapper(bar)))
32 $.bars = $.bars.sort((a, b) => b.exp - a.exp)
33 // 开始签到
34 await signbars($.bars)
35 // await getbars($.bars)
36 } catch (e) {
37 $.logErr(e, resp)
38 } finally {
39 resove()
40 }
41 })
42 })
43}
44
45async function signbars(bars) {
46 let signbarActs = []

Callers 1

tieba.jsFile · 0.85

Calls 4

barWrapperFunction · 0.85
signbarsFunction · 0.85
getMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected