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

Function ListProduct

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

Source from the content-addressed store, hash-verified

188}
189
190function ListProduct(account) {
191 const opts = {
192 url: 'https://manga.bilibili.com/twirp/pointshop.v1.Pointshop/ListProduct',
193 headers: {
194 "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"
195 },
196 throwHttpErrors: false
197 };
198
199 $.debug(`Send ListProduct request:`, $.toStr(opts, null, null, 1));
200
201 return $.http.post(opts)
202 .then((resp) => {
203 $.debug(`Receive ListProduct response:`, $.toStr(resp, null, null, 1));
204 const body = JSON.parse(resp.body?.startsWith('{') && resp.body || '{}');
205 if (body.code == 0 && body.data && body.data.length >= 1) {
206 return body.data;
207 } else {
208 throw new Error(body.msg || '查询商品列表失败');
209 }
210 })
211 .catch((err) => {
212 $.error(`ListProduct error:`, err);
213 throw err;
214 });
215}
216
217function StartExchange(account, product, num, attempt) {
218 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