@ikenxuan/amagi 4.4.3 → 4.4.5

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,6 @@
1
1
  import chalk from 'chalk';
2
+ import express, { Request, Response, NextFunction, Router } from 'express';
2
3
  import { AxiosRequestConfig, AxiosResponse } from 'axios';
3
- import * as fastify from 'fastify';
4
- import { FastifyInstance } from 'fastify';
5
- import * as http from 'http';
6
4
 
7
5
  interface BilibiliMethodOptionsMap {
8
6
  VideoInfoParams: {
@@ -13666,6 +13664,8 @@ declare class CustomLogger {
13666
13664
  }
13667
13665
  declare const logger: CustomLogger;
13668
13666
 
13667
+ declare const logMiddleware: (req: Request, res: Response, next: NextFunction) => void;
13668
+
13669
13669
  interface HeadersObject {
13670
13670
  [key: string]: string;
13671
13671
  }
@@ -13760,14 +13760,17 @@ declare function qtparam(BASEURL: string, cookie: string): Promise<{
13760
13760
  isvip: false;
13761
13761
  }>;
13762
13762
 
13763
+ declare function wbi_sign(BASEURL: string | URL, cookie: string): Promise<string>;
13764
+
13765
+ /** @ts-ignore */
13766
+ interface BilibiliRequest<T extends keyof BilibiliDataOptionsMap> extends Request {
13767
+ query: Omit<BilibiliDataOptionsMap[T]['opt'], 'methodType'>;
13768
+ }
13763
13769
  /**
13764
13770
  * 注册B站相关的API接口路由
13765
- * @param fastify - fastify 实例
13766
13771
  * @param cookie - 有效的cookie
13767
13772
  */
13768
- declare const registerBilibiliRoutes: (fastify: FastifyInstance, cookie: string) => void;
13769
-
13770
- declare function wbi_sign(BASEURL: string | URL, cookie: string): Promise<string>;
13773
+ declare const registerBilibiliRoutes: (cookie: string) => Router;
13771
13774
 
13772
13775
  declare function av2bv(aid: number): `BV1${string}`;
13773
13776
  declare function bv2av(bvid: string): number;
@@ -13795,13 +13798,6 @@ declare const douyinAPI: DouyinAPI;
13795
13798
 
13796
13799
  declare const DouyinData: <T extends keyof DouyinDataOptionsMap>(data: DouyinDataOptionsMap[T]["opt"], cookie?: string) => Promise<any>;
13797
13800
 
13798
- /**
13799
- * 注册抖音相关的API接口路由
13800
- * @param fastify - fastify 实例
13801
- * @param cookie - 有效的cookie
13802
- */
13803
- declare const registerDouyinRoutes: (fastify: FastifyInstance, cookie: string) => void;
13804
-
13805
13801
  declare class douyinSign {
13806
13802
  /** 生成一个指定长度的随机字符串 */
13807
13803
  static Mstoken(length: number): string;
@@ -13811,6 +13807,16 @@ declare class douyinSign {
13811
13807
  static VerifyFpManager(): string;
13812
13808
  }
13813
13809
 
13810
+ /** @ts-ignore */
13811
+ interface DouyinRequest<T extends keyof DouyinDataOptionsMap> extends Request {
13812
+ query: Omit<DouyinDataOptionsMap[T]['opt'], 'methodType'>;
13813
+ }
13814
+ /**
13815
+ * 注册抖音相关的API接口路由
13816
+ * @param cookie - 有效的cookie
13817
+ */
13818
+ declare const registerDouyinRoutes: (cookie: string) => Router;
13819
+
13814
13820
  type KuaishouMethodOptionsWithoutMethodType = {
13815
13821
  [K in keyof KuaishouMethodOptionsMap]: OmitMethodType<KuaishouMethodOptionsMap[K]>;
13816
13822
  };
@@ -13858,12 +13864,15 @@ declare const KuaishouAPI: API;
13858
13864
 
13859
13865
  declare const KuaishouData: <T extends keyof KuaishouDataOptionsMap>(data: KuaishouDataOptionsMap[T]["opt"], cookie?: string) => Promise<any>;
13860
13866
 
13867
+ /** @ts-ignore */
13868
+ interface KusiahouRequest<T extends keyof KuaishouDataOptionsMap> extends Request {
13869
+ query: Omit<KuaishouDataOptionsMap[T]['opt'], 'methodType'>;
13870
+ }
13861
13871
  /**
13862
13872
  * 注册快手相关的API接口路由
13863
- * @param fastify - fastify 实例
13864
13873
  * @param cookie - 有效的cookie
13865
13874
  */
13866
- declare const registerKuaishouRoutes: (fastify: FastifyInstance, cookie: string) => void;
13875
+ declare const registerKuaishouRoutes: (cookie: string) => Router;
13867
13876
 
13868
13877
  type ckParams = {
13869
13878
  /**
@@ -13892,12 +13901,12 @@ declare class amagi {
13892
13901
  */
13893
13902
  constructor(data: ckParams);
13894
13903
  /**
13895
- * 启动本地http服务
13904
+ * 启动本地 HTTP 服务
13896
13905
  * @param port - 监听端口
13897
13906
  * @defaultValue `port` 4567
13898
- * @returns
13907
+ * @returns Express 应用实例
13899
13908
  */
13900
- startClient(port?: number): fastify.FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<fastify.FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>>;
13909
+ startClient(port?: number): express.Application;
13901
13910
  /**
13902
13911
  * 获取抖音数据
13903
13912
  * @param type - 请求数据类型
@@ -13961,14 +13970,6 @@ declare class amagi {
13961
13970
  }) => Promise<R extends "strict" ? KuaishouDataOptionsMap[T]["data"] : any>;
13962
13971
  }
13963
13972
 
13964
- /**
13965
- * 启动本地 http 服务
13966
- * @param client - Fastify 实例
13967
- * @param port - 监听端口
13968
- * @returns
13969
- */
13970
- declare const startClient: (client: FastifyInstance, port: 4567) => void;
13971
-
13972
13973
  declare function Amagi(options: ckParams): amagi;
13973
13974
 
13974
- export { Amagi, type BiliAv2Bv, type BiliBangumiVideoInfo, type BiliBangumiVideoPlayurlIsLogin, type BiliBangumiVideoPlayurlNoLogin, type BiliBiliVideoPlayurlNoLogin, type BiliBv2AV, type BiliCheckQrcode, type BiliDynamicCard, type BiliDynamicInfo, type BiliEmojiList, type BiliLiveRoomDef, type BiliLiveRoomDetail, type BiliNewLoginQrcode, type BiliOneWork, type BiliUserDynamic, type BiliUserFullView, type BiliUserProfile, type BiliVideoPlayurlIsLogin, type BiliWorkComments, BilibiliData, type BilibiliDataOptions, type BilibiliDataOptionsMap, type BilibiliMethodOptionsMap, BilibiliValidateData, DouyinData, type DouyinDataOptions, type DouyinDataOptionsMap, type DouyinMethodOptionsMap, DouyinValidateData, type DyEmojiList, type DyEmojiProList, type DyImageAlbumWork, type DyMusicWork, type DySearchInfo, type DySlidesWork, type DySuggestWords, type DyUserInfo, type DyUserLiveVideos, type DyUserPostVideos, type DyVideoWork, type DyWorkComments, type KsEmojiList, type KsOneWork, type KsWorkComments, KuaishouAPI, KuaishouData, type KuaishouDataOptions, type KuaishouDataOptionsMap, KusiahouValidateData, Networks, type NetworksConfigType, type OmitMethodType, type TypeControl, amagi, av2bv, bilibiliAPI, bv2av, type ckParams, amagi as default, douyinAPI, douyinSign, fetchBilibiliData, fetchDouyinData, fetchKuaishouData, getBilibiliData, getDouyinData, getKuaishouData, logger, qtparam, registerBilibiliRoutes, registerDouyinRoutes, registerKuaishouRoutes, startClient, wbi_sign };
13975
+ export { Amagi, type BiliAv2Bv, type BiliBangumiVideoInfo, type BiliBangumiVideoPlayurlIsLogin, type BiliBangumiVideoPlayurlNoLogin, type BiliBiliVideoPlayurlNoLogin, type BiliBv2AV, type BiliCheckQrcode, type BiliDynamicCard, type BiliDynamicInfo, type BiliEmojiList, type BiliLiveRoomDef, type BiliLiveRoomDetail, type BiliNewLoginQrcode, type BiliOneWork, type BiliUserDynamic, type BiliUserFullView, type BiliUserProfile, type BiliVideoPlayurlIsLogin, type BiliWorkComments, BilibiliData, type BilibiliDataOptions, type BilibiliDataOptionsMap, type BilibiliMethodOptionsMap, type BilibiliRequest, BilibiliValidateData, DouyinData, type DouyinDataOptions, type DouyinDataOptionsMap, type DouyinMethodOptionsMap, type DouyinRequest, DouyinValidateData, type DyEmojiList, type DyEmojiProList, type DyImageAlbumWork, type DyMusicWork, type DySearchInfo, type DySlidesWork, type DySuggestWords, type DyUserInfo, type DyUserLiveVideos, type DyUserPostVideos, type DyVideoWork, type DyWorkComments, type KsEmojiList, type KsOneWork, type KsWorkComments, KuaishouAPI, KuaishouData, type KuaishouDataOptions, type KuaishouDataOptionsMap, type KuaishouMethodOptionsMap, type KusiahouRequest, KusiahouValidateData, Networks, type NetworksConfigType, type OmitMethodType, type TypeControl, amagi, av2bv, bilibiliAPI, bv2av, type ckParams, amagi as default, douyinAPI, douyinSign, fetchBilibiliData, fetchDouyinData, fetchKuaishouData, getBilibiliData, getDouyinData, getKuaishouData, logMiddleware, logger, qtparam, registerBilibiliRoutes, registerDouyinRoutes, registerKuaishouRoutes, wbi_sign };
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var express = require('express');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var express__default = /*#__PURE__*/_interopDefault(express);
10
+
11
+
12
+
13
+ Object.defineProperty(exports, "Router", {
14
+ enumerable: true,
15
+ get: function () { return express.Router; }
16
+ });
17
+ Object.defineProperty(exports, "default", {
18
+ enumerable: true,
19
+ get: function () { return express__default.default; }
20
+ });
21
+ Object.defineProperty(exports, "json", {
22
+ enumerable: true,
23
+ get: function () { return express.json; }
24
+ });
25
+ Object.defineProperty(exports, "query", {
26
+ enumerable: true,
27
+ get: function () { return express.query; }
28
+ });
29
+ Object.defineProperty(exports, "raw", {
30
+ enumerable: true,
31
+ get: function () { return express.raw; }
32
+ });
33
+ Object.defineProperty(exports, "text", {
34
+ enumerable: true,
35
+ get: function () { return express.text; }
36
+ });
@@ -0,0 +1 @@
1
+ export { Application, CookieOptions, Errback, ErrorRequestHandler, Express, Handler, IRoute, IRouter, IRouterHandler, IRouterMatcher, Locals, MediaType, NextFunction, Request, RequestHandler, RequestParamHandler, Response, Router, RouterOptions, Send, default, json, query, raw, text } from 'express';
@@ -0,0 +1 @@
1
+ export { Router, default, json, query, raw, text } from 'express';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikenxuan/amagi",
3
- "version": "4.4.3",
3
+ "version": "4.4.5",
4
4
  "description": "抖音、B站的 web 端相关数据接口基于 Node.js 的实现",
5
5
  "keywords": [
6
6
  "douyin",
@@ -23,10 +23,10 @@
23
23
  "import": "./dist/default/esm/index.mjs",
24
24
  "require": "./dist/default/cjs/index.cjs"
25
25
  },
26
- "./fastify": {
27
- "types": "./dist/exports/fastify.d.ts",
28
- "import": "./dist/exports/fastify.js",
29
- "require": "./dist/exports/fastify.cjs"
26
+ "./express": {
27
+ "types": "./dist/exports/express.d.ts",
28
+ "import": "./dist/exports/express.js",
29
+ "require": "./dist/exports/express.cjs"
30
30
  },
31
31
  "./axios": {
32
32
  "types": "./dist/exports/axios.d.ts",
@@ -57,7 +57,7 @@
57
57
  "dependencies": {
58
58
  "axios": "^1.7.9",
59
59
  "chalk": "4.1.2",
60
- "fastify": "^4.29.0",
60
+ "express": "^4.21.2",
61
61
  "lodash": "^4.17.21",
62
62
  "log4js": "6.9.0",
63
63
  "pino-pretty": "^13.0.0"
@@ -65,6 +65,7 @@
65
65
  "devDependencies": {
66
66
  "@eslint/js": "^9.17.0",
67
67
  "@swc/core": "^1.10.12",
68
+ "@types/express": "^5.0.0",
68
69
  "@types/lodash": "^4.17.13",
69
70
  "@types/node": "^22.10.2",
70
71
  "@typescript-eslint/eslint-plugin": "^8.18.1",
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- var fastify = require('fastify');
4
-
5
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
-
7
- var fastify__default = /*#__PURE__*/_interopDefault(fastify);
8
-
9
-
10
-
11
- module.exports = fastify__default.default;
@@ -1 +0,0 @@
1
- export { default } from 'fastify';
@@ -1 +0,0 @@
1
- export { default } from 'fastify';