@ikenxuan/amagi 4.4.14 → 4.4.16
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 +178 -144
- package/dist/default/esm/index.mjs +178 -144
- package/dist/default/index.d.ts +31 -76
- package/package.json +3 -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 = {
|
|
@@ -1655,7 +1660,7 @@ var douyinUtils = {
|
|
|
1655
1660
|
var defheaders2 = {
|
|
1656
1661
|
accept: "*/*",
|
|
1657
1662
|
priority: "u=0, i",
|
|
1658
|
-
"content-type": "application/json",
|
|
1663
|
+
"content-type": "application/json; charset=utf-8",
|
|
1659
1664
|
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
1660
1665
|
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
|
|
1661
1666
|
referer: "https://www.douyin.com/",
|
|
@@ -1884,22 +1889,46 @@ var fetchPaginatedData = async (apiUrlGenerator, params, maxPageSize, headers2)
|
|
|
1884
1889
|
return finalResponse;
|
|
1885
1890
|
};
|
|
1886
1891
|
async function GlobalGetData2(options) {
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
\
|
|
1892
|
-
\
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1892
|
+
try {
|
|
1893
|
+
const result = await new Networks(options).getData();
|
|
1894
|
+
if (result === "" || !result) {
|
|
1895
|
+
const warningMessage = `
|
|
1896
|
+
\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01\u63A5\u53E3\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A
|
|
1897
|
+
\u4F60\u7684\u6296\u97F3ck\u53EF\u80FD\u5DF2\u7ECF\u5931\u6548\uFF01
|
|
1898
|
+
\u8BF7\u6C42\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
1899
|
+
\u8BF7\u6C42URL\uFF1A ${options.url}
|
|
1900
|
+
`;
|
|
1901
|
+
logger.warn(warningMessage);
|
|
1902
|
+
throw {
|
|
1903
|
+
...result,
|
|
1904
|
+
code: result.status_code,
|
|
1905
|
+
warning: warningMessage
|
|
1906
|
+
};
|
|
1907
|
+
}
|
|
1908
|
+
if (result.filter_detail && result.filter_detail.filter_reason) {
|
|
1909
|
+
const filterReason = result.filter_detail.filter_reason;
|
|
1910
|
+
const warningMessage = `
|
|
1911
|
+
\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01\u539F\u56E0\uFF1A${filterReason}
|
|
1912
|
+
\u8BF7\u6C42\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
1913
|
+
\u8BF7\u6C42URL\uFF1A ${options.url}
|
|
1914
|
+
`;
|
|
1915
|
+
logger.warn(warningMessage);
|
|
1916
|
+
throw {
|
|
1917
|
+
...result,
|
|
1918
|
+
code: result.status_code || 0,
|
|
1919
|
+
warning: warningMessage
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1922
|
+
return result;
|
|
1923
|
+
} catch (error) {
|
|
1924
|
+
if (error && typeof error === "object") {
|
|
1925
|
+
return {
|
|
1926
|
+
...error,
|
|
1927
|
+
code: error.status_code || 500,
|
|
1928
|
+
warning: error.warning || "\u672A\u77E5\u9519\u8BEF"
|
|
1929
|
+
};
|
|
1930
|
+
}
|
|
1901
1931
|
}
|
|
1902
|
-
return ResponseData;
|
|
1903
1932
|
}
|
|
1904
1933
|
|
|
1905
1934
|
// src/platform/kuaishou/API.ts
|
|
@@ -2074,23 +2103,32 @@ var KuaishouData = async (data2, cookie) => {
|
|
|
2074
2103
|
}
|
|
2075
2104
|
};
|
|
2076
2105
|
async function GlobalGetData3(options) {
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2106
|
+
try {
|
|
2107
|
+
const result = await new Networks(options).getData();
|
|
2108
|
+
if (result === "" || !result || result.result === 2) {
|
|
2109
|
+
const warningMessage = `\u83B7\u53D6\u54CD\u5E94\u6570\u636E\u5931\u8D25\uFF01\u63A5\u53E3\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A
|
|
2080
2110
|
\u4F60\u7684\u5FEB\u624Bck\u53EF\u80FD\u5DF2\u7ECF\u5931\u6548\uFF01
|
|
2081
|
-
\u8BF7\u6C42\u7C7B\u578B\uFF1A${options.methodType}
|
|
2111
|
+
\u8BF7\u6C42\u7C7B\u578B\uFF1A\u300C${options.methodType}\u300D
|
|
2082
2112
|
\u8BF7\u6C42URL\uFF1A${options.url}
|
|
2083
2113
|
\u8BF7\u6C42\u53C2\u6570\uFF1A${JSON.stringify(options.body, null, 2)}`;
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2114
|
+
logger.warn(warningMessage);
|
|
2115
|
+
throw {
|
|
2116
|
+
...result,
|
|
2117
|
+
code: result.result,
|
|
2118
|
+
warning: warningMessage
|
|
2119
|
+
};
|
|
2120
|
+
}
|
|
2121
|
+
return result;
|
|
2122
|
+
} catch (error) {
|
|
2123
|
+
if (error && typeof error === "object") {
|
|
2124
|
+
return {
|
|
2125
|
+
...error,
|
|
2126
|
+
code: error.result || 500,
|
|
2127
|
+
message: error.error_msg,
|
|
2128
|
+
warning: error.warning || "\u672A\u77E5\u9519\u8BEF"
|
|
2129
|
+
};
|
|
2130
|
+
}
|
|
2092
2131
|
}
|
|
2093
|
-
return ResponseData;
|
|
2094
2132
|
}
|
|
2095
2133
|
|
|
2096
2134
|
// src/model/DataFetchers.ts
|
|
@@ -2117,7 +2155,7 @@ async function getBilibiliData(methodType, arg2, arg3) {
|
|
|
2117
2155
|
options = arg2;
|
|
2118
2156
|
cookie = arg3;
|
|
2119
2157
|
}
|
|
2120
|
-
const data2 = await
|
|
2158
|
+
const data2 = await fetchBilibili({ ...options, methodType }, cookie);
|
|
2121
2159
|
return data2;
|
|
2122
2160
|
}
|
|
2123
2161
|
async function getKuaishouData(methodType, arg2, arg3) {
|
|
@@ -2476,17 +2514,13 @@ function createAmagiClient(options = {}) {
|
|
|
2476
2514
|
}
|
|
2477
2515
|
return new amagiClient(options);
|
|
2478
2516
|
}
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
/** 快手相关功能模块 (工具集) */
|
|
2487
|
-
kuaishou: kuaishouUtils
|
|
2488
|
-
}
|
|
2489
|
-
);
|
|
2517
|
+
createAmagiClient.douyin = douyinUtils;
|
|
2518
|
+
createAmagiClient.bilibili = bilibiliUtils;
|
|
2519
|
+
createAmagiClient.kuaishou = kuaishouUtils;
|
|
2520
|
+
createAmagiClient.getDouyinData = () => douyinUtils.getDouyinData;
|
|
2521
|
+
createAmagiClient.getBilibiliData = () => bilibiliUtils.getBilibiliData;
|
|
2522
|
+
createAmagiClient.getKuaishouData = () => kuaishouUtils.getKuaishouData;
|
|
2523
|
+
var CreateApp = createAmagiClient;
|
|
2490
2524
|
var Client = CreateApp;
|
|
2491
2525
|
var amagi = Client;
|
|
2492
2526
|
|