@iflyrpa/actions 2.0.1 → 3.0.0-beta.0

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.
Files changed (55) hide show
  1. package/dist/actions/baijiahaoLogin/rpa.d.ts +11 -0
  2. package/dist/actions/baijiahaoPublish/index.d.ts +5 -0
  3. package/dist/actions/common/sessionCheck/index.d.ts +5 -0
  4. package/dist/actions/douyinCheckVerifyQrCode/index.d.ts +84 -0
  5. package/dist/actions/douyinCreateCommentReply/schema.d.ts +5 -0
  6. package/dist/actions/douyinGetCollection/schema.d.ts +5 -0
  7. package/dist/actions/douyinGetCommentList/schema.d.ts +5 -0
  8. package/dist/actions/douyinGetCommentReplyList/schema.d.ts +5 -0
  9. package/dist/actions/douyinGetHot/schema.d.ts +5 -0
  10. package/dist/actions/douyinGetLocation/schema.d.ts +5 -0
  11. package/dist/actions/douyinGetMusic/schema.d.ts +5 -0
  12. package/dist/actions/douyinGetMusicByCategory/schema.d.ts +5 -0
  13. package/dist/actions/douyinGetMusicCategory/index.d.ts +5 -0
  14. package/dist/actions/douyinGetMusicCategory/schema.d.ts +5 -0
  15. package/dist/actions/douyinGetTopics/schema.d.ts +5 -0
  16. package/dist/actions/douyinGetVerifyQrCode/index.d.ts +66 -0
  17. package/dist/actions/douyinGetWorkList/schema.d.ts +5 -0
  18. package/dist/actions/douyinLogin/rpa.d.ts +13 -0
  19. package/dist/actions/douyinPublish/index.d.ts +19 -0
  20. package/dist/actions/douyinPublish/rpa-server.d.ts +2 -0
  21. package/dist/actions/getShipinhaoPostList/index.d.ts +1 -0
  22. package/dist/actions/searchAccountInfo/index.d.ts +6 -1
  23. package/dist/actions/searchPublishInfo/index.d.ts +5 -0
  24. package/dist/actions/shipinhaoCheckLinkValidate/schema.d.ts +5 -0
  25. package/dist/actions/shipinhaoGetLocation/schema.d.ts +5 -0
  26. package/dist/actions/shipinhaoGetMsg/index.d.ts +65 -0
  27. package/dist/actions/shipinhaoGetMsg/schema.d.ts +35 -0
  28. package/dist/actions/shipinhaoGetMsgImage/index.d.ts +25 -0
  29. package/dist/actions/shipinhaoLogin/rpa.d.ts +11 -0
  30. package/dist/actions/shipinhaoPublish/index.d.ts +5 -0
  31. package/dist/actions/shipinhaoPublish/uploader.d.ts +5 -4
  32. package/dist/actions/shipinhaoSendMsg/index.d.ts +22 -0
  33. package/dist/actions/shipinhaoSendMsg/schema.d.ts +46 -0
  34. package/dist/actions/toutiaoLogin/rpa.d.ts +10 -0
  35. package/dist/actions/toutiaoPublish/index.d.ts +5 -0
  36. package/dist/actions/weixinLogin/rpa.d.ts +11 -0
  37. package/dist/actions/weixinPublish/index.d.ts +5 -0
  38. package/dist/actions/xiaohongshuLogin/rpa.d.ts +29 -0
  39. package/dist/actions/xiaohongshuPublish/index.d.ts +5 -0
  40. package/dist/actions/xiaohongshuWebSearch/index.d.ts +5 -0
  41. package/dist/bundle.js +5608 -3912
  42. package/dist/bundle.js.map +1 -1
  43. package/dist/index.d.ts +19 -0
  44. package/dist/index.js +6041 -4361
  45. package/dist/index.js.map +1 -1
  46. package/dist/index.mjs +6031 -4356
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/types.d.ts +6 -0
  49. package/dist/utils/douyin/imageUploader.d.ts +3 -3
  50. package/dist/utils/douyin/verify-parser.d.ts +73 -0
  51. package/dist/utils/reportLogger.d.ts +14 -0
  52. package/dist/utils/xhs_ob_feed/index.d.ts +6 -0
  53. package/dist/utils/xhs_ob_feed/mnsvc2.d.ts +8 -0
  54. package/package.json +3 -1
  55. package/dist/utils/douyin/sessionDtrait.d.ts +0 -35
package/dist/types.d.ts CHANGED
@@ -32,6 +32,10 @@ export declare const ActionCommonParamsSchema: z.ZodObject<{
32
32
  httpOnly: z.ZodOptional<z.ZodBoolean>;
33
33
  secure: z.ZodOptional<z.ZodBoolean>;
34
34
  }, z.core.$catchall<z.ZodUnknown>>>;
35
+ localStorage: z.ZodOptional<z.ZodArray<z.ZodObject<{
36
+ key: z.ZodString;
37
+ value: z.ZodString;
38
+ }, z.core.$catchall<z.ZodUnknown>>>>;
35
39
  extraParam: z.ZodOptional<z.ZodAny>;
36
40
  actionType: z.ZodOptional<z.ZodEnum<{
37
41
  mockApi: "mockApi";
@@ -44,6 +48,7 @@ export declare const ActionCommonParamsSchema: z.ZodObject<{
44
48
  huiwenToken: z.ZodOptional<z.ZodString>;
45
49
  articleId: z.ZodOptional<z.ZodString>;
46
50
  saveType: z.ZodOptional<z.ZodString>;
51
+ uid: z.ZodOptional<z.ZodString>;
47
52
  }, z.core.$strip>;
48
53
  export type ActiomCommonParams = z.infer<typeof ActionCommonParamsSchema>;
49
54
  export type AxiosProxyParams = [
@@ -155,3 +160,4 @@ export declare namespace Xiaohongshu {
155
160
  }
156
161
  export declare const errorResponse: (message: string, code?: number) => SearchAccountInfoResponse;
157
162
  export declare const MockPublish = false;
163
+ export declare const DisabledReq = true;
@@ -9,7 +9,7 @@ interface UploadResult {
9
9
  export declare class DouyinImageUploader {
10
10
  private proxyHttp;
11
11
  private headers;
12
- private queryString;
12
+ private queryParams;
13
13
  private tmpCachePath;
14
14
  private authCache;
15
15
  private authExpireTime;
@@ -18,7 +18,7 @@ export declare class DouyinImageUploader {
18
18
  private readonly UPLOAD_DELAY;
19
19
  private readonly UPLOAD_TIMEOUT;
20
20
  private uploadAgent;
21
- constructor(proxyHttp: Http, headers: Record<string, string>, queryString: string, tmpCachePath: string, isHttps?: boolean);
21
+ constructor(proxyHttp: Http, headers: Record<string, string>, queryParams: Record<string, string>, tmpCachePath: string, isHttps?: boolean);
22
22
  /**
23
23
  * 获取有效的上传凭证(带缓存)
24
24
  */
@@ -46,7 +46,7 @@ export declare class DouyinImageUploader {
46
46
  /**
47
47
  * 上传封面图(单张)
48
48
  */
49
- uploadCover(coverUrl: string): Promise<string>;
49
+ uploadCover(coverUrl: string): Promise<UploadResult>;
50
50
  /**
51
51
  * 安全删除文件
52
52
  */
@@ -0,0 +1,73 @@
1
+ /**
2
+ * 抖音 x-tt-verify-passport-decision 解析器
3
+ * 修复版 - 正确处理 UTF-8 编码的中文字符
4
+ */
5
+ export interface VerifyPassportDecision {
6
+ account_flow: "verify" | string;
7
+ biz_params: unknown;
8
+ common_params: CommonParams;
9
+ encrypt_uid: string;
10
+ event_params: EventParams;
11
+ extra_params: ExtraParams;
12
+ pack_verify_way: boolean;
13
+ schema: string;
14
+ url: string;
15
+ user_info: UserInfo;
16
+ verify_way_name_list: string;
17
+ }
18
+ export interface CommonParams {
19
+ copywriting: string;
20
+ copywriting_key: string;
21
+ gateway_abtest_group: string;
22
+ new_verify_flow: string;
23
+ }
24
+ export interface CopywritingContent {
25
+ title: string;
26
+ desc: string;
27
+ }
28
+ export interface EventParams {
29
+ log_id: string;
30
+ verify_reason: string;
31
+ verify_scene: string;
32
+ }
33
+ export interface ExtraParams {
34
+ log_id: string;
35
+ }
36
+ export interface UserInfo {
37
+ avatar_url: string;
38
+ nickname: string;
39
+ mobile_info: string | null;
40
+ }
41
+ export interface ParsedCommonParams extends CommonParams {
42
+ parsed_copywriting: CopywritingContent;
43
+ }
44
+ export interface ParsedVerifyDecision {
45
+ account_flow: "verify" | string;
46
+ biz_params: unknown;
47
+ common_params: ParsedCommonParams;
48
+ encrypt_uid: string;
49
+ event_params: EventParams;
50
+ extra_params: ExtraParams;
51
+ pack_verify_way: boolean;
52
+ schema: string;
53
+ url: string;
54
+ user_info: UserInfo;
55
+ verify_way_name_list: string;
56
+ verify_ways: VerifyWay[];
57
+ verify_title: string;
58
+ verify_desc: string;
59
+ }
60
+ export type VerifyWay = "mobile_sms_verify" | "mobile_up_sms_verify" | "face_verify" | "idcard_verify" | "password_verify" | string;
61
+ /**
62
+ * 解析 x-tt-verify-passport-decision 响应头
63
+ * @param headerValue - 响应头的原始值
64
+ * @returns 解析后的结构化数据
65
+ */
66
+ export declare function parseVerifyPassportDecision(headerValue: string | null | undefined): ParsedVerifyDecision | null;
67
+ export declare function needsVerification(decision: ParsedVerifyDecision | null): boolean;
68
+ export declare function getVerifyUrl(decision: ParsedVerifyDecision | null): string | null;
69
+ export declare function getAppSchema(decision: ParsedVerifyDecision | null): string | null;
70
+ export declare function getUserNickname(decision: ParsedVerifyDecision | null): string | null;
71
+ export declare function getVerifyPrompt(decision: ParsedVerifyDecision | null): CopywritingContent;
72
+ export declare function supportsVerifyWay(decision: ParsedVerifyDecision | null, way: VerifyWay): boolean;
73
+ export declare function getRecommendedVerifyWay(decision: ParsedVerifyDecision | null): VerifyWay | null;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 服务端日志记录参数接口
3
+ */
4
+ export interface ServerLogParams {
5
+ token: string;
6
+ enverionment: "development" | "production";
7
+ [key: string]: unknown;
8
+ }
9
+ /**
10
+ * 调用服务端接口记录日志
11
+ * @param params 请求参数,必须包含 token 字段
12
+ * @returns Promise<void> 不影响主流程,错误会被捕获
13
+ */
14
+ export declare function reportLogger(params: ServerLogParams): Promise<void>;
@@ -0,0 +1,6 @@
1
+ export declare class Xhshow {
2
+ private stringifyCookies;
3
+ signHeadersGet(uri: string, cookieString: Record<string, any>, xsecAppid?: string, params?: Record<string, unknown> | null): Record<string, string>;
4
+ signHeadersPost(uri: string, cookieString: Record<string, any>, xsecAppid?: string, payload?: Record<string, unknown> | null): Record<string, string>;
5
+ }
6
+ export default Xhshow;
@@ -0,0 +1,8 @@
1
+ declare global {
2
+ interface Window {
3
+ mnsv2: (arg1: string, arg2: string) => string;
4
+ ck?: string;
5
+ }
6
+ }
7
+ declare const mnsv2_enc: (arg1: string, arg2: string, cookieString: string) => string;
8
+ export default mnsv2_enc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iflyrpa/actions",
3
- "version": "2.0.1",
3
+ "version": "3.0.0-beta.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -10,6 +10,7 @@
10
10
  "author": "bijinfeng",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
+ "@types/ws": "^8.18.1",
13
14
  "axios": "^1.7.8",
14
15
  "dom-serializer": "^2.0.0",
15
16
  "domhandler": "^5.0.3",
@@ -19,6 +20,7 @@
19
20
  "mime-types": "^2.1.35",
20
21
  "node-fetch": "^2.7.0",
21
22
  "playwright-core": "^1.46.1",
23
+ "ws": "^8.18.3",
22
24
  "@iflyrpa/share": "0.0.18"
23
25
  },
24
26
  "devDependencies": {
@@ -1,35 +0,0 @@
1
- /**
2
- * X-tt-session-dtrait 生成器
3
- * 基于抖音 Web 端逆向分析实现
4
- *
5
- * 格式:d0_<RSA加密结果>_<AES-CBC加密结果>
6
- * - d0: 固定前缀
7
- * - r1 (RSA): 使用 centralRsaPub 公钥加密随机的 aesKey
8
- * - r2 (AES-CBC): 使用 aesKey 加密包含 dtrait 的 JSON 数据
9
- */
10
- /**
11
- * SessionDtrait 生成器配置
12
- */
13
- interface SessionDtraitConfig {
14
- centralRsaPub: string;
15
- sdkVersion?: string;
16
- }
17
- /**
18
- * 生成 X-tt-session-dtrait
19
- *
20
- * @param path - 请求路径(如 /web/api/media/aweme/create_v2/)
21
- * @param config - 配置对象
22
- * @returns 生成的 dtrait 字符串
23
- */
24
- export declare function generateSessionDtrait(path: string, config: SessionDtraitConfig): string;
25
- /**
26
- * 从抖音接口获取 RSA 公钥
27
- * 公钥通常通过特定的接口或存储在 localStorage 中
28
- */
29
- export declare function fetchCentralRsaPub(): Promise<string>;
30
- /**
31
- * 简化的 dtrait 生成(用于测试)
32
- * 如果完整版不工作,可以先尝试此简化版验证流程
33
- */
34
- export declare function generateSessionDtraitSimple(path: string, centralRsaPub: string): string;
35
- export {};