@ikenxuan/amagi 4.4.2 → 4.4.4

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.
@@ -1,8 +1,8 @@
1
+ import express from 'express';
1
2
  import axios, { AxiosError } from 'axios';
2
3
  import crypto from 'crypto';
3
4
  import chalk from 'chalk';
4
5
  import log4js from 'log4js';
5
- import Fastify from 'fastify';
6
6
 
7
7
  // src/platform/bilibili/API.ts
8
8
  var BiLiBiLiAPI = class {
@@ -416,163 +416,136 @@ async function qtparam(BASEURL, cookie) {
416
416
  return { QUERY: `&fnval=16&fourk=1&${sign}`, STATUS: "isLogin", isvip };
417
417
  } else return { QUERY: `&qn=${qn[3]}&fnval=16`, STATUS: "isLogin", isvip };
418
418
  }
419
-
420
- // src/platform/bilibili/routes.ts
421
- var registerBilibiliRoutes = (fastify, cookie) => {
422
- fastify.register(async (fastify2) => {
423
- await Promise.resolve();
424
- fastify2.get("/new_login_qrcode", async (request, reply) => {
425
- reply.type("application/json").send(
426
- await BilibiliData({
427
- methodType: "\u7533\u8BF7\u4E8C\u7EF4\u7801"
428
- })
429
- );
430
- });
431
- fastify2.get("/check_qrcode", async (request, reply) => {
432
- reply.type("application/json").send(
433
- await BilibiliData({
434
- methodType: "\u4E8C\u7EF4\u7801\u72B6\u6001",
435
- qrcode_key: request.query.qrcode_key
436
- })
437
- );
438
- });
439
- fastify2.get("/login_basic_info", async (request, reply) => {
440
- reply.type("application/json").send(
441
- await BilibiliData({
442
- methodType: "\u767B\u5F55\u57FA\u672C\u4FE1\u606F"
443
- }, request.headers.cookie)
444
- );
445
- });
446
- fastify2.get("/fetch_one_video", async (request, reply) => {
447
- reply.type("application/json").send(
448
- await BilibiliData({
449
- methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
450
- bvid: request.query.bvid
451
- }, request.headers.cookie ?? cookie)
452
- );
453
- });
454
- fastify2.get("/fetch_video_playurl", async (request, reply) => {
455
- reply.type("application/json").send(
456
- await BilibiliData({
457
- methodType: "\u5355\u4E2A\u89C6\u9891\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
458
- avid: request.query.avid,
459
- cid: request.query.cid
460
- }, request.headers.cookie ?? cookie)
461
- );
462
- });
463
- fastify2.get("/fetch_work_comments", async (request, reply) => {
464
- reply.type("application/json").send(
465
- await BilibiliData({
466
- methodType: "\u8BC4\u8BBA\u6570\u636E",
467
- oid: Number(request.query.oid),
468
- number: Number(request.query.number),
469
- type: Number(request.query.type ?? 1)
470
- }, request.headers.cookie ?? cookie)
471
- );
472
- });
473
- fastify2.get("/fetch_emoji_list", async (_request, reply) => {
474
- reply.type("application/json").send(
475
- await BilibiliData({
476
- methodType: "Emoji\u6570\u636E"
477
- })
478
- );
479
- });
480
- fastify2.get("/fetch_bangumi_video_info", async (request, reply) => {
481
- reply.type("application/json").send(
482
- await BilibiliData({
483
- methodType: "\u756A\u5267\u57FA\u672C\u4FE1\u606F\u6570\u636E",
484
- ep_id: request.query.ep_id
485
- }, request.headers.cookie ?? cookie)
486
- );
487
- });
488
- fastify2.get("/fetch_bangumi_video_playurl", async (request, reply) => {
489
- reply.type("application/json").send(
490
- await BilibiliData({
491
- methodType: "\u756A\u5267\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
492
- cid: request.query.cid,
493
- ep_id: request.query.ep_id
494
- }, request.headers.cookie ?? cookie)
495
- );
496
- });
497
- fastify2.get("/fetch_user_dynamic", async (request, reply) => {
498
- reply.type("application/json").send(
499
- await BilibiliData({
500
- methodType: "\u7528\u6237\u4E3B\u9875\u52A8\u6001\u5217\u8868\u6570\u636E",
501
- host_mid: request.query.host_mid
502
- }, request.headers.cookie ?? cookie)
503
- );
504
- });
505
- fastify2.get("/fetch_dynamic_info", async (request, reply) => {
506
- reply.type("application/json").send(
507
- await BilibiliData({
508
- methodType: "\u52A8\u6001\u8BE6\u60C5\u6570\u636E",
509
- dynamic_id: request.query.dynamic_id
510
- }, request.headers.cookie ?? cookie)
511
- );
512
- });
513
- fastify2.get("/fetch_dynamic_card", async (request, reply) => {
514
- reply.type("application/json").send(
515
- await BilibiliData(
516
- {
517
- methodType: "\u52A8\u6001\u5361\u7247\u6570\u636E",
518
- dynamic_id: request.query.dynamic_id
519
- },
520
- request.headers.cookie ?? cookie
521
- )
522
- );
523
- });
524
- fastify2.get("/fetch_user_profile", async (request, reply) => {
525
- reply.type("application/json").send(
526
- await BilibiliData(
527
- {
528
- methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E",
529
- host_mid: request.query.host_mid
530
- },
531
- request.headers.cookie ?? cookie
532
- )
533
- );
534
- });
535
- fastify2.get("/fetch_live_room_detail", async (request, reply) => {
536
- reply.type("application/json").send(
537
- await BilibiliData({
538
- methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F",
539
- room_id: request.query.room_id
540
- }, request.headers.cookie ?? cookie)
541
- );
542
- });
543
- fastify2.get("/fetch_liveroom_def", async (request, reply) => {
544
- reply.type("application/json").send(
545
- await BilibiliData({
546
- methodType: "\u76F4\u64AD\u95F4\u521D\u59CB\u5316\u4FE1\u606F",
547
- room_id: request.query.room_id
548
- }, request.headers.cookie ?? cookie)
549
- );
550
- });
551
- fastify2.get("/bv_to_av", async (request, reply) => {
552
- reply.type("application/json").send(
553
- await BilibiliData({
554
- methodType: "BV\u8F6CAV",
555
- bvid: request.query.bvid
556
- })
557
- );
558
- });
559
- fastify2.get("/av_to_bv", async (request, reply) => {
560
- reply.type("application/json").send(
561
- await BilibiliData({
562
- methodType: "AV\u8F6CBV",
563
- avid: request.query.avid
564
- })
565
- );
566
- });
567
- fastify2.get("/fetch_user_full_view", async (request, reply) => {
568
- reply.type("application/json").send(
569
- await BilibiliData({
570
- methodType: "\u83B7\u53D6UP\u4E3B\u603B\u64AD\u653E\u91CF",
571
- host_mid: request.query.host_mid
572
- }, request.headers.cookie ?? cookie)
573
- );
574
- });
575
- }, { prefix: "/api/bilibili" });
419
+ var registerBilibiliRoutes = (cookie) => {
420
+ const router = express.Router();
421
+ router.get("/new_login_qrcode", async (req, res) => {
422
+ const data2 = await BilibiliData({
423
+ methodType: "\u7533\u8BF7\u4E8C\u7EF4\u7801"
424
+ }, req.headers.cookie || cookie);
425
+ res.json(data2);
426
+ });
427
+ router.get("/check_qrcode", async (req, res) => {
428
+ const data2 = await BilibiliData({
429
+ methodType: "\u4E8C\u7EF4\u7801\u72B6\u6001",
430
+ qrcode_key: req.query.qrcode_key
431
+ }, req.headers.cookie || cookie);
432
+ res.json(data2);
433
+ });
434
+ router.get("/login_basic_info", async (req, res) => {
435
+ const data2 = await BilibiliData({
436
+ methodType: "\u767B\u5F55\u57FA\u672C\u4FE1\u606F"
437
+ }, req.headers.cookie || cookie);
438
+ res.json(data2);
439
+ });
440
+ router.get("/fetch_one_video", async (req, res) => {
441
+ const data2 = await BilibiliData({
442
+ methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
443
+ bvid: req.query.bvid
444
+ }, req.headers.cookie || cookie);
445
+ res.json(data2);
446
+ });
447
+ router.get("/fetch_video_playurl", async (req, res) => {
448
+ const data2 = await BilibiliData({
449
+ methodType: "\u5355\u4E2A\u89C6\u9891\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
450
+ avid: req.query.avid,
451
+ cid: req.query.cid
452
+ }, req.headers.cookie || cookie);
453
+ res.json(data2);
454
+ });
455
+ router.get("/fetch_work_comments", async (req, res) => {
456
+ const data2 = await BilibiliData({
457
+ methodType: "\u8BC4\u8BBA\u6570\u636E",
458
+ oid: Number(req.query.oid),
459
+ number: Number(req.query.number),
460
+ type: Number(req.query.type ?? 1)
461
+ }, req.headers.cookie || cookie);
462
+ res.json(data2);
463
+ });
464
+ router.get("/fetch_work_comments", async (req, res) => {
465
+ const data2 = await BilibiliData({
466
+ methodType: "Emoji\u6570\u636E"
467
+ }, req.headers.cookie || cookie);
468
+ res.json(data2);
469
+ });
470
+ router.get("/fetch_bangumi_video_info", async (req, res) => {
471
+ const data2 = await BilibiliData({
472
+ methodType: "\u756A\u5267\u57FA\u672C\u4FE1\u606F\u6570\u636E",
473
+ ep_id: req.query.ep_id
474
+ }, req.headers.cookie || cookie);
475
+ res.json(data2);
476
+ });
477
+ router.get("/fetch_bangumi_video_playurl", async (req, res) => {
478
+ const data2 = await BilibiliData({
479
+ methodType: "\u756A\u5267\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
480
+ cid: req.query.cid,
481
+ ep_id: req.query.ep_id
482
+ }, req.headers.cookie || cookie);
483
+ res.json(data2);
484
+ });
485
+ router.get("/fetch_user_dynamic", async (req, res) => {
486
+ const data2 = await BilibiliData({
487
+ methodType: "\u7528\u6237\u4E3B\u9875\u52A8\u6001\u5217\u8868\u6570\u636E",
488
+ host_mid: req.query.host_mid
489
+ }, req.headers.cookie || cookie);
490
+ res.json(data2);
491
+ });
492
+ router.get("/fetch_dynamic_info", async (req, res) => {
493
+ const data2 = await BilibiliData({
494
+ methodType: "\u52A8\u6001\u8BE6\u60C5\u6570\u636E",
495
+ dynamic_id: req.query.dynamic_id
496
+ }, req.headers.cookie || cookie);
497
+ res.json(data2);
498
+ });
499
+ router.get("/fetch_dynamic_card", async (req, res) => {
500
+ const data2 = await BilibiliData({
501
+ methodType: "\u52A8\u6001\u5361\u7247\u6570\u636E",
502
+ dynamic_id: req.query.dynamic_id
503
+ }, req.headers.cookie || cookie);
504
+ res.json(data2);
505
+ });
506
+ router.get("/fetch_user_profile", async (req, res) => {
507
+ const data2 = await BilibiliData({
508
+ methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E",
509
+ host_mid: req.query.host_mid
510
+ }, req.headers.cookie || cookie);
511
+ res.json(data2);
512
+ });
513
+ router.get("/fetch_live_room_detail", async (req, res) => {
514
+ const data2 = await BilibiliData({
515
+ methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F",
516
+ room_id: req.query.room_id
517
+ }, req.headers.cookie || cookie);
518
+ res.json(data2);
519
+ });
520
+ router.get("/fetch_liveroom_def", async (req, res) => {
521
+ const data2 = await BilibiliData({
522
+ methodType: "\u76F4\u64AD\u95F4\u521D\u59CB\u5316\u4FE1\u606F",
523
+ room_id: req.query.room_id
524
+ }, req.headers.cookie || cookie);
525
+ res.json(data2);
526
+ });
527
+ router.get("/bv_to_av", async (req, res) => {
528
+ const data2 = await BilibiliData({
529
+ methodType: "BV\u8F6CAV",
530
+ bvid: req.query.bvid
531
+ }, req.headers.cookie || cookie);
532
+ res.json(data2);
533
+ });
534
+ router.get("/av_to_bv", async (req, res) => {
535
+ const data2 = await BilibiliData({
536
+ methodType: "AV\u8F6CBV",
537
+ avid: req.query.avid
538
+ }, req.headers.cookie || cookie);
539
+ res.json(data2);
540
+ });
541
+ router.get("/fetch_user_full_view", async (req, res) => {
542
+ const data2 = await BilibiliData({
543
+ methodType: "\u83B7\u53D6UP\u4E3B\u603B\u64AD\u653E\u91CF",
544
+ host_mid: req.query.host_mid
545
+ }, req.headers.cookie || cookie);
546
+ res.json(data2);
547
+ });
548
+ return router;
576
549
  };
577
550
  var mixinKeyEncTab = [
578
551
  46,
@@ -1398,108 +1371,92 @@ async function GlobalGetData2(options) {
1398
1371
  }
1399
1372
  return ResponseData;
1400
1373
  }
1401
-
1402
- // src/platform/douyin/routes.ts
1403
- var registerDouyinRoutes = (fastify, cookie) => {
1404
- fastify.register(async (fastify2) => {
1405
- await Promise.resolve();
1406
- fastify2.get("/fetch_one_work", async (request, reply) => {
1407
- reply.type("application/json").send(
1408
- await DouyinData({
1409
- methodType: "\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
1410
- aweme_id: request.query.aweme_id
1411
- }, request.headers.cookie ?? cookie)
1412
- );
1413
- });
1414
- fastify2.get("/fetch_work_comments", async (request, reply) => {
1415
- reply.type("application/json").send(
1416
- await DouyinData({
1417
- methodType: "\u8BC4\u8BBA\u6570\u636E",
1418
- aweme_id: request.query.aweme_id
1419
- }, request.headers.cookie ?? cookie)
1420
- );
1421
- });
1422
- fastify2.get("/fetch_video_comment_replies", async (request, reply) => {
1423
- reply.type("application/json").send(
1424
- await DouyinData({
1425
- methodType: "\u6307\u5B9A\u8BC4\u8BBA\u56DE\u590D\u6570\u636E",
1426
- aweme_id: request.query.aweme_id,
1427
- comment_id: request.query.comment_id
1428
- }, request.headers.cookie ?? cookie)
1429
- );
1430
- });
1431
- fastify2.get("/fetch_user_info", async (request, reply) => {
1432
- reply.type("application/json").send(
1433
- await DouyinData({
1434
- methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E",
1435
- sec_uid: request.query.sec_uid
1436
- }, request.headers.cookie ?? cookie)
1437
- );
1438
- });
1439
- fastify2.get("/fetch_user_post_videos", async (request, reply) => {
1440
- reply.type("application/json").send(
1441
- await DouyinData({
1442
- methodType: "\u7528\u6237\u4E3B\u9875\u89C6\u9891\u5217\u8868\u6570\u636E",
1443
- sec_uid: request.query.sec_uid
1444
- }, request.headers.cookie ?? cookie)
1445
- );
1446
- });
1447
- fastify2.get("/fetch_suggest_words", async (request, reply) => {
1448
- reply.type("application/json").send(
1449
- await DouyinData({
1450
- methodType: "\u70ED\u70B9\u8BCD\u6570\u636E",
1451
- query: request.query.query
1452
- }, request.headers.cookie ?? cookie)
1453
- );
1454
- });
1455
- fastify2.get("/fetch_search_info", async (request, reply) => {
1456
- reply.type("application/json").send(
1457
- await DouyinData({
1458
- methodType: "\u641C\u7D22\u6570\u636E",
1459
- query: request.query.query,
1460
- number: request.query.number
1461
- }, request.headers.cookie ?? cookie)
1462
- );
1463
- });
1464
- fastify2.get("/fetch_emoji_list", async (request, reply) => {
1465
- reply.type("application/json").send(
1466
- await DouyinData({
1467
- methodType: "Emoji\u6570\u636E"
1468
- }, request.headers.cookie ?? cookie)
1469
- );
1470
- });
1471
- fastify2.get("/fetch_emoji_pro_list", async (request, reply) => {
1472
- reply.type("application/json").send(
1473
- await DouyinData({
1474
- methodType: "\u52A8\u6001\u8868\u60C5\u6570\u636E"
1475
- }, request.headers.cookie ?? cookie)
1476
- );
1477
- });
1478
- fastify2.get("/fetch_music_work", async (request, reply) => {
1479
- reply.type("application/json").send(
1480
- await DouyinData({
1481
- methodType: "\u97F3\u4E50\u6570\u636E",
1482
- music_id: request.query.music_id
1483
- }, request.headers.cookie ?? cookie)
1484
- );
1485
- });
1486
- fastify2.get("/fetch_user_mix_videos", async (request, reply) => {
1487
- reply.type("application/json").send(
1488
- await DouyinData({
1489
- methodType: "\u5408\u8F91\u4F5C\u54C1\u6570\u636E",
1490
- aweme_id: request.query.aweme_id
1491
- }, request.headers.cookie ?? cookie)
1492
- );
1493
- });
1494
- fastify2.get("/fetch_user_live_videos", async (request, reply) => {
1495
- reply.type("application/json").send(
1496
- await DouyinData({
1497
- methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F\u6570\u636E",
1498
- sec_uid: request.query.sec_uid
1499
- }, request.headers.cookie ?? cookie)
1500
- );
1501
- });
1502
- }, { prefix: "/api/douyin" });
1374
+ var registerDouyinRoutes = (cookie) => {
1375
+ const router = express.Router();
1376
+ router.get("/fetch_one_work", async (req, res) => {
1377
+ const data2 = await DouyinData({
1378
+ methodType: "\u805A\u5408\u89E3\u6790",
1379
+ aweme_id: req.query.aweme_id
1380
+ }, req.headers.cookie || cookie);
1381
+ res.json(data2);
1382
+ });
1383
+ router.get("/fetch_work_comments", async (req, res) => {
1384
+ const data2 = await DouyinData({
1385
+ methodType: "\u8BC4\u8BBA\u6570\u636E",
1386
+ aweme_id: req.query.aweme_id
1387
+ }, req.headers.cookie || cookie);
1388
+ res.json(data2);
1389
+ });
1390
+ router.get("/fetch_video_comment_replies", async (req, res) => {
1391
+ const data2 = await DouyinData({
1392
+ methodType: "\u6307\u5B9A\u8BC4\u8BBA\u56DE\u590D\u6570\u636E",
1393
+ aweme_id: req.query.aweme_id,
1394
+ comment_id: req.query.comment_id
1395
+ }, req.headers.cookie || cookie);
1396
+ res.json(data2);
1397
+ });
1398
+ router.get("/fetch_user_info", async (req, res) => {
1399
+ const data2 = await DouyinData({
1400
+ methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E",
1401
+ sec_uid: req.query.sec_uid
1402
+ }, req.headers.cookie || cookie);
1403
+ res.json(data2);
1404
+ });
1405
+ router.get("/fetch_user_post_videos", async (req, res) => {
1406
+ const data2 = await DouyinData({
1407
+ methodType: "\u7528\u6237\u4E3B\u9875\u89C6\u9891\u5217\u8868\u6570\u636E",
1408
+ sec_uid: req.query.sec_uid
1409
+ }, req.headers.cookie || cookie);
1410
+ res.json(data2);
1411
+ });
1412
+ router.get("/fetch_suggest_words", async (req, res) => {
1413
+ const data2 = await DouyinData({
1414
+ methodType: "\u70ED\u70B9\u8BCD\u6570\u636E",
1415
+ query: req.query.query
1416
+ }, req.headers.cookie || cookie);
1417
+ res.json(data2);
1418
+ });
1419
+ router.get("/fetch_search_info", async (req, res) => {
1420
+ const data2 = await DouyinData({
1421
+ methodType: "\u641C\u7D22\u6570\u636E",
1422
+ query: req.query.query
1423
+ }, req.headers.cookie || cookie);
1424
+ res.json(data2);
1425
+ });
1426
+ router.get("/fetch_emoji_list", async (req, res) => {
1427
+ const data2 = await DouyinData({
1428
+ methodType: "Emoji\u6570\u636E"
1429
+ }, req.headers.cookie || cookie);
1430
+ res.json(data2);
1431
+ });
1432
+ router.get("/fetch_emoji_pro_list", async (req, res) => {
1433
+ const data2 = await DouyinData({
1434
+ methodType: "\u52A8\u6001\u8868\u60C5\u6570\u636E"
1435
+ }, req.headers.cookie || cookie);
1436
+ res.json(data2);
1437
+ });
1438
+ router.get("/fetch_music_work", async (req, res) => {
1439
+ const data2 = await DouyinData({
1440
+ methodType: "\u97F3\u4E50\u6570\u636E",
1441
+ music_id: req.query.music_id
1442
+ }, req.headers.cookie || cookie);
1443
+ res.json(data2);
1444
+ });
1445
+ router.get("/fetch_user_mix_videos", async (req, res) => {
1446
+ const data2 = await DouyinData({
1447
+ methodType: "\u5408\u8F91\u4F5C\u54C1\u6570\u636E",
1448
+ aweme_id: req.query.aweme_id
1449
+ }, req.headers.cookie || cookie);
1450
+ res.json(data2);
1451
+ });
1452
+ router.get("/fetch_user_live_videos", async (req, res) => {
1453
+ const data2 = await DouyinData({
1454
+ methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F\u6570\u636E",
1455
+ sec_uid: req.query.sec_uid
1456
+ }, req.headers.cookie || cookie);
1457
+ res.json(data2);
1458
+ });
1459
+ return router;
1503
1460
  };
1504
1461
 
1505
1462
  // src/platform/kuaishou/API.ts
@@ -1615,35 +1572,29 @@ async function GlobalGetData3(options) {
1615
1572
  }
1616
1573
  return ResponseData;
1617
1574
  }
1618
-
1619
- // src/platform/kuaishou/routes.ts
1620
- var registerKuaishouRoutes = (fastify, cookie) => {
1621
- fastify.register(async (fastify2) => {
1622
- await Promise.resolve();
1623
- fastify2.get("/fetch_one_work", async (request, reply) => {
1624
- reply.type("application/json").send(
1625
- await KuaishouData({
1626
- methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
1627
- photoId: request.query.photoId
1628
- }, request.headers.cookie ?? cookie)
1629
- );
1630
- });
1631
- fastify2.get("/fetch_work_comments", async (request, reply) => {
1632
- reply.type("application/json").send(
1633
- await KuaishouData({
1634
- methodType: "\u8BC4\u8BBA\u6570\u636E",
1635
- photoId: request.query.photoId
1636
- }, request.headers.cookie ?? cookie)
1637
- );
1638
- });
1639
- fastify2.get("/fetch_emoji_list", async (request, reply) => {
1640
- reply.type("application/json").send(
1641
- await KuaishouData({
1642
- methodType: "Emoji\u6570\u636E"
1643
- }, request.headers.cookie ?? cookie)
1644
- );
1645
- });
1646
- }, { prefix: "/api/kuaishou" });
1575
+ var registerKuaishouRoutes = (cookie) => {
1576
+ const router = express.Router();
1577
+ router.get("/fetch_one_work", async (req, res) => {
1578
+ const data2 = await KuaishouData({
1579
+ methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
1580
+ photoId: req.query.photoId
1581
+ }, req.headers.cookie || cookie);
1582
+ res.json(data2);
1583
+ });
1584
+ router.get("/fetch_work_comments", async (req, res) => {
1585
+ const data2 = await KuaishouData({
1586
+ methodType: "\u8BC4\u8BBA\u6570\u636E",
1587
+ photoId: req.query.photoId
1588
+ }, req.headers.cookie || cookie);
1589
+ res.json(data2);
1590
+ });
1591
+ router.get("/fetch_emoji_list", async (req, res) => {
1592
+ const data2 = await KuaishouData({
1593
+ methodType: "Emoji\u6570\u636E"
1594
+ }, req.headers.cookie || cookie);
1595
+ res.json(data2);
1596
+ });
1597
+ return router;
1647
1598
  };
1648
1599
 
1649
1600
  // src/model/DataFetchers.ts
@@ -1769,6 +1720,18 @@ var CustomLogger = class {
1769
1720
  }
1770
1721
  };
1771
1722
  var logger = new CustomLogger("default");
1723
+ var logMiddleware = (req, res, next) => {
1724
+ const startTime = Date.now();
1725
+ const url = req.url;
1726
+ const method = req.method;
1727
+ const clientIP = req.headers["x-forwarded-for"] || req.socket.remoteAddress;
1728
+ res.on("finish", () => {
1729
+ const responseTime = Date.now() - startTime;
1730
+ const statusCode = res.statusCode;
1731
+ logger.info(`[${method}] ${url} (Status: ${statusCode}, Time: ${responseTime}ms, Client: ${clientIP})`);
1732
+ });
1733
+ next();
1734
+ };
1772
1735
  var Networks = class {
1773
1736
  url;
1774
1737
  method;
@@ -1943,39 +1906,27 @@ var amagi = class {
1943
1906
  this.kuaishou = (data2 == null ? void 0 : data2.kuaishou) ?? "";
1944
1907
  }
1945
1908
  /**
1946
- * 启动本地http服务
1909
+ * 启动本地 HTTP 服务
1947
1910
  * @param port - 监听端口
1948
1911
  * @defaultValue `port` 4567
1949
- * @returns
1912
+ * @returns Express 应用实例
1950
1913
  */
1951
1914
  startClient(port = 4567) {
1952
- const Client = Fastify({
1953
- logger: {
1954
- transport: {
1955
- target: "pino-pretty",
1956
- options: {
1957
- colorize: true,
1958
- translateTime: "yyyy-MM-dd HH:mm:ss",
1959
- ignore: "pid,hostname,reqId,res,responseTime,req.hostname,req.method,req.remotePort",
1960
- messageFormat: "{msg}"
1961
- }
1962
- }
1963
- }
1964
- });
1965
- Client.get("/", async (_request, reply) => {
1966
- reply.redirect("https://amagi.apifox.cn", 301);
1915
+ const app = express();
1916
+ app.get("/", (_req, res) => {
1917
+ res.redirect(301, "https://amagi.apifox.cn");
1967
1918
  });
1968
- Client.get("/docs", async (_request, reply) => {
1969
- reply.redirect("https://amagi.apifox.cn", 301);
1919
+ app.get("/docs", (_req, res) => {
1920
+ res.redirect(301, "https://amagi.apifox.cn");
1970
1921
  });
1971
- registerDouyinRoutes(Client, this.douyin);
1972
- registerBilibiliRoutes(Client, this.bilibili);
1973
- registerKuaishouRoutes(Client, this.kuaishou);
1974
- Client.listen({ port, host: "::" }, (_err, _address) => {
1975
- if (_err) Client.log.error(_err);
1976
- logger.mark(`amagi server ${logger.green(`listening on ${port}`)} port. ${logger.yellow("API docs: https://amagi.apifox.cn")}`);
1922
+ app.use("/api/kuaishou", registerKuaishouRoutes(this.kuaishou));
1923
+ app.use("/api/douyin", registerDouyinRoutes(this.douyin));
1924
+ app.use("/api/bilibili", registerBilibiliRoutes(this.bilibili));
1925
+ app.use(logMiddleware);
1926
+ app.listen(port, "::", () => {
1927
+ logger.mark(`Amagi server listening on ${logger.green(`http://localhost:${port}`)} ${logger.yellow("API docs: https://amagi.apifox.cn ")}`);
1977
1928
  });
1978
- return Client;
1929
+ return app;
1979
1930
  }
1980
1931
  /**
1981
1932
  * 获取抖音数据
@@ -2052,18 +2003,10 @@ var amagi = class {
2052
2003
  };
2053
2004
  };
2054
2005
 
2055
- // src/server/listen.ts
2056
- var startClient = (client, port) => {
2057
- return client.listen({ port, host: "::" }, (_err, _address) => {
2058
- if (_err) client.log.error(_err);
2059
- logger.mark(`amagi server listening on ${port} port. API docs: https://amagi.apifox.cn`);
2060
- });
2061
- };
2062
-
2063
2006
  // src/index.ts
2064
2007
  var index_default = amagi;
2065
2008
  function Amagi(options) {
2066
2009
  return new amagi(options);
2067
2010
  }
2068
2011
 
2069
- export { Amagi, BilibiliData, BilibiliValidateData, DouyinData, DouyinValidateData, KuaishouAPI, KuaishouData, KusiahouValidateData, Networks, amagi, av2bv, bilibiliAPI, bv2av, index_default as default, douyinAPI, douyinSign, fetchBilibiliData, fetchDouyinData, fetchKuaishouData, getBilibiliData, getDouyinData, getKuaishouData, logger, qtparam, registerBilibiliRoutes, registerDouyinRoutes, registerKuaishouRoutes, startClient, wbi_sign };
2012
+ export { Amagi, BilibiliData, BilibiliValidateData, DouyinData, DouyinValidateData, KuaishouAPI, KuaishouData, KusiahouValidateData, Networks, amagi, av2bv, bilibiliAPI, bv2av, index_default as default, douyinAPI, douyinSign, fetchBilibiliData, fetchDouyinData, fetchKuaishouData, getBilibiliData, getDouyinData, getKuaishouData, logMiddleware, logger, qtparam, registerBilibiliRoutes, registerDouyinRoutes, registerKuaishouRoutes, wbi_sign };