@ikenxuan/amagi 4.4.14 → 4.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/default/cjs/index.cjs +151 -129
- package/dist/default/esm/index.mjs +151 -129
- package/package.json +1 -1
|
@@ -238,7 +238,7 @@ var bilibili = {
|
|
|
238
238
|
*/
|
|
239
239
|
getVideoInfo: async (options, cookie) => {
|
|
240
240
|
const { typeMode, ...restOptions } = options;
|
|
241
|
-
const data2 = await
|
|
241
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E" }, cookie);
|
|
242
242
|
return data2;
|
|
243
243
|
},
|
|
244
244
|
/**
|
|
@@ -249,7 +249,7 @@ var bilibili = {
|
|
|
249
249
|
*/
|
|
250
250
|
getVideoStream: async (options, cookie) => {
|
|
251
251
|
const { typeMode, ...restOptions } = options;
|
|
252
|
-
const data2 = await
|
|
252
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u5355\u4E2A\u89C6\u9891\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E" }, cookie);
|
|
253
253
|
return data2;
|
|
254
254
|
},
|
|
255
255
|
/**
|
|
@@ -260,7 +260,7 @@ var bilibili = {
|
|
|
260
260
|
*/
|
|
261
261
|
getComments: async (options, cookie) => {
|
|
262
262
|
const { typeMode, ...restOptions } = options;
|
|
263
|
-
const data2 = await
|
|
263
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u8BC4\u8BBA\u6570\u636E" }, cookie);
|
|
264
264
|
return data2;
|
|
265
265
|
},
|
|
266
266
|
/**
|
|
@@ -271,7 +271,7 @@ var bilibili = {
|
|
|
271
271
|
*/
|
|
272
272
|
getUserProfile: async (options, cookie) => {
|
|
273
273
|
const { typeMode, ...restOptions } = options;
|
|
274
|
-
const data2 = await
|
|
274
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E" }, cookie);
|
|
275
275
|
return data2;
|
|
276
276
|
},
|
|
277
277
|
/**
|
|
@@ -282,7 +282,7 @@ var bilibili = {
|
|
|
282
282
|
*/
|
|
283
283
|
getUserDynamic: async (options, cookie) => {
|
|
284
284
|
const { typeMode, ...restOptions } = options;
|
|
285
|
-
const data2 = await
|
|
285
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u7528\u6237\u4E3B\u9875\u52A8\u6001\u5217\u8868\u6570\u636E" }, cookie);
|
|
286
286
|
return data2;
|
|
287
287
|
},
|
|
288
288
|
/**
|
|
@@ -293,7 +293,7 @@ var bilibili = {
|
|
|
293
293
|
*/
|
|
294
294
|
getEmojiList: async (options, cookie) => {
|
|
295
295
|
const { typeMode, ...restOptions } = options;
|
|
296
|
-
const data2 = await
|
|
296
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "Emoji\u6570\u636E" }, cookie);
|
|
297
297
|
return data2;
|
|
298
298
|
},
|
|
299
299
|
/**
|
|
@@ -304,7 +304,7 @@ var bilibili = {
|
|
|
304
304
|
*/
|
|
305
305
|
getBangumiInfo: async (options, cookie) => {
|
|
306
306
|
const { typeMode, ...restOptions } = options;
|
|
307
|
-
const data2 = await
|
|
307
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u756A\u5267\u57FA\u672C\u4FE1\u606F\u6570\u636E" }, cookie);
|
|
308
308
|
return data2;
|
|
309
309
|
},
|
|
310
310
|
/**
|
|
@@ -315,7 +315,7 @@ var bilibili = {
|
|
|
315
315
|
*/
|
|
316
316
|
getBangumiStream: async (options, cookie) => {
|
|
317
317
|
const { typeMode, ...restOptions } = options;
|
|
318
|
-
const data2 = await
|
|
318
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u756A\u5267\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E" }, cookie);
|
|
319
319
|
return data2;
|
|
320
320
|
},
|
|
321
321
|
/**
|
|
@@ -326,7 +326,7 @@ var bilibili = {
|
|
|
326
326
|
*/
|
|
327
327
|
getDynamicInfo: async (options, cookie) => {
|
|
328
328
|
const { typeMode, ...restOptions } = options;
|
|
329
|
-
const data2 = await
|
|
329
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u52A8\u6001\u8BE6\u60C5\u6570\u636E" }, cookie);
|
|
330
330
|
return data2;
|
|
331
331
|
},
|
|
332
332
|
/**
|
|
@@ -337,7 +337,7 @@ var bilibili = {
|
|
|
337
337
|
*/
|
|
338
338
|
getDynamicCard: async (options, cookie) => {
|
|
339
339
|
const { typeMode, ...restOptions } = options;
|
|
340
|
-
const data2 = await
|
|
340
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u52A8\u6001\u5361\u7247\u6570\u636E" }, cookie);
|
|
341
341
|
return data2;
|
|
342
342
|
},
|
|
343
343
|
/**
|
|
@@ -348,7 +348,7 @@ var bilibili = {
|
|
|
348
348
|
*/
|
|
349
349
|
getLiveRoomDetail: async (options, cookie) => {
|
|
350
350
|
const { typeMode, ...restOptions } = options;
|
|
351
|
-
const data2 = await
|
|
351
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F" }, cookie);
|
|
352
352
|
return data2;
|
|
353
353
|
},
|
|
354
354
|
/**
|
|
@@ -359,7 +359,7 @@ var bilibili = {
|
|
|
359
359
|
*/
|
|
360
360
|
getLiveRoomInitInfo: async (options, cookie) => {
|
|
361
361
|
const { typeMode, ...restOptions } = options;
|
|
362
|
-
const data2 = await
|
|
362
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u76F4\u64AD\u95F4\u521D\u59CB\u5316\u4FE1\u606F" }, cookie);
|
|
363
363
|
return data2;
|
|
364
364
|
},
|
|
365
365
|
/**
|
|
@@ -370,7 +370,7 @@ var bilibili = {
|
|
|
370
370
|
*/
|
|
371
371
|
getLoginBasicInfo: async (options, cookie) => {
|
|
372
372
|
const { typeMode, ...restOptions } = options;
|
|
373
|
-
const data2 = await
|
|
373
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u767B\u5F55\u57FA\u672C\u4FE1\u606F" }, cookie);
|
|
374
374
|
return data2;
|
|
375
375
|
},
|
|
376
376
|
/**
|
|
@@ -381,7 +381,7 @@ var bilibili = {
|
|
|
381
381
|
*/
|
|
382
382
|
getLoginQrcode: async (options, cookie) => {
|
|
383
383
|
const { typeMode, ...restOptions } = options;
|
|
384
|
-
const data2 = await
|
|
384
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u7533\u8BF7\u4E8C\u7EF4\u7801" }, cookie);
|
|
385
385
|
return data2;
|
|
386
386
|
},
|
|
387
387
|
/**
|
|
@@ -392,7 +392,7 @@ var bilibili = {
|
|
|
392
392
|
*/
|
|
393
393
|
checkQrcodeStatus: async (options, cookie) => {
|
|
394
394
|
const { typeMode, ...restOptions } = options;
|
|
395
|
-
const data2 = await
|
|
395
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u4E8C\u7EF4\u7801\u72B6\u6001" }, cookie);
|
|
396
396
|
return data2;
|
|
397
397
|
},
|
|
398
398
|
/**
|
|
@@ -403,7 +403,7 @@ var bilibili = {
|
|
|
403
403
|
*/
|
|
404
404
|
getUserTotalPlayCount: async (options, cookie) => {
|
|
405
405
|
const { typeMode, ...restOptions } = options;
|
|
406
|
-
const data2 = await
|
|
406
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u83B7\u53D6UP\u4E3B\u603B\u64AD\u653E\u91CF" }, cookie);
|
|
407
407
|
return data2;
|
|
408
408
|
},
|
|
409
409
|
/**
|
|
@@ -414,7 +414,7 @@ var bilibili = {
|
|
|
414
414
|
*/
|
|
415
415
|
convertAvToBv: async (options, cookie) => {
|
|
416
416
|
const { typeMode, ...restOptions } = options;
|
|
417
|
-
const data2 = await
|
|
417
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "AV\u8F6CBV" }, cookie);
|
|
418
418
|
return data2;
|
|
419
419
|
},
|
|
420
420
|
/**
|
|
@@ -425,40 +425,40 @@ var bilibili = {
|
|
|
425
425
|
*/
|
|
426
426
|
convertBvToAv: async (options, cookie) => {
|
|
427
427
|
const { typeMode, ...restOptions } = options;
|
|
428
|
-
const data2 = await
|
|
428
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "BV\u8F6CAV" }, cookie);
|
|
429
429
|
return data2;
|
|
430
430
|
}
|
|
431
431
|
};
|
|
432
432
|
var registerBilibiliRoutes = (cookie) => {
|
|
433
433
|
const router = express__default.default.Router();
|
|
434
434
|
router.get("/new_login_qrcode", async (req, res) => {
|
|
435
|
-
const data2 = await
|
|
435
|
+
const data2 = await fetchBilibili({
|
|
436
436
|
methodType: "\u7533\u8BF7\u4E8C\u7EF4\u7801"
|
|
437
437
|
}, req.headers.cookie || cookie);
|
|
438
438
|
res.json(data2);
|
|
439
439
|
});
|
|
440
440
|
router.get("/check_qrcode", async (req, res) => {
|
|
441
|
-
const data2 = await
|
|
441
|
+
const data2 = await fetchBilibili({
|
|
442
442
|
methodType: "\u4E8C\u7EF4\u7801\u72B6\u6001",
|
|
443
443
|
qrcode_key: req.query.qrcode_key
|
|
444
444
|
}, req.headers.cookie || cookie);
|
|
445
445
|
res.json(data2);
|
|
446
446
|
});
|
|
447
447
|
router.get("/login_basic_info", async (req, res) => {
|
|
448
|
-
const data2 = await
|
|
448
|
+
const data2 = await fetchBilibili({
|
|
449
449
|
methodType: "\u767B\u5F55\u57FA\u672C\u4FE1\u606F"
|
|
450
450
|
}, req.headers.cookie || cookie);
|
|
451
451
|
res.json(data2);
|
|
452
452
|
});
|
|
453
453
|
router.get("/fetch_one_video", async (req, res) => {
|
|
454
|
-
const data2 = await
|
|
454
|
+
const data2 = await fetchBilibili({
|
|
455
455
|
methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
|
|
456
456
|
bvid: req.query.bvid
|
|
457
457
|
}, req.headers.cookie || cookie);
|
|
458
458
|
res.json(data2);
|
|
459
459
|
});
|
|
460
460
|
router.get("/fetch_video_playurl", async (req, res) => {
|
|
461
|
-
const data2 = await
|
|
461
|
+
const data2 = await fetchBilibili({
|
|
462
462
|
methodType: "\u5355\u4E2A\u89C6\u9891\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
|
|
463
463
|
avid: parseInt(req.query.avid),
|
|
464
464
|
cid: parseInt(req.query.cid)
|
|
@@ -466,7 +466,7 @@ var registerBilibiliRoutes = (cookie) => {
|
|
|
466
466
|
res.json(data2);
|
|
467
467
|
});
|
|
468
468
|
router.get("/fetch_work_comments", async (req, res) => {
|
|
469
|
-
const data2 = await
|
|
469
|
+
const data2 = await fetchBilibili({
|
|
470
470
|
methodType: "\u8BC4\u8BBA\u6570\u636E",
|
|
471
471
|
oid: Number(req.query.oid),
|
|
472
472
|
number: Number(req.query.number),
|
|
@@ -475,20 +475,20 @@ var registerBilibiliRoutes = (cookie) => {
|
|
|
475
475
|
res.json(data2);
|
|
476
476
|
});
|
|
477
477
|
router.get("/fetch_work_comments", async (req, res) => {
|
|
478
|
-
const data2 = await
|
|
478
|
+
const data2 = await fetchBilibili({
|
|
479
479
|
methodType: "Emoji\u6570\u636E"
|
|
480
480
|
}, req.headers.cookie || cookie);
|
|
481
481
|
res.json(data2);
|
|
482
482
|
});
|
|
483
483
|
router.get("/fetch_bangumi_video_info", async (req, res) => {
|
|
484
|
-
const data2 = await
|
|
484
|
+
const data2 = await fetchBilibili({
|
|
485
485
|
methodType: "\u756A\u5267\u57FA\u672C\u4FE1\u606F\u6570\u636E",
|
|
486
486
|
ep_id: req.query.ep_id
|
|
487
487
|
}, req.headers.cookie || cookie);
|
|
488
488
|
res.json(data2);
|
|
489
489
|
});
|
|
490
490
|
router.get("/fetch_bangumi_video_playurl", async (req, res) => {
|
|
491
|
-
const data2 = await
|
|
491
|
+
const data2 = await fetchBilibili({
|
|
492
492
|
methodType: "\u756A\u5267\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
|
|
493
493
|
cid: parseInt(req.query.cid),
|
|
494
494
|
ep_id: req.query.ep_id
|
|
@@ -496,63 +496,63 @@ var registerBilibiliRoutes = (cookie) => {
|
|
|
496
496
|
res.json(data2);
|
|
497
497
|
});
|
|
498
498
|
router.get("/fetch_user_dynamic", async (req, res) => {
|
|
499
|
-
const data2 = await
|
|
499
|
+
const data2 = await fetchBilibili({
|
|
500
500
|
methodType: "\u7528\u6237\u4E3B\u9875\u52A8\u6001\u5217\u8868\u6570\u636E",
|
|
501
501
|
host_mid: parseInt(req.query.host_mid)
|
|
502
502
|
}, req.headers.cookie || cookie);
|
|
503
503
|
res.json(data2);
|
|
504
504
|
});
|
|
505
505
|
router.get("/fetch_dynamic_info", async (req, res) => {
|
|
506
|
-
const data2 = await
|
|
506
|
+
const data2 = await fetchBilibili({
|
|
507
507
|
methodType: "\u52A8\u6001\u8BE6\u60C5\u6570\u636E",
|
|
508
508
|
dynamic_id: req.query.dynamic_id
|
|
509
509
|
}, req.headers.cookie || cookie);
|
|
510
510
|
res.json(data2);
|
|
511
511
|
});
|
|
512
512
|
router.get("/fetch_dynamic_card", async (req, res) => {
|
|
513
|
-
const data2 = await
|
|
513
|
+
const data2 = await fetchBilibili({
|
|
514
514
|
methodType: "\u52A8\u6001\u5361\u7247\u6570\u636E",
|
|
515
515
|
dynamic_id: req.query.dynamic_id
|
|
516
516
|
}, req.headers.cookie || cookie);
|
|
517
517
|
res.json(data2);
|
|
518
518
|
});
|
|
519
519
|
router.get("/fetch_user_profile", async (req, res) => {
|
|
520
|
-
const data2 = await
|
|
520
|
+
const data2 = await fetchBilibili({
|
|
521
521
|
methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E",
|
|
522
522
|
host_mid: parseInt(req.query.host_mid)
|
|
523
523
|
}, req.headers.cookie || cookie);
|
|
524
524
|
res.json(data2);
|
|
525
525
|
});
|
|
526
526
|
router.get("/fetch_live_room_detail", async (req, res) => {
|
|
527
|
-
const data2 = await
|
|
527
|
+
const data2 = await fetchBilibili({
|
|
528
528
|
methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F",
|
|
529
529
|
room_id: req.query.room_id
|
|
530
530
|
}, req.headers.cookie || cookie);
|
|
531
531
|
res.json(data2);
|
|
532
532
|
});
|
|
533
533
|
router.get("/fetch_liveroom_def", async (req, res) => {
|
|
534
|
-
const data2 = await
|
|
534
|
+
const data2 = await fetchBilibili({
|
|
535
535
|
methodType: "\u76F4\u64AD\u95F4\u521D\u59CB\u5316\u4FE1\u606F",
|
|
536
536
|
room_id: req.query.room_id
|
|
537
537
|
}, req.headers.cookie || cookie);
|
|
538
538
|
res.json(data2);
|
|
539
539
|
});
|
|
540
540
|
router.get("/bv_to_av", async (req, res) => {
|
|
541
|
-
const data2 = await
|
|
541
|
+
const data2 = await fetchBilibili({
|
|
542
542
|
methodType: "BV\u8F6CAV",
|
|
543
543
|
bvid: req.query.bvid
|
|
544
544
|
}, req.headers.cookie || cookie);
|
|
545
545
|
res.json(data2);
|
|
546
546
|
});
|
|
547
547
|
router.get("/av_to_bv", async (req, res) => {
|
|
548
|
-
const data2 = await
|
|
548
|
+
const data2 = await fetchBilibili({
|
|
549
549
|
methodType: "AV\u8F6CBV",
|
|
550
550
|
avid: parseInt(req.query.avid)
|
|
551
551
|
}, req.headers.cookie || cookie);
|
|
552
552
|
res.json(data2);
|
|
553
553
|
});
|
|
554
554
|
router.get("/fetch_user_full_view", async (req, res) => {
|
|
555
|
-
const data2 = await
|
|
555
|
+
const data2 = await fetchBilibili({
|
|
556
556
|
methodType: "\u83B7\u53D6UP\u4E3B\u603B\u64AD\u653E\u91CF",
|
|
557
557
|
host_mid: parseInt(req.query.host_mid)
|
|
558
558
|
}, req.headers.cookie || cookie);
|
|
@@ -589,7 +589,7 @@ var defheaders = {
|
|
|
589
589
|
"upgrade-insecure-requests": "1",
|
|
590
590
|
referer: "https://www.bilibili.com/"
|
|
591
591
|
};
|
|
592
|
-
var
|
|
592
|
+
var fetchBilibili = async (data2, cookie) => {
|
|
593
593
|
const headers2 = {
|
|
594
594
|
...defheaders,
|
|
595
595
|
cookie: cookie ? cookie.replace(/\s+/g, "") : ""
|
|
@@ -625,55 +625,51 @@ var BilibiliData = async (data2, cookie) => {
|
|
|
625
625
|
let stabilizedCount = 0;
|
|
626
626
|
let requestCount = 0;
|
|
627
627
|
let tmpresp;
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
requestCount = Math.min(20, Number(number) - fetchedComments.length);
|
|
634
|
-
}
|
|
635
|
-
const url = bilibiliApiUrls.\u8BC4\u8BBA\u533A\u660E\u7EC6({
|
|
636
|
-
type,
|
|
637
|
-
oid,
|
|
638
|
-
number: requestCount,
|
|
639
|
-
pn
|
|
640
|
-
});
|
|
641
|
-
const checkStatusUrl = bilibiliApiUrls.\u8BC4\u8BBA\u533A\u72B6\u6001({ oid, type });
|
|
642
|
-
const checkStatusRes = await GlobalGetData({
|
|
643
|
-
url: checkStatusUrl,
|
|
644
|
-
headers: headers2,
|
|
645
|
-
...data2
|
|
646
|
-
});
|
|
647
|
-
if (checkStatusRes.data === null) {
|
|
648
|
-
logger.error("\u8BC4\u8BBA\u533A\u672A\u5F00\u653E");
|
|
649
|
-
return {
|
|
650
|
-
code: 404,
|
|
651
|
-
message: "\u8BC4\u8BBA\u533A\u672A\u5F00\u653E",
|
|
652
|
-
data: null
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
const response = await GlobalGetData({
|
|
656
|
-
url,
|
|
657
|
-
headers: headers2,
|
|
658
|
-
...data2
|
|
659
|
-
});
|
|
660
|
-
tmpresp = response;
|
|
661
|
-
const currentCount = response.data.replies ? response.data.replies.length : 0;
|
|
662
|
-
fetchedComments.push(...response.data.replies || []);
|
|
663
|
-
if (currentCount === lastFetchedCount) {
|
|
664
|
-
stabilizedCount++;
|
|
665
|
-
} else {
|
|
666
|
-
stabilizedCount = 0;
|
|
667
|
-
}
|
|
668
|
-
lastFetchedCount = currentCount;
|
|
669
|
-
if (stabilizedCount >= commentGrowthStabilized || requestCount >= maxRequestCount) {
|
|
670
|
-
break;
|
|
671
|
-
}
|
|
672
|
-
pn++;
|
|
673
|
-
requestCount++;
|
|
628
|
+
while (fetchedComments.length < Number(number ?? 20) && requestCount < maxRequestCount) {
|
|
629
|
+
if (number === 0 || number === void 0) {
|
|
630
|
+
requestCount = 0;
|
|
631
|
+
} else {
|
|
632
|
+
requestCount = Math.min(20, Number(number) - fetchedComments.length);
|
|
674
633
|
}
|
|
675
|
-
|
|
676
|
-
|
|
634
|
+
const url = bilibiliApiUrls.\u8BC4\u8BBA\u533A\u660E\u7EC6({
|
|
635
|
+
type,
|
|
636
|
+
oid,
|
|
637
|
+
number: requestCount,
|
|
638
|
+
pn
|
|
639
|
+
});
|
|
640
|
+
const checkStatusUrl = bilibiliApiUrls.\u8BC4\u8BBA\u533A\u72B6\u6001({ oid, type });
|
|
641
|
+
const checkStatusRes = await GlobalGetData({
|
|
642
|
+
url: checkStatusUrl,
|
|
643
|
+
headers: headers2,
|
|
644
|
+
...data2
|
|
645
|
+
});
|
|
646
|
+
if (checkStatusRes.data === null) {
|
|
647
|
+
logger.error("\u8BC4\u8BBA\u533A\u672A\u5F00\u653E");
|
|
648
|
+
return {
|
|
649
|
+
code: 404,
|
|
650
|
+
message: "\u8BC4\u8BBA\u533A\u672A\u5F00\u653E",
|
|
651
|
+
data: null
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
const response = await GlobalGetData({
|
|
655
|
+
url,
|
|
656
|
+
headers: headers2,
|
|
657
|
+
...data2
|
|
658
|
+
});
|
|
659
|
+
tmpresp = response;
|
|
660
|
+
const currentCount = response.data.replies ? response.data.replies.length : 0;
|
|
661
|
+
fetchedComments.push(...response.data.replies || []);
|
|
662
|
+
if (currentCount === lastFetchedCount) {
|
|
663
|
+
stabilizedCount++;
|
|
664
|
+
} else {
|
|
665
|
+
stabilizedCount = 0;
|
|
666
|
+
}
|
|
667
|
+
lastFetchedCount = currentCount;
|
|
668
|
+
if (stabilizedCount >= commentGrowthStabilized || requestCount >= maxRequestCount) {
|
|
669
|
+
break;
|
|
670
|
+
}
|
|
671
|
+
pn++;
|
|
672
|
+
requestCount++;
|
|
677
673
|
}
|
|
678
674
|
const finalResponse = {
|
|
679
675
|
...tmpresp,
|
|
@@ -839,32 +835,41 @@ var BilibiliData = async (data2, cookie) => {
|
|
|
839
835
|
}
|
|
840
836
|
};
|
|
841
837
|
var GlobalGetData = async (options) => {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
838
|
+
try {
|
|
839
|
+
const result = await new Networks(options).getData();
|
|
840
|
+
if (result && result.code === 0) {
|
|
841
|
+
return result;
|
|
842
|
+
} else if (result.code === 12061) {
|
|
843
|
+
const warningMessage = `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01
|
|
847
844
|
\u8BF7\u6C42\u63A5\u53E3\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
848
845
|
\u8BF7\u6C42URL\uFF1A${options.url}
|
|
849
846
|
\u9519\u8BEF\u4EE3\u7801\uFF1A${result.code}\uFF0C
|
|
850
847
|
\u542B\u4E49\uFF1A${result.message}`;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
848
|
+
logger.warn(warningMessage);
|
|
849
|
+
throw {
|
|
850
|
+
...result,
|
|
851
|
+
warning: warningMessage
|
|
852
|
+
};
|
|
853
|
+
} else {
|
|
854
|
+
const errorMessage = errorMap[result.code] || result.message || "\u672A\u77E5\u9519\u8BEF";
|
|
855
|
+
const warningMessage = `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01
|
|
859
856
|
\u8BF7\u6C42\u63A5\u53E3\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
860
857
|
\u8BF7\u6C42URL\uFF1A${options.url}
|
|
861
858
|
\u9519\u8BEF\u4EE3\u7801\uFF1A${result.code}\uFF0C
|
|
862
859
|
\u542B\u4E49\uFF1A${errorMessage}`;
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
860
|
+
logger.warn(warningMessage);
|
|
861
|
+
throw {
|
|
862
|
+
...result,
|
|
863
|
+
warning: warningMessage
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
} catch (error) {
|
|
867
|
+
if (error && typeof error === "object") {
|
|
868
|
+
return {
|
|
869
|
+
...error,
|
|
870
|
+
warning: error.warning || "\u672A\u77E5\u9519\u8BEF"
|
|
871
|
+
};
|
|
872
|
+
}
|
|
868
873
|
}
|
|
869
874
|
};
|
|
870
875
|
var errorMap = {
|
|
@@ -1884,22 +1889,30 @@ var fetchPaginatedData = async (apiUrlGenerator, params, maxPageSize, headers2)
|
|
|
1884
1889
|
return finalResponse;
|
|
1885
1890
|
};
|
|
1886
1891
|
async function GlobalGetData2(options) {
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1892
|
+
try {
|
|
1893
|
+
const result = await new Networks(options).getData();
|
|
1894
|
+
if (result === "" || !result) {
|
|
1895
|
+
const warningMessage = `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01\u63A5\u53E3\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A
|
|
1890
1896
|
\u4F60\u7684\u6296\u97F3ck\u53EF\u80FD\u5DF2\u7ECF\u5931\u6548\uFF01
|
|
1891
1897
|
\u8BF7\u6C42\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
1892
1898
|
\u8BF7\u6C42URL\uFF1A ${options.url}`;
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1899
|
+
logger.warn(warningMessage);
|
|
1900
|
+
throw {
|
|
1901
|
+
...result,
|
|
1902
|
+
code: result.status_code,
|
|
1903
|
+
warning: warningMessage
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1906
|
+
return result;
|
|
1907
|
+
} catch (error) {
|
|
1908
|
+
if (error && typeof error === "object") {
|
|
1909
|
+
return {
|
|
1910
|
+
...error,
|
|
1911
|
+
code: error.status_code || 500,
|
|
1912
|
+
warning: error.warning || "\u672A\u77E5\u9519\u8BEF"
|
|
1913
|
+
};
|
|
1914
|
+
}
|
|
1901
1915
|
}
|
|
1902
|
-
return ResponseData;
|
|
1903
1916
|
}
|
|
1904
1917
|
|
|
1905
1918
|
// src/platform/kuaishou/API.ts
|
|
@@ -2074,23 +2087,32 @@ var KuaishouData = async (data2, cookie) => {
|
|
|
2074
2087
|
}
|
|
2075
2088
|
};
|
|
2076
2089
|
async function GlobalGetData3(options) {
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2090
|
+
try {
|
|
2091
|
+
const result = await new Networks(options).getData();
|
|
2092
|
+
if (result === "" || !result || result.result === 2) {
|
|
2093
|
+
const warningMessage = `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01\u63A5\u53E3\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A
|
|
2080
2094
|
\u4F60\u7684\u5FEB\u624Bck\u53EF\u80FD\u5DF2\u7ECF\u5931\u6548\uFF01
|
|
2081
|
-
\u8BF7\u6C42\u7C7B\u578B\uFF1A${options.methodType}
|
|
2095
|
+
\u8BF7\u6C42\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
2082
2096
|
\u8BF7\u6C42URL\uFF1A${options.url}
|
|
2083
2097
|
\u8BF7\u6C42\u53C2\u6570\uFF1A${JSON.stringify(options.body, null, 2)}`;
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2098
|
+
logger.warn(warningMessage);
|
|
2099
|
+
throw {
|
|
2100
|
+
...result,
|
|
2101
|
+
code: result.result,
|
|
2102
|
+
warning: warningMessage
|
|
2103
|
+
};
|
|
2104
|
+
}
|
|
2105
|
+
return result;
|
|
2106
|
+
} catch (error) {
|
|
2107
|
+
if (error && typeof error === "object") {
|
|
2108
|
+
return {
|
|
2109
|
+
...error,
|
|
2110
|
+
code: error.result || 500,
|
|
2111
|
+
message: error.error_msg,
|
|
2112
|
+
warning: error.warning || "\u672A\u77E5\u9519\u8BEF"
|
|
2113
|
+
};
|
|
2114
|
+
}
|
|
2092
2115
|
}
|
|
2093
|
-
return ResponseData;
|
|
2094
2116
|
}
|
|
2095
2117
|
|
|
2096
2118
|
// src/model/DataFetchers.ts
|
|
@@ -2117,7 +2139,7 @@ async function getBilibiliData(methodType, arg2, arg3) {
|
|
|
2117
2139
|
options = arg2;
|
|
2118
2140
|
cookie = arg3;
|
|
2119
2141
|
}
|
|
2120
|
-
const data2 = await
|
|
2142
|
+
const data2 = await fetchBilibili({ ...options, methodType }, cookie);
|
|
2121
2143
|
return data2;
|
|
2122
2144
|
}
|
|
2123
2145
|
async function getKuaishouData(methodType, arg2, arg3) {
|
|
@@ -226,7 +226,7 @@ var bilibili = {
|
|
|
226
226
|
*/
|
|
227
227
|
getVideoInfo: async (options, cookie) => {
|
|
228
228
|
const { typeMode, ...restOptions } = options;
|
|
229
|
-
const data2 = await
|
|
229
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E" }, cookie);
|
|
230
230
|
return data2;
|
|
231
231
|
},
|
|
232
232
|
/**
|
|
@@ -237,7 +237,7 @@ var bilibili = {
|
|
|
237
237
|
*/
|
|
238
238
|
getVideoStream: async (options, cookie) => {
|
|
239
239
|
const { typeMode, ...restOptions } = options;
|
|
240
|
-
const data2 = await
|
|
240
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u5355\u4E2A\u89C6\u9891\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E" }, cookie);
|
|
241
241
|
return data2;
|
|
242
242
|
},
|
|
243
243
|
/**
|
|
@@ -248,7 +248,7 @@ var bilibili = {
|
|
|
248
248
|
*/
|
|
249
249
|
getComments: async (options, cookie) => {
|
|
250
250
|
const { typeMode, ...restOptions } = options;
|
|
251
|
-
const data2 = await
|
|
251
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u8BC4\u8BBA\u6570\u636E" }, cookie);
|
|
252
252
|
return data2;
|
|
253
253
|
},
|
|
254
254
|
/**
|
|
@@ -259,7 +259,7 @@ var bilibili = {
|
|
|
259
259
|
*/
|
|
260
260
|
getUserProfile: async (options, cookie) => {
|
|
261
261
|
const { typeMode, ...restOptions } = options;
|
|
262
|
-
const data2 = await
|
|
262
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E" }, cookie);
|
|
263
263
|
return data2;
|
|
264
264
|
},
|
|
265
265
|
/**
|
|
@@ -270,7 +270,7 @@ var bilibili = {
|
|
|
270
270
|
*/
|
|
271
271
|
getUserDynamic: async (options, cookie) => {
|
|
272
272
|
const { typeMode, ...restOptions } = options;
|
|
273
|
-
const data2 = await
|
|
273
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u7528\u6237\u4E3B\u9875\u52A8\u6001\u5217\u8868\u6570\u636E" }, cookie);
|
|
274
274
|
return data2;
|
|
275
275
|
},
|
|
276
276
|
/**
|
|
@@ -281,7 +281,7 @@ var bilibili = {
|
|
|
281
281
|
*/
|
|
282
282
|
getEmojiList: async (options, cookie) => {
|
|
283
283
|
const { typeMode, ...restOptions } = options;
|
|
284
|
-
const data2 = await
|
|
284
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "Emoji\u6570\u636E" }, cookie);
|
|
285
285
|
return data2;
|
|
286
286
|
},
|
|
287
287
|
/**
|
|
@@ -292,7 +292,7 @@ var bilibili = {
|
|
|
292
292
|
*/
|
|
293
293
|
getBangumiInfo: async (options, cookie) => {
|
|
294
294
|
const { typeMode, ...restOptions } = options;
|
|
295
|
-
const data2 = await
|
|
295
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u756A\u5267\u57FA\u672C\u4FE1\u606F\u6570\u636E" }, cookie);
|
|
296
296
|
return data2;
|
|
297
297
|
},
|
|
298
298
|
/**
|
|
@@ -303,7 +303,7 @@ var bilibili = {
|
|
|
303
303
|
*/
|
|
304
304
|
getBangumiStream: async (options, cookie) => {
|
|
305
305
|
const { typeMode, ...restOptions } = options;
|
|
306
|
-
const data2 = await
|
|
306
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u756A\u5267\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E" }, cookie);
|
|
307
307
|
return data2;
|
|
308
308
|
},
|
|
309
309
|
/**
|
|
@@ -314,7 +314,7 @@ var bilibili = {
|
|
|
314
314
|
*/
|
|
315
315
|
getDynamicInfo: async (options, cookie) => {
|
|
316
316
|
const { typeMode, ...restOptions } = options;
|
|
317
|
-
const data2 = await
|
|
317
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u52A8\u6001\u8BE6\u60C5\u6570\u636E" }, cookie);
|
|
318
318
|
return data2;
|
|
319
319
|
},
|
|
320
320
|
/**
|
|
@@ -325,7 +325,7 @@ var bilibili = {
|
|
|
325
325
|
*/
|
|
326
326
|
getDynamicCard: async (options, cookie) => {
|
|
327
327
|
const { typeMode, ...restOptions } = options;
|
|
328
|
-
const data2 = await
|
|
328
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u52A8\u6001\u5361\u7247\u6570\u636E" }, cookie);
|
|
329
329
|
return data2;
|
|
330
330
|
},
|
|
331
331
|
/**
|
|
@@ -336,7 +336,7 @@ var bilibili = {
|
|
|
336
336
|
*/
|
|
337
337
|
getLiveRoomDetail: async (options, cookie) => {
|
|
338
338
|
const { typeMode, ...restOptions } = options;
|
|
339
|
-
const data2 = await
|
|
339
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F" }, cookie);
|
|
340
340
|
return data2;
|
|
341
341
|
},
|
|
342
342
|
/**
|
|
@@ -347,7 +347,7 @@ var bilibili = {
|
|
|
347
347
|
*/
|
|
348
348
|
getLiveRoomInitInfo: async (options, cookie) => {
|
|
349
349
|
const { typeMode, ...restOptions } = options;
|
|
350
|
-
const data2 = await
|
|
350
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u76F4\u64AD\u95F4\u521D\u59CB\u5316\u4FE1\u606F" }, cookie);
|
|
351
351
|
return data2;
|
|
352
352
|
},
|
|
353
353
|
/**
|
|
@@ -358,7 +358,7 @@ var bilibili = {
|
|
|
358
358
|
*/
|
|
359
359
|
getLoginBasicInfo: async (options, cookie) => {
|
|
360
360
|
const { typeMode, ...restOptions } = options;
|
|
361
|
-
const data2 = await
|
|
361
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u767B\u5F55\u57FA\u672C\u4FE1\u606F" }, cookie);
|
|
362
362
|
return data2;
|
|
363
363
|
},
|
|
364
364
|
/**
|
|
@@ -369,7 +369,7 @@ var bilibili = {
|
|
|
369
369
|
*/
|
|
370
370
|
getLoginQrcode: async (options, cookie) => {
|
|
371
371
|
const { typeMode, ...restOptions } = options;
|
|
372
|
-
const data2 = await
|
|
372
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u7533\u8BF7\u4E8C\u7EF4\u7801" }, cookie);
|
|
373
373
|
return data2;
|
|
374
374
|
},
|
|
375
375
|
/**
|
|
@@ -380,7 +380,7 @@ var bilibili = {
|
|
|
380
380
|
*/
|
|
381
381
|
checkQrcodeStatus: async (options, cookie) => {
|
|
382
382
|
const { typeMode, ...restOptions } = options;
|
|
383
|
-
const data2 = await
|
|
383
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u4E8C\u7EF4\u7801\u72B6\u6001" }, cookie);
|
|
384
384
|
return data2;
|
|
385
385
|
},
|
|
386
386
|
/**
|
|
@@ -391,7 +391,7 @@ var bilibili = {
|
|
|
391
391
|
*/
|
|
392
392
|
getUserTotalPlayCount: async (options, cookie) => {
|
|
393
393
|
const { typeMode, ...restOptions } = options;
|
|
394
|
-
const data2 = await
|
|
394
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "\u83B7\u53D6UP\u4E3B\u603B\u64AD\u653E\u91CF" }, cookie);
|
|
395
395
|
return data2;
|
|
396
396
|
},
|
|
397
397
|
/**
|
|
@@ -402,7 +402,7 @@ var bilibili = {
|
|
|
402
402
|
*/
|
|
403
403
|
convertAvToBv: async (options, cookie) => {
|
|
404
404
|
const { typeMode, ...restOptions } = options;
|
|
405
|
-
const data2 = await
|
|
405
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "AV\u8F6CBV" }, cookie);
|
|
406
406
|
return data2;
|
|
407
407
|
},
|
|
408
408
|
/**
|
|
@@ -413,40 +413,40 @@ var bilibili = {
|
|
|
413
413
|
*/
|
|
414
414
|
convertBvToAv: async (options, cookie) => {
|
|
415
415
|
const { typeMode, ...restOptions } = options;
|
|
416
|
-
const data2 = await
|
|
416
|
+
const data2 = await fetchBilibili({ ...restOptions, methodType: "BV\u8F6CAV" }, cookie);
|
|
417
417
|
return data2;
|
|
418
418
|
}
|
|
419
419
|
};
|
|
420
420
|
var registerBilibiliRoutes = (cookie) => {
|
|
421
421
|
const router = express.Router();
|
|
422
422
|
router.get("/new_login_qrcode", async (req, res) => {
|
|
423
|
-
const data2 = await
|
|
423
|
+
const data2 = await fetchBilibili({
|
|
424
424
|
methodType: "\u7533\u8BF7\u4E8C\u7EF4\u7801"
|
|
425
425
|
}, req.headers.cookie || cookie);
|
|
426
426
|
res.json(data2);
|
|
427
427
|
});
|
|
428
428
|
router.get("/check_qrcode", async (req, res) => {
|
|
429
|
-
const data2 = await
|
|
429
|
+
const data2 = await fetchBilibili({
|
|
430
430
|
methodType: "\u4E8C\u7EF4\u7801\u72B6\u6001",
|
|
431
431
|
qrcode_key: req.query.qrcode_key
|
|
432
432
|
}, req.headers.cookie || cookie);
|
|
433
433
|
res.json(data2);
|
|
434
434
|
});
|
|
435
435
|
router.get("/login_basic_info", async (req, res) => {
|
|
436
|
-
const data2 = await
|
|
436
|
+
const data2 = await fetchBilibili({
|
|
437
437
|
methodType: "\u767B\u5F55\u57FA\u672C\u4FE1\u606F"
|
|
438
438
|
}, req.headers.cookie || cookie);
|
|
439
439
|
res.json(data2);
|
|
440
440
|
});
|
|
441
441
|
router.get("/fetch_one_video", async (req, res) => {
|
|
442
|
-
const data2 = await
|
|
442
|
+
const data2 = await fetchBilibili({
|
|
443
443
|
methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
|
|
444
444
|
bvid: req.query.bvid
|
|
445
445
|
}, req.headers.cookie || cookie);
|
|
446
446
|
res.json(data2);
|
|
447
447
|
});
|
|
448
448
|
router.get("/fetch_video_playurl", async (req, res) => {
|
|
449
|
-
const data2 = await
|
|
449
|
+
const data2 = await fetchBilibili({
|
|
450
450
|
methodType: "\u5355\u4E2A\u89C6\u9891\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
|
|
451
451
|
avid: parseInt(req.query.avid),
|
|
452
452
|
cid: parseInt(req.query.cid)
|
|
@@ -454,7 +454,7 @@ var registerBilibiliRoutes = (cookie) => {
|
|
|
454
454
|
res.json(data2);
|
|
455
455
|
});
|
|
456
456
|
router.get("/fetch_work_comments", async (req, res) => {
|
|
457
|
-
const data2 = await
|
|
457
|
+
const data2 = await fetchBilibili({
|
|
458
458
|
methodType: "\u8BC4\u8BBA\u6570\u636E",
|
|
459
459
|
oid: Number(req.query.oid),
|
|
460
460
|
number: Number(req.query.number),
|
|
@@ -463,20 +463,20 @@ var registerBilibiliRoutes = (cookie) => {
|
|
|
463
463
|
res.json(data2);
|
|
464
464
|
});
|
|
465
465
|
router.get("/fetch_work_comments", async (req, res) => {
|
|
466
|
-
const data2 = await
|
|
466
|
+
const data2 = await fetchBilibili({
|
|
467
467
|
methodType: "Emoji\u6570\u636E"
|
|
468
468
|
}, req.headers.cookie || cookie);
|
|
469
469
|
res.json(data2);
|
|
470
470
|
});
|
|
471
471
|
router.get("/fetch_bangumi_video_info", async (req, res) => {
|
|
472
|
-
const data2 = await
|
|
472
|
+
const data2 = await fetchBilibili({
|
|
473
473
|
methodType: "\u756A\u5267\u57FA\u672C\u4FE1\u606F\u6570\u636E",
|
|
474
474
|
ep_id: req.query.ep_id
|
|
475
475
|
}, req.headers.cookie || cookie);
|
|
476
476
|
res.json(data2);
|
|
477
477
|
});
|
|
478
478
|
router.get("/fetch_bangumi_video_playurl", async (req, res) => {
|
|
479
|
-
const data2 = await
|
|
479
|
+
const data2 = await fetchBilibili({
|
|
480
480
|
methodType: "\u756A\u5267\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
|
|
481
481
|
cid: parseInt(req.query.cid),
|
|
482
482
|
ep_id: req.query.ep_id
|
|
@@ -484,63 +484,63 @@ var registerBilibiliRoutes = (cookie) => {
|
|
|
484
484
|
res.json(data2);
|
|
485
485
|
});
|
|
486
486
|
router.get("/fetch_user_dynamic", async (req, res) => {
|
|
487
|
-
const data2 = await
|
|
487
|
+
const data2 = await fetchBilibili({
|
|
488
488
|
methodType: "\u7528\u6237\u4E3B\u9875\u52A8\u6001\u5217\u8868\u6570\u636E",
|
|
489
489
|
host_mid: parseInt(req.query.host_mid)
|
|
490
490
|
}, req.headers.cookie || cookie);
|
|
491
491
|
res.json(data2);
|
|
492
492
|
});
|
|
493
493
|
router.get("/fetch_dynamic_info", async (req, res) => {
|
|
494
|
-
const data2 = await
|
|
494
|
+
const data2 = await fetchBilibili({
|
|
495
495
|
methodType: "\u52A8\u6001\u8BE6\u60C5\u6570\u636E",
|
|
496
496
|
dynamic_id: req.query.dynamic_id
|
|
497
497
|
}, req.headers.cookie || cookie);
|
|
498
498
|
res.json(data2);
|
|
499
499
|
});
|
|
500
500
|
router.get("/fetch_dynamic_card", async (req, res) => {
|
|
501
|
-
const data2 = await
|
|
501
|
+
const data2 = await fetchBilibili({
|
|
502
502
|
methodType: "\u52A8\u6001\u5361\u7247\u6570\u636E",
|
|
503
503
|
dynamic_id: req.query.dynamic_id
|
|
504
504
|
}, req.headers.cookie || cookie);
|
|
505
505
|
res.json(data2);
|
|
506
506
|
});
|
|
507
507
|
router.get("/fetch_user_profile", async (req, res) => {
|
|
508
|
-
const data2 = await
|
|
508
|
+
const data2 = await fetchBilibili({
|
|
509
509
|
methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E",
|
|
510
510
|
host_mid: parseInt(req.query.host_mid)
|
|
511
511
|
}, req.headers.cookie || cookie);
|
|
512
512
|
res.json(data2);
|
|
513
513
|
});
|
|
514
514
|
router.get("/fetch_live_room_detail", async (req, res) => {
|
|
515
|
-
const data2 = await
|
|
515
|
+
const data2 = await fetchBilibili({
|
|
516
516
|
methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F",
|
|
517
517
|
room_id: req.query.room_id
|
|
518
518
|
}, req.headers.cookie || cookie);
|
|
519
519
|
res.json(data2);
|
|
520
520
|
});
|
|
521
521
|
router.get("/fetch_liveroom_def", async (req, res) => {
|
|
522
|
-
const data2 = await
|
|
522
|
+
const data2 = await fetchBilibili({
|
|
523
523
|
methodType: "\u76F4\u64AD\u95F4\u521D\u59CB\u5316\u4FE1\u606F",
|
|
524
524
|
room_id: req.query.room_id
|
|
525
525
|
}, req.headers.cookie || cookie);
|
|
526
526
|
res.json(data2);
|
|
527
527
|
});
|
|
528
528
|
router.get("/bv_to_av", async (req, res) => {
|
|
529
|
-
const data2 = await
|
|
529
|
+
const data2 = await fetchBilibili({
|
|
530
530
|
methodType: "BV\u8F6CAV",
|
|
531
531
|
bvid: req.query.bvid
|
|
532
532
|
}, req.headers.cookie || cookie);
|
|
533
533
|
res.json(data2);
|
|
534
534
|
});
|
|
535
535
|
router.get("/av_to_bv", async (req, res) => {
|
|
536
|
-
const data2 = await
|
|
536
|
+
const data2 = await fetchBilibili({
|
|
537
537
|
methodType: "AV\u8F6CBV",
|
|
538
538
|
avid: parseInt(req.query.avid)
|
|
539
539
|
}, req.headers.cookie || cookie);
|
|
540
540
|
res.json(data2);
|
|
541
541
|
});
|
|
542
542
|
router.get("/fetch_user_full_view", async (req, res) => {
|
|
543
|
-
const data2 = await
|
|
543
|
+
const data2 = await fetchBilibili({
|
|
544
544
|
methodType: "\u83B7\u53D6UP\u4E3B\u603B\u64AD\u653E\u91CF",
|
|
545
545
|
host_mid: parseInt(req.query.host_mid)
|
|
546
546
|
}, req.headers.cookie || cookie);
|
|
@@ -577,7 +577,7 @@ var defheaders = {
|
|
|
577
577
|
"upgrade-insecure-requests": "1",
|
|
578
578
|
referer: "https://www.bilibili.com/"
|
|
579
579
|
};
|
|
580
|
-
var
|
|
580
|
+
var fetchBilibili = async (data2, cookie) => {
|
|
581
581
|
const headers2 = {
|
|
582
582
|
...defheaders,
|
|
583
583
|
cookie: cookie ? cookie.replace(/\s+/g, "") : ""
|
|
@@ -613,55 +613,51 @@ var BilibiliData = async (data2, cookie) => {
|
|
|
613
613
|
let stabilizedCount = 0;
|
|
614
614
|
let requestCount = 0;
|
|
615
615
|
let tmpresp;
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
requestCount = Math.min(20, Number(number) - fetchedComments.length);
|
|
622
|
-
}
|
|
623
|
-
const url = bilibiliApiUrls.\u8BC4\u8BBA\u533A\u660E\u7EC6({
|
|
624
|
-
type,
|
|
625
|
-
oid,
|
|
626
|
-
number: requestCount,
|
|
627
|
-
pn
|
|
628
|
-
});
|
|
629
|
-
const checkStatusUrl = bilibiliApiUrls.\u8BC4\u8BBA\u533A\u72B6\u6001({ oid, type });
|
|
630
|
-
const checkStatusRes = await GlobalGetData({
|
|
631
|
-
url: checkStatusUrl,
|
|
632
|
-
headers: headers2,
|
|
633
|
-
...data2
|
|
634
|
-
});
|
|
635
|
-
if (checkStatusRes.data === null) {
|
|
636
|
-
logger.error("\u8BC4\u8BBA\u533A\u672A\u5F00\u653E");
|
|
637
|
-
return {
|
|
638
|
-
code: 404,
|
|
639
|
-
message: "\u8BC4\u8BBA\u533A\u672A\u5F00\u653E",
|
|
640
|
-
data: null
|
|
641
|
-
};
|
|
642
|
-
}
|
|
643
|
-
const response = await GlobalGetData({
|
|
644
|
-
url,
|
|
645
|
-
headers: headers2,
|
|
646
|
-
...data2
|
|
647
|
-
});
|
|
648
|
-
tmpresp = response;
|
|
649
|
-
const currentCount = response.data.replies ? response.data.replies.length : 0;
|
|
650
|
-
fetchedComments.push(...response.data.replies || []);
|
|
651
|
-
if (currentCount === lastFetchedCount) {
|
|
652
|
-
stabilizedCount++;
|
|
653
|
-
} else {
|
|
654
|
-
stabilizedCount = 0;
|
|
655
|
-
}
|
|
656
|
-
lastFetchedCount = currentCount;
|
|
657
|
-
if (stabilizedCount >= commentGrowthStabilized || requestCount >= maxRequestCount) {
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
pn++;
|
|
661
|
-
requestCount++;
|
|
616
|
+
while (fetchedComments.length < Number(number ?? 20) && requestCount < maxRequestCount) {
|
|
617
|
+
if (number === 0 || number === void 0) {
|
|
618
|
+
requestCount = 0;
|
|
619
|
+
} else {
|
|
620
|
+
requestCount = Math.min(20, Number(number) - fetchedComments.length);
|
|
662
621
|
}
|
|
663
|
-
|
|
664
|
-
|
|
622
|
+
const url = bilibiliApiUrls.\u8BC4\u8BBA\u533A\u660E\u7EC6({
|
|
623
|
+
type,
|
|
624
|
+
oid,
|
|
625
|
+
number: requestCount,
|
|
626
|
+
pn
|
|
627
|
+
});
|
|
628
|
+
const checkStatusUrl = bilibiliApiUrls.\u8BC4\u8BBA\u533A\u72B6\u6001({ oid, type });
|
|
629
|
+
const checkStatusRes = await GlobalGetData({
|
|
630
|
+
url: checkStatusUrl,
|
|
631
|
+
headers: headers2,
|
|
632
|
+
...data2
|
|
633
|
+
});
|
|
634
|
+
if (checkStatusRes.data === null) {
|
|
635
|
+
logger.error("\u8BC4\u8BBA\u533A\u672A\u5F00\u653E");
|
|
636
|
+
return {
|
|
637
|
+
code: 404,
|
|
638
|
+
message: "\u8BC4\u8BBA\u533A\u672A\u5F00\u653E",
|
|
639
|
+
data: null
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
const response = await GlobalGetData({
|
|
643
|
+
url,
|
|
644
|
+
headers: headers2,
|
|
645
|
+
...data2
|
|
646
|
+
});
|
|
647
|
+
tmpresp = response;
|
|
648
|
+
const currentCount = response.data.replies ? response.data.replies.length : 0;
|
|
649
|
+
fetchedComments.push(...response.data.replies || []);
|
|
650
|
+
if (currentCount === lastFetchedCount) {
|
|
651
|
+
stabilizedCount++;
|
|
652
|
+
} else {
|
|
653
|
+
stabilizedCount = 0;
|
|
654
|
+
}
|
|
655
|
+
lastFetchedCount = currentCount;
|
|
656
|
+
if (stabilizedCount >= commentGrowthStabilized || requestCount >= maxRequestCount) {
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
pn++;
|
|
660
|
+
requestCount++;
|
|
665
661
|
}
|
|
666
662
|
const finalResponse = {
|
|
667
663
|
...tmpresp,
|
|
@@ -827,32 +823,41 @@ var BilibiliData = async (data2, cookie) => {
|
|
|
827
823
|
}
|
|
828
824
|
};
|
|
829
825
|
var GlobalGetData = async (options) => {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
826
|
+
try {
|
|
827
|
+
const result = await new Networks(options).getData();
|
|
828
|
+
if (result && result.code === 0) {
|
|
829
|
+
return result;
|
|
830
|
+
} else if (result.code === 12061) {
|
|
831
|
+
const warningMessage = `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01
|
|
835
832
|
\u8BF7\u6C42\u63A5\u53E3\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
836
833
|
\u8BF7\u6C42URL\uFF1A${options.url}
|
|
837
834
|
\u9519\u8BEF\u4EE3\u7801\uFF1A${result.code}\uFF0C
|
|
838
835
|
\u542B\u4E49\uFF1A${result.message}`;
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
836
|
+
logger.warn(warningMessage);
|
|
837
|
+
throw {
|
|
838
|
+
...result,
|
|
839
|
+
warning: warningMessage
|
|
840
|
+
};
|
|
841
|
+
} else {
|
|
842
|
+
const errorMessage = errorMap[result.code] || result.message || "\u672A\u77E5\u9519\u8BEF";
|
|
843
|
+
const warningMessage = `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01
|
|
847
844
|
\u8BF7\u6C42\u63A5\u53E3\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
848
845
|
\u8BF7\u6C42URL\uFF1A${options.url}
|
|
849
846
|
\u9519\u8BEF\u4EE3\u7801\uFF1A${result.code}\uFF0C
|
|
850
847
|
\u542B\u4E49\uFF1A${errorMessage}`;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
848
|
+
logger.warn(warningMessage);
|
|
849
|
+
throw {
|
|
850
|
+
...result,
|
|
851
|
+
warning: warningMessage
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
} catch (error) {
|
|
855
|
+
if (error && typeof error === "object") {
|
|
856
|
+
return {
|
|
857
|
+
...error,
|
|
858
|
+
warning: error.warning || "\u672A\u77E5\u9519\u8BEF"
|
|
859
|
+
};
|
|
860
|
+
}
|
|
856
861
|
}
|
|
857
862
|
};
|
|
858
863
|
var errorMap = {
|
|
@@ -1872,22 +1877,30 @@ var fetchPaginatedData = async (apiUrlGenerator, params, maxPageSize, headers2)
|
|
|
1872
1877
|
return finalResponse;
|
|
1873
1878
|
};
|
|
1874
1879
|
async function GlobalGetData2(options) {
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1880
|
+
try {
|
|
1881
|
+
const result = await new Networks(options).getData();
|
|
1882
|
+
if (result === "" || !result) {
|
|
1883
|
+
const warningMessage = `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01\u63A5\u53E3\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A
|
|
1878
1884
|
\u4F60\u7684\u6296\u97F3ck\u53EF\u80FD\u5DF2\u7ECF\u5931\u6548\uFF01
|
|
1879
1885
|
\u8BF7\u6C42\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
1880
1886
|
\u8BF7\u6C42URL\uFF1A ${options.url}`;
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1887
|
+
logger.warn(warningMessage);
|
|
1888
|
+
throw {
|
|
1889
|
+
...result,
|
|
1890
|
+
code: result.status_code,
|
|
1891
|
+
warning: warningMessage
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1894
|
+
return result;
|
|
1895
|
+
} catch (error) {
|
|
1896
|
+
if (error && typeof error === "object") {
|
|
1897
|
+
return {
|
|
1898
|
+
...error,
|
|
1899
|
+
code: error.status_code || 500,
|
|
1900
|
+
warning: error.warning || "\u672A\u77E5\u9519\u8BEF"
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1889
1903
|
}
|
|
1890
|
-
return ResponseData;
|
|
1891
1904
|
}
|
|
1892
1905
|
|
|
1893
1906
|
// src/platform/kuaishou/API.ts
|
|
@@ -2062,23 +2075,32 @@ var KuaishouData = async (data2, cookie) => {
|
|
|
2062
2075
|
}
|
|
2063
2076
|
};
|
|
2064
2077
|
async function GlobalGetData3(options) {
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2078
|
+
try {
|
|
2079
|
+
const result = await new Networks(options).getData();
|
|
2080
|
+
if (result === "" || !result || result.result === 2) {
|
|
2081
|
+
const warningMessage = `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01\u63A5\u53E3\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A
|
|
2068
2082
|
\u4F60\u7684\u5FEB\u624Bck\u53EF\u80FD\u5DF2\u7ECF\u5931\u6548\uFF01
|
|
2069
|
-
\u8BF7\u6C42\u7C7B\u578B\uFF1A${options.methodType}
|
|
2083
|
+
\u8BF7\u6C42\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
2070
2084
|
\u8BF7\u6C42URL\uFF1A${options.url}
|
|
2071
2085
|
\u8BF7\u6C42\u53C2\u6570\uFF1A${JSON.stringify(options.body, null, 2)}`;
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2086
|
+
logger.warn(warningMessage);
|
|
2087
|
+
throw {
|
|
2088
|
+
...result,
|
|
2089
|
+
code: result.result,
|
|
2090
|
+
warning: warningMessage
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
return result;
|
|
2094
|
+
} catch (error) {
|
|
2095
|
+
if (error && typeof error === "object") {
|
|
2096
|
+
return {
|
|
2097
|
+
...error,
|
|
2098
|
+
code: error.result || 500,
|
|
2099
|
+
message: error.error_msg,
|
|
2100
|
+
warning: error.warning || "\u672A\u77E5\u9519\u8BEF"
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2080
2103
|
}
|
|
2081
|
-
return ResponseData;
|
|
2082
2104
|
}
|
|
2083
2105
|
|
|
2084
2106
|
// src/model/DataFetchers.ts
|
|
@@ -2105,7 +2127,7 @@ async function getBilibiliData(methodType, arg2, arg3) {
|
|
|
2105
2127
|
options = arg2;
|
|
2106
2128
|
cookie = arg3;
|
|
2107
2129
|
}
|
|
2108
|
-
const data2 = await
|
|
2130
|
+
const data2 = await fetchBilibili({ ...options, methodType }, cookie);
|
|
2109
2131
|
return data2;
|
|
2110
2132
|
}
|
|
2111
2133
|
async function getKuaishouData(methodType, arg2, arg3) {
|