MCPcopy Create free account
hub / github.com/NobyDa/Script / GetUserPoint

Function GetUserPoint

Bilibili-DailyBonus/ExchangePoints.js:162–188  ·  view source on GitHub ↗
(account)

Source from the content-addressed store, hash-verified

160}
161
162function GetUserPoint(account) {
163 const opts = {
164 url: 'https://manga.bilibili.com/twirp/pointshop.v1.Pointshop/GetUserPoint',
165 headers: {
166 "User-Agent": "comic-universal/3412 CFNetwork/1410.0.3 Darwin/22.6.0 os/ios model/iPhone 12 mobi_app/iphone_comic build/3412 osVer/16.6 network/2 channel/AppStore",
167 "Cookie": account.cookie
168 },
169 throwHttpErrors: false
170 };
171
172 $.debug(`Send GetUserPoint request:`, $.toStr(opts, null, null, 1));
173
174 return $.http.post(opts)
175 .then((resp) => {
176 $.debug(`Receive GetUserPoint response:`, $.toStr(resp, null, null, 1));
177 const body = JSON.parse(resp.body?.startsWith('{') && resp.body || '{}');
178 if (body.code == 0 && body.data) {
179 return parseInt(body.data.point);
180 } else {
181 throw new Error(body.msg || '查询积分失败');
182 }
183 })
184 .catch((err) => {
185 $.error(`GetUserPoint error:`, err);
186 throw err;
187 });
188}
189
190function ListProduct(account) {
191 const opts = {

Callers 1

ExchangeForAccountFunction · 0.85

Calls 4

debugMethod · 0.45
toStrMethod · 0.45
postMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected