@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.
@@ -2,19 +2,19 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var express = require('express');
5
6
  var axios = require('axios');
6
7
  var crypto = require('crypto');
7
8
  var chalk = require('chalk');
8
9
  var log4js = require('log4js');
9
- var Fastify = require('fastify');
10
10
 
11
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
 
13
+ var express__default = /*#__PURE__*/_interopDefault(express);
13
14
  var axios__default = /*#__PURE__*/_interopDefault(axios);
14
15
  var crypto__default = /*#__PURE__*/_interopDefault(crypto);
15
16
  var chalk__default = /*#__PURE__*/_interopDefault(chalk);
16
17
  var log4js__default = /*#__PURE__*/_interopDefault(log4js);
17
- var Fastify__default = /*#__PURE__*/_interopDefault(Fastify);
18
18
 
19
19
  // src/platform/bilibili/API.ts
20
20
  var BiLiBiLiAPI = class {
@@ -428,163 +428,136 @@ async function qtparam(BASEURL, cookie) {
428
428
  return { QUERY: `&fnval=16&fourk=1&${sign}`, STATUS: "isLogin", isvip };
429
429
  } else return { QUERY: `&qn=${qn[3]}&fnval=16`, STATUS: "isLogin", isvip };
430
430
  }
431
-
432
- // src/platform/bilibili/routes.ts
433
- var registerBilibiliRoutes = (fastify, cookie) => {
434
- fastify.register(async (fastify2) => {
435
- await Promise.resolve();
436
- fastify2.get("/new_login_qrcode", async (request, reply) => {
437
- reply.type("application/json").send(
438
- await BilibiliData({
439
- methodType: "\u7533\u8BF7\u4E8C\u7EF4\u7801"
440
- })
441
- );
442
- });
443
- fastify2.get("/check_qrcode", async (request, reply) => {
444
- reply.type("application/json").send(
445
- await BilibiliData({
446
- methodType: "\u4E8C\u7EF4\u7801\u72B6\u6001",
447
- qrcode_key: request.query.qrcode_key
448
- })
449
- );
450
- });
451
- fastify2.get("/login_basic_info", async (request, reply) => {
452
- reply.type("application/json").send(
453
- await BilibiliData({
454
- methodType: "\u767B\u5F55\u57FA\u672C\u4FE1\u606F"
455
- }, request.headers.cookie)
456
- );
457
- });
458
- fastify2.get("/fetch_one_video", async (request, reply) => {
459
- reply.type("application/json").send(
460
- await BilibiliData({
461
- methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
462
- bvid: request.query.bvid
463
- }, request.headers.cookie ?? cookie)
464
- );
465
- });
466
- fastify2.get("/fetch_video_playurl", async (request, reply) => {
467
- reply.type("application/json").send(
468
- await BilibiliData({
469
- methodType: "\u5355\u4E2A\u89C6\u9891\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
470
- avid: request.query.avid,
471
- cid: request.query.cid
472
- }, request.headers.cookie ?? cookie)
473
- );
474
- });
475
- fastify2.get("/fetch_work_comments", async (request, reply) => {
476
- reply.type("application/json").send(
477
- await BilibiliData({
478
- methodType: "\u8BC4\u8BBA\u6570\u636E",
479
- oid: Number(request.query.oid),
480
- number: Number(request.query.number),
481
- type: Number(request.query.type ?? 1)
482
- }, request.headers.cookie ?? cookie)
483
- );
484
- });
485
- fastify2.get("/fetch_emoji_list", async (_request, reply) => {
486
- reply.type("application/json").send(
487
- await BilibiliData({
488
- methodType: "Emoji\u6570\u636E"
489
- })
490
- );
491
- });
492
- fastify2.get("/fetch_bangumi_video_info", async (request, reply) => {
493
- reply.type("application/json").send(
494
- await BilibiliData({
495
- methodType: "\u756A\u5267\u57FA\u672C\u4FE1\u606F\u6570\u636E",
496
- ep_id: request.query.ep_id
497
- }, request.headers.cookie ?? cookie)
498
- );
499
- });
500
- fastify2.get("/fetch_bangumi_video_playurl", async (request, reply) => {
501
- reply.type("application/json").send(
502
- await BilibiliData({
503
- methodType: "\u756A\u5267\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
504
- cid: request.query.cid,
505
- ep_id: request.query.ep_id
506
- }, request.headers.cookie ?? cookie)
507
- );
508
- });
509
- fastify2.get("/fetch_user_dynamic", async (request, reply) => {
510
- reply.type("application/json").send(
511
- await BilibiliData({
512
- methodType: "\u7528\u6237\u4E3B\u9875\u52A8\u6001\u5217\u8868\u6570\u636E",
513
- host_mid: request.query.host_mid
514
- }, request.headers.cookie ?? cookie)
515
- );
516
- });
517
- fastify2.get("/fetch_dynamic_info", async (request, reply) => {
518
- reply.type("application/json").send(
519
- await BilibiliData({
520
- methodType: "\u52A8\u6001\u8BE6\u60C5\u6570\u636E",
521
- dynamic_id: request.query.dynamic_id
522
- }, request.headers.cookie ?? cookie)
523
- );
524
- });
525
- fastify2.get("/fetch_dynamic_card", async (request, reply) => {
526
- reply.type("application/json").send(
527
- await BilibiliData(
528
- {
529
- methodType: "\u52A8\u6001\u5361\u7247\u6570\u636E",
530
- dynamic_id: request.query.dynamic_id
531
- },
532
- request.headers.cookie ?? cookie
533
- )
534
- );
535
- });
536
- fastify2.get("/fetch_user_profile", async (request, reply) => {
537
- reply.type("application/json").send(
538
- await BilibiliData(
539
- {
540
- methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E",
541
- host_mid: request.query.host_mid
542
- },
543
- request.headers.cookie ?? cookie
544
- )
545
- );
546
- });
547
- fastify2.get("/fetch_live_room_detail", async (request, reply) => {
548
- reply.type("application/json").send(
549
- await BilibiliData({
550
- methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F",
551
- room_id: request.query.room_id
552
- }, request.headers.cookie ?? cookie)
553
- );
554
- });
555
- fastify2.get("/fetch_liveroom_def", async (request, reply) => {
556
- reply.type("application/json").send(
557
- await BilibiliData({
558
- methodType: "\u76F4\u64AD\u95F4\u521D\u59CB\u5316\u4FE1\u606F",
559
- room_id: request.query.room_id
560
- }, request.headers.cookie ?? cookie)
561
- );
562
- });
563
- fastify2.get("/bv_to_av", async (request, reply) => {
564
- reply.type("application/json").send(
565
- await BilibiliData({
566
- methodType: "BV\u8F6CAV",
567
- bvid: request.query.bvid
568
- })
569
- );
570
- });
571
- fastify2.get("/av_to_bv", async (request, reply) => {
572
- reply.type("application/json").send(
573
- await BilibiliData({
574
- methodType: "AV\u8F6CBV",
575
- avid: request.query.avid
576
- })
577
- );
578
- });
579
- fastify2.get("/fetch_user_full_view", async (request, reply) => {
580
- reply.type("application/json").send(
581
- await BilibiliData({
582
- methodType: "\u83B7\u53D6UP\u4E3B\u603B\u64AD\u653E\u91CF",
583
- host_mid: request.query.host_mid
584
- }, request.headers.cookie ?? cookie)
585
- );
586
- });
587
- }, { prefix: "/api/bilibili" });
431
+ var registerBilibiliRoutes = (cookie) => {
432
+ const router = express__default.default.Router();
433
+ router.get("/new_login_qrcode", async (req, res) => {
434
+ const data2 = await BilibiliData({
435
+ methodType: "\u7533\u8BF7\u4E8C\u7EF4\u7801"
436
+ }, req.headers.cookie || cookie);
437
+ res.json(data2);
438
+ });
439
+ router.get("/check_qrcode", async (req, res) => {
440
+ const data2 = await BilibiliData({
441
+ methodType: "\u4E8C\u7EF4\u7801\u72B6\u6001",
442
+ qrcode_key: req.query.qrcode_key
443
+ }, req.headers.cookie || cookie);
444
+ res.json(data2);
445
+ });
446
+ router.get("/login_basic_info", async (req, res) => {
447
+ const data2 = await BilibiliData({
448
+ methodType: "\u767B\u5F55\u57FA\u672C\u4FE1\u606F"
449
+ }, req.headers.cookie || cookie);
450
+ res.json(data2);
451
+ });
452
+ router.get("/fetch_one_video", async (req, res) => {
453
+ const data2 = await BilibiliData({
454
+ methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
455
+ bvid: req.query.bvid
456
+ }, req.headers.cookie || cookie);
457
+ res.json(data2);
458
+ });
459
+ router.get("/fetch_video_playurl", async (req, res) => {
460
+ const data2 = await BilibiliData({
461
+ methodType: "\u5355\u4E2A\u89C6\u9891\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
462
+ avid: req.query.avid,
463
+ cid: req.query.cid
464
+ }, req.headers.cookie || cookie);
465
+ res.json(data2);
466
+ });
467
+ router.get("/fetch_work_comments", async (req, res) => {
468
+ const data2 = await BilibiliData({
469
+ methodType: "\u8BC4\u8BBA\u6570\u636E",
470
+ oid: Number(req.query.oid),
471
+ number: Number(req.query.number),
472
+ type: Number(req.query.type ?? 1)
473
+ }, req.headers.cookie || cookie);
474
+ res.json(data2);
475
+ });
476
+ router.get("/fetch_work_comments", async (req, res) => {
477
+ const data2 = await BilibiliData({
478
+ methodType: "Emoji\u6570\u636E"
479
+ }, req.headers.cookie || cookie);
480
+ res.json(data2);
481
+ });
482
+ router.get("/fetch_bangumi_video_info", async (req, res) => {
483
+ const data2 = await BilibiliData({
484
+ methodType: "\u756A\u5267\u57FA\u672C\u4FE1\u606F\u6570\u636E",
485
+ ep_id: req.query.ep_id
486
+ }, req.headers.cookie || cookie);
487
+ res.json(data2);
488
+ });
489
+ router.get("/fetch_bangumi_video_playurl", async (req, res) => {
490
+ const data2 = await BilibiliData({
491
+ methodType: "\u756A\u5267\u4E0B\u8F7D\u4FE1\u606F\u6570\u636E",
492
+ cid: req.query.cid,
493
+ ep_id: req.query.ep_id
494
+ }, req.headers.cookie || cookie);
495
+ res.json(data2);
496
+ });
497
+ router.get("/fetch_user_dynamic", async (req, res) => {
498
+ const data2 = await BilibiliData({
499
+ methodType: "\u7528\u6237\u4E3B\u9875\u52A8\u6001\u5217\u8868\u6570\u636E",
500
+ host_mid: req.query.host_mid
501
+ }, req.headers.cookie || cookie);
502
+ res.json(data2);
503
+ });
504
+ router.get("/fetch_dynamic_info", async (req, res) => {
505
+ const data2 = await BilibiliData({
506
+ methodType: "\u52A8\u6001\u8BE6\u60C5\u6570\u636E",
507
+ dynamic_id: req.query.dynamic_id
508
+ }, req.headers.cookie || cookie);
509
+ res.json(data2);
510
+ });
511
+ router.get("/fetch_dynamic_card", async (req, res) => {
512
+ const data2 = await BilibiliData({
513
+ methodType: "\u52A8\u6001\u5361\u7247\u6570\u636E",
514
+ dynamic_id: req.query.dynamic_id
515
+ }, req.headers.cookie || cookie);
516
+ res.json(data2);
517
+ });
518
+ router.get("/fetch_user_profile", async (req, res) => {
519
+ const data2 = await BilibiliData({
520
+ methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E",
521
+ host_mid: req.query.host_mid
522
+ }, req.headers.cookie || cookie);
523
+ res.json(data2);
524
+ });
525
+ router.get("/fetch_live_room_detail", async (req, res) => {
526
+ const data2 = await BilibiliData({
527
+ methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F",
528
+ room_id: req.query.room_id
529
+ }, req.headers.cookie || cookie);
530
+ res.json(data2);
531
+ });
532
+ router.get("/fetch_liveroom_def", async (req, res) => {
533
+ const data2 = await BilibiliData({
534
+ methodType: "\u76F4\u64AD\u95F4\u521D\u59CB\u5316\u4FE1\u606F",
535
+ room_id: req.query.room_id
536
+ }, req.headers.cookie || cookie);
537
+ res.json(data2);
538
+ });
539
+ router.get("/bv_to_av", async (req, res) => {
540
+ const data2 = await BilibiliData({
541
+ methodType: "BV\u8F6CAV",
542
+ bvid: req.query.bvid
543
+ }, req.headers.cookie || cookie);
544
+ res.json(data2);
545
+ });
546
+ router.get("/av_to_bv", async (req, res) => {
547
+ const data2 = await BilibiliData({
548
+ methodType: "AV\u8F6CBV",
549
+ avid: req.query.avid
550
+ }, req.headers.cookie || cookie);
551
+ res.json(data2);
552
+ });
553
+ router.get("/fetch_user_full_view", async (req, res) => {
554
+ const data2 = await BilibiliData({
555
+ methodType: "\u83B7\u53D6UP\u4E3B\u603B\u64AD\u653E\u91CF",
556
+ host_mid: req.query.host_mid
557
+ }, req.headers.cookie || cookie);
558
+ res.json(data2);
559
+ });
560
+ return router;
588
561
  };
589
562
  var mixinKeyEncTab = [
590
563
  46,
@@ -1410,108 +1383,92 @@ async function GlobalGetData2(options) {
1410
1383
  }
1411
1384
  return ResponseData;
1412
1385
  }
1413
-
1414
- // src/platform/douyin/routes.ts
1415
- var registerDouyinRoutes = (fastify, cookie) => {
1416
- fastify.register(async (fastify2) => {
1417
- await Promise.resolve();
1418
- fastify2.get("/fetch_one_work", async (request, reply) => {
1419
- reply.type("application/json").send(
1420
- await DouyinData({
1421
- methodType: "\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
1422
- aweme_id: request.query.aweme_id
1423
- }, request.headers.cookie ?? cookie)
1424
- );
1425
- });
1426
- fastify2.get("/fetch_work_comments", async (request, reply) => {
1427
- reply.type("application/json").send(
1428
- await DouyinData({
1429
- methodType: "\u8BC4\u8BBA\u6570\u636E",
1430
- aweme_id: request.query.aweme_id
1431
- }, request.headers.cookie ?? cookie)
1432
- );
1433
- });
1434
- fastify2.get("/fetch_video_comment_replies", async (request, reply) => {
1435
- reply.type("application/json").send(
1436
- await DouyinData({
1437
- methodType: "\u6307\u5B9A\u8BC4\u8BBA\u56DE\u590D\u6570\u636E",
1438
- aweme_id: request.query.aweme_id,
1439
- comment_id: request.query.comment_id
1440
- }, request.headers.cookie ?? cookie)
1441
- );
1442
- });
1443
- fastify2.get("/fetch_user_info", async (request, reply) => {
1444
- reply.type("application/json").send(
1445
- await DouyinData({
1446
- methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E",
1447
- sec_uid: request.query.sec_uid
1448
- }, request.headers.cookie ?? cookie)
1449
- );
1450
- });
1451
- fastify2.get("/fetch_user_post_videos", async (request, reply) => {
1452
- reply.type("application/json").send(
1453
- await DouyinData({
1454
- methodType: "\u7528\u6237\u4E3B\u9875\u89C6\u9891\u5217\u8868\u6570\u636E",
1455
- sec_uid: request.query.sec_uid
1456
- }, request.headers.cookie ?? cookie)
1457
- );
1458
- });
1459
- fastify2.get("/fetch_suggest_words", async (request, reply) => {
1460
- reply.type("application/json").send(
1461
- await DouyinData({
1462
- methodType: "\u70ED\u70B9\u8BCD\u6570\u636E",
1463
- query: request.query.query
1464
- }, request.headers.cookie ?? cookie)
1465
- );
1466
- });
1467
- fastify2.get("/fetch_search_info", async (request, reply) => {
1468
- reply.type("application/json").send(
1469
- await DouyinData({
1470
- methodType: "\u641C\u7D22\u6570\u636E",
1471
- query: request.query.query,
1472
- number: request.query.number
1473
- }, request.headers.cookie ?? cookie)
1474
- );
1475
- });
1476
- fastify2.get("/fetch_emoji_list", async (request, reply) => {
1477
- reply.type("application/json").send(
1478
- await DouyinData({
1479
- methodType: "Emoji\u6570\u636E"
1480
- }, request.headers.cookie ?? cookie)
1481
- );
1482
- });
1483
- fastify2.get("/fetch_emoji_pro_list", async (request, reply) => {
1484
- reply.type("application/json").send(
1485
- await DouyinData({
1486
- methodType: "\u52A8\u6001\u8868\u60C5\u6570\u636E"
1487
- }, request.headers.cookie ?? cookie)
1488
- );
1489
- });
1490
- fastify2.get("/fetch_music_work", async (request, reply) => {
1491
- reply.type("application/json").send(
1492
- await DouyinData({
1493
- methodType: "\u97F3\u4E50\u6570\u636E",
1494
- music_id: request.query.music_id
1495
- }, request.headers.cookie ?? cookie)
1496
- );
1497
- });
1498
- fastify2.get("/fetch_user_mix_videos", async (request, reply) => {
1499
- reply.type("application/json").send(
1500
- await DouyinData({
1501
- methodType: "\u5408\u8F91\u4F5C\u54C1\u6570\u636E",
1502
- aweme_id: request.query.aweme_id
1503
- }, request.headers.cookie ?? cookie)
1504
- );
1505
- });
1506
- fastify2.get("/fetch_user_live_videos", async (request, reply) => {
1507
- reply.type("application/json").send(
1508
- await DouyinData({
1509
- methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F\u6570\u636E",
1510
- sec_uid: request.query.sec_uid
1511
- }, request.headers.cookie ?? cookie)
1512
- );
1513
- });
1514
- }, { prefix: "/api/douyin" });
1386
+ var registerDouyinRoutes = (cookie) => {
1387
+ const router = express__default.default.Router();
1388
+ router.get("/fetch_one_work", async (req, res) => {
1389
+ const data2 = await DouyinData({
1390
+ methodType: "\u805A\u5408\u89E3\u6790",
1391
+ aweme_id: req.query.aweme_id
1392
+ }, req.headers.cookie || cookie);
1393
+ res.json(data2);
1394
+ });
1395
+ router.get("/fetch_work_comments", async (req, res) => {
1396
+ const data2 = await DouyinData({
1397
+ methodType: "\u8BC4\u8BBA\u6570\u636E",
1398
+ aweme_id: req.query.aweme_id
1399
+ }, req.headers.cookie || cookie);
1400
+ res.json(data2);
1401
+ });
1402
+ router.get("/fetch_video_comment_replies", async (req, res) => {
1403
+ const data2 = await DouyinData({
1404
+ methodType: "\u6307\u5B9A\u8BC4\u8BBA\u56DE\u590D\u6570\u636E",
1405
+ aweme_id: req.query.aweme_id,
1406
+ comment_id: req.query.comment_id
1407
+ }, req.headers.cookie || cookie);
1408
+ res.json(data2);
1409
+ });
1410
+ router.get("/fetch_user_info", async (req, res) => {
1411
+ const data2 = await DouyinData({
1412
+ methodType: "\u7528\u6237\u4E3B\u9875\u6570\u636E",
1413
+ sec_uid: req.query.sec_uid
1414
+ }, req.headers.cookie || cookie);
1415
+ res.json(data2);
1416
+ });
1417
+ router.get("/fetch_user_post_videos", async (req, res) => {
1418
+ const data2 = await DouyinData({
1419
+ methodType: "\u7528\u6237\u4E3B\u9875\u89C6\u9891\u5217\u8868\u6570\u636E",
1420
+ sec_uid: req.query.sec_uid
1421
+ }, req.headers.cookie || cookie);
1422
+ res.json(data2);
1423
+ });
1424
+ router.get("/fetch_suggest_words", async (req, res) => {
1425
+ const data2 = await DouyinData({
1426
+ methodType: "\u70ED\u70B9\u8BCD\u6570\u636E",
1427
+ query: req.query.query
1428
+ }, req.headers.cookie || cookie);
1429
+ res.json(data2);
1430
+ });
1431
+ router.get("/fetch_search_info", async (req, res) => {
1432
+ const data2 = await DouyinData({
1433
+ methodType: "\u641C\u7D22\u6570\u636E",
1434
+ query: req.query.query
1435
+ }, req.headers.cookie || cookie);
1436
+ res.json(data2);
1437
+ });
1438
+ router.get("/fetch_emoji_list", async (req, res) => {
1439
+ const data2 = await DouyinData({
1440
+ methodType: "Emoji\u6570\u636E"
1441
+ }, req.headers.cookie || cookie);
1442
+ res.json(data2);
1443
+ });
1444
+ router.get("/fetch_emoji_pro_list", async (req, res) => {
1445
+ const data2 = await DouyinData({
1446
+ methodType: "\u52A8\u6001\u8868\u60C5\u6570\u636E"
1447
+ }, req.headers.cookie || cookie);
1448
+ res.json(data2);
1449
+ });
1450
+ router.get("/fetch_music_work", async (req, res) => {
1451
+ const data2 = await DouyinData({
1452
+ methodType: "\u97F3\u4E50\u6570\u636E",
1453
+ music_id: req.query.music_id
1454
+ }, req.headers.cookie || cookie);
1455
+ res.json(data2);
1456
+ });
1457
+ router.get("/fetch_user_mix_videos", async (req, res) => {
1458
+ const data2 = await DouyinData({
1459
+ methodType: "\u5408\u8F91\u4F5C\u54C1\u6570\u636E",
1460
+ aweme_id: req.query.aweme_id
1461
+ }, req.headers.cookie || cookie);
1462
+ res.json(data2);
1463
+ });
1464
+ router.get("/fetch_user_live_videos", async (req, res) => {
1465
+ const data2 = await DouyinData({
1466
+ methodType: "\u76F4\u64AD\u95F4\u4FE1\u606F\u6570\u636E",
1467
+ sec_uid: req.query.sec_uid
1468
+ }, req.headers.cookie || cookie);
1469
+ res.json(data2);
1470
+ });
1471
+ return router;
1515
1472
  };
1516
1473
 
1517
1474
  // src/platform/kuaishou/API.ts
@@ -1627,35 +1584,29 @@ async function GlobalGetData3(options) {
1627
1584
  }
1628
1585
  return ResponseData;
1629
1586
  }
1630
-
1631
- // src/platform/kuaishou/routes.ts
1632
- var registerKuaishouRoutes = (fastify, cookie) => {
1633
- fastify.register(async (fastify2) => {
1634
- await Promise.resolve();
1635
- fastify2.get("/fetch_one_work", async (request, reply) => {
1636
- reply.type("application/json").send(
1637
- await KuaishouData({
1638
- methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
1639
- photoId: request.query.photoId
1640
- }, request.headers.cookie ?? cookie)
1641
- );
1642
- });
1643
- fastify2.get("/fetch_work_comments", async (request, reply) => {
1644
- reply.type("application/json").send(
1645
- await KuaishouData({
1646
- methodType: "\u8BC4\u8BBA\u6570\u636E",
1647
- photoId: request.query.photoId
1648
- }, request.headers.cookie ?? cookie)
1649
- );
1650
- });
1651
- fastify2.get("/fetch_emoji_list", async (request, reply) => {
1652
- reply.type("application/json").send(
1653
- await KuaishouData({
1654
- methodType: "Emoji\u6570\u636E"
1655
- }, request.headers.cookie ?? cookie)
1656
- );
1657
- });
1658
- }, { prefix: "/api/kuaishou" });
1587
+ var registerKuaishouRoutes = (cookie) => {
1588
+ const router = express__default.default.Router();
1589
+ router.get("/fetch_one_work", async (req, res) => {
1590
+ const data2 = await KuaishouData({
1591
+ methodType: "\u5355\u4E2A\u89C6\u9891\u4F5C\u54C1\u6570\u636E",
1592
+ photoId: req.query.photoId
1593
+ }, req.headers.cookie || cookie);
1594
+ res.json(data2);
1595
+ });
1596
+ router.get("/fetch_work_comments", async (req, res) => {
1597
+ const data2 = await KuaishouData({
1598
+ methodType: "\u8BC4\u8BBA\u6570\u636E",
1599
+ photoId: req.query.photoId
1600
+ }, req.headers.cookie || cookie);
1601
+ res.json(data2);
1602
+ });
1603
+ router.get("/fetch_emoji_list", async (req, res) => {
1604
+ const data2 = await KuaishouData({
1605
+ methodType: "Emoji\u6570\u636E"
1606
+ }, req.headers.cookie || cookie);
1607
+ res.json(data2);
1608
+ });
1609
+ return router;
1659
1610
  };
1660
1611
 
1661
1612
  // src/model/DataFetchers.ts
@@ -1781,6 +1732,18 @@ var CustomLogger = class {
1781
1732
  }
1782
1733
  };
1783
1734
  var logger = new CustomLogger("default");
1735
+ var logMiddleware = (req, res, next) => {
1736
+ const startTime = Date.now();
1737
+ const url = req.url;
1738
+ const method = req.method;
1739
+ const clientIP = req.headers["x-forwarded-for"] || req.socket.remoteAddress;
1740
+ res.on("finish", () => {
1741
+ const responseTime = Date.now() - startTime;
1742
+ const statusCode = res.statusCode;
1743
+ logger.info(`[${method}] ${url} (Status: ${statusCode}, Time: ${responseTime}ms, Client: ${clientIP})`);
1744
+ });
1745
+ next();
1746
+ };
1784
1747
  var Networks = class {
1785
1748
  url;
1786
1749
  method;
@@ -1955,39 +1918,27 @@ var amagi = class {
1955
1918
  this.kuaishou = (data2 == null ? void 0 : data2.kuaishou) ?? "";
1956
1919
  }
1957
1920
  /**
1958
- * 启动本地http服务
1921
+ * 启动本地 HTTP 服务
1959
1922
  * @param port - 监听端口
1960
1923
  * @defaultValue `port` 4567
1961
- * @returns
1924
+ * @returns Express 应用实例
1962
1925
  */
1963
1926
  startClient(port = 4567) {
1964
- const Client = Fastify__default.default({
1965
- logger: {
1966
- transport: {
1967
- target: "pino-pretty",
1968
- options: {
1969
- colorize: true,
1970
- translateTime: "yyyy-MM-dd HH:mm:ss",
1971
- ignore: "pid,hostname,reqId,res,responseTime,req.hostname,req.method,req.remotePort",
1972
- messageFormat: "{msg}"
1973
- }
1974
- }
1975
- }
1976
- });
1977
- Client.get("/", async (_request, reply) => {
1978
- reply.redirect("https://amagi.apifox.cn", 301);
1927
+ const app = express__default.default();
1928
+ app.get("/", (_req, res) => {
1929
+ res.redirect(301, "https://amagi.apifox.cn");
1979
1930
  });
1980
- Client.get("/docs", async (_request, reply) => {
1981
- reply.redirect("https://amagi.apifox.cn", 301);
1931
+ app.get("/docs", (_req, res) => {
1932
+ res.redirect(301, "https://amagi.apifox.cn");
1982
1933
  });
1983
- registerDouyinRoutes(Client, this.douyin);
1984
- registerBilibiliRoutes(Client, this.bilibili);
1985
- registerKuaishouRoutes(Client, this.kuaishou);
1986
- Client.listen({ port, host: "::" }, (_err, _address) => {
1987
- if (_err) Client.log.error(_err);
1988
- logger.mark(`amagi server ${logger.green(`listening on ${port}`)} port. ${logger.yellow("API docs: https://amagi.apifox.cn")}`);
1934
+ app.use("/api/kuaishou", registerKuaishouRoutes(this.kuaishou));
1935
+ app.use("/api/douyin", registerDouyinRoutes(this.douyin));
1936
+ app.use("/api/bilibili", registerBilibiliRoutes(this.bilibili));
1937
+ app.use(logMiddleware);
1938
+ app.listen(port, "::", () => {
1939
+ logger.mark(`Amagi server listening on ${logger.green(`http://localhost:${port}`)} ${logger.yellow("API docs: https://amagi.apifox.cn ")}`);
1989
1940
  });
1990
- return Client;
1941
+ return app;
1991
1942
  }
1992
1943
  /**
1993
1944
  * 获取抖音数据
@@ -2064,14 +2015,6 @@ var amagi = class {
2064
2015
  };
2065
2016
  };
2066
2017
 
2067
- // src/server/listen.ts
2068
- var startClient = (client, port) => {
2069
- return client.listen({ port, host: "::" }, (_err, _address) => {
2070
- if (_err) client.log.error(_err);
2071
- logger.mark(`amagi server listening on ${port} port. API docs: https://amagi.apifox.cn`);
2072
- });
2073
- };
2074
-
2075
2018
  // src/index.ts
2076
2019
  var index_default = amagi;
2077
2020
  function Amagi(options) {
@@ -2100,10 +2043,10 @@ exports.fetchKuaishouData = fetchKuaishouData;
2100
2043
  exports.getBilibiliData = getBilibiliData;
2101
2044
  exports.getDouyinData = getDouyinData;
2102
2045
  exports.getKuaishouData = getKuaishouData;
2046
+ exports.logMiddleware = logMiddleware;
2103
2047
  exports.logger = logger;
2104
2048
  exports.qtparam = qtparam;
2105
2049
  exports.registerBilibiliRoutes = registerBilibiliRoutes;
2106
2050
  exports.registerDouyinRoutes = registerDouyinRoutes;
2107
2051
  exports.registerKuaishouRoutes = registerKuaishouRoutes;
2108
- exports.startClient = startClient;
2109
2052
  exports.wbi_sign = wbi_sign;