@ikenxuan/amagi 4.4.3 → 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.
- package/dist/default/cjs/index.cjs +268 -325
- package/dist/default/esm/index.mjs +267 -324
- package/dist/default/index.d.ts +13 -21
- package/dist/exports/express.cjs +36 -0
- package/dist/exports/express.d.ts +1 -0
- package/dist/exports/express.js +1 -0
- package/package.json +3 -2
- package/dist/exports/fastify.cjs +0 -11
- package/dist/exports/fastify.d.ts +0 -1
- package/dist/exports/fastify.js +0 -1
|
@@ -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
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
});
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
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
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
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
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
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
|
-
* 启动本地
|
|
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
|
|
1965
|
-
|
|
1966
|
-
|
|
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
|
-
|
|
1981
|
-
|
|
1931
|
+
app.get("/docs", (_req, res) => {
|
|
1932
|
+
res.redirect(301, "https://amagi.apifox.cn");
|
|
1982
1933
|
});
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
logger.mark(`
|
|
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
|
|
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;
|