()
| 16 | |
| 17 | // 贴吧 |
| 18 | function 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 | |
| 45 | async function signbars(bars) { |
| 46 | let signbarActs = [] |
no test coverage detected