@iflyrpa/actions 1.2.14-beta.1 → 1.2.14-beta.3

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/index.js CHANGED
@@ -1,124 +1,32 @@
1
1
  var __webpack_modules__ = {
2
- "./src/actions/searchAccountInfo/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2
+ "./src/actions/searchAccountInfo/getWxInfo.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3
3
  "use strict";
4
4
  __webpack_require__.d(__webpack_exports__, {
5
- A: ()=>SearchAccountInfo
5
+ n: ()=>getWeixinData
6
6
  });
7
7
  var _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@iflyrpa/share");
8
8
  var _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/ __webpack_require__.n(_iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__);
9
- var _utils_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/utils/index.ts");
10
- var _utils_http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/utils/http.ts");
11
- var _utils_xhsXsEncrypt__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/xhsXsEncrypt.ts");
12
- const errorResponse = (message, code = 500)=>({
13
- code,
14
- message,
15
- data: null
16
- });
17
- async function getToutiaoData(params) {
18
- try {
19
- const http = new _utils_http__WEBPACK_IMPORTED_MODULE_2__.e({
20
- headers: {
21
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
22
- referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
23
- }
24
- });
25
- const [totalData, fansDataYesterday, contentDataYesterday] = await Promise.all([
26
- http.api({
27
- method: "get",
28
- url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
29
- params: {
30
- app_id: 1231
31
- }
32
- }),
33
- http.api({
34
- method: "get",
35
- url: "https://mp.toutiao.com/mp/agw/statistic/v2/fans/latest_stat",
36
- params: {
37
- app_id: 1231
38
- }
39
- }),
40
- http.api({
41
- method: "get",
42
- url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
43
- params: {
44
- type: 0,
45
- app_id: 1231
46
- }
47
- })
48
- ]);
49
- const ttData = {
50
- fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
51
- fansNumYesterday: fansDataYesterday.fans_stat.change_count,
52
- readNum: Number(totalData.data.statistic.data.total_read_play_count),
53
- incomeNum: totalData.data.statistic.data.total_income,
54
- incomeNumYesterday: totalData.data.statistic.data.yesterday_income,
55
- showNumYesterday: contentDataYesterday.author_stat.consume_data.impression_count,
56
- readNumYesterday: contentDataYesterday.author_stat.consume_data.go_detail_count,
57
- likeNumYesterday: contentDataYesterday.author_stat.interaction_data.digg_count,
58
- commentNumYesterday: contentDataYesterday.author_stat.interaction_data.comment_count
59
- };
60
- return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.success)(ttData, "头条号粉丝数据获取成功!");
61
- } catch (error) {
62
- return errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
63
- }
64
- }
65
- async function getXiaohongshuData(params) {
66
- try {
67
- const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
68
- if (!a1Cookie) return errorResponse("账号数据异常,请重新绑定账号后重试。", 200);
69
- const http = new _utils_http__WEBPACK_IMPORTED_MODULE_2__.e({
70
- headers: {
71
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
72
- referer: "https://creator.xiaohongshu.com",
73
- origin: "https://creator.xiaohongshu.com"
74
- }
75
- });
76
- const xsEncrypt = new _utils_xhsXsEncrypt__WEBPACK_IMPORTED_MODULE_3__.H();
77
- const xt = Date.now().toString();
78
- const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
79
- const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
80
- const [overAllData, sevenData] = await Promise.all([
81
- http.api({
82
- method: "get",
83
- url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
84
- }),
85
- http.api({
86
- method: "get",
87
- baseURL: "https://creator.xiaohongshu.com",
88
- url: sevenDataUrl,
89
- headers: {
90
- "x-s": xs,
91
- "x-t": xt
92
- }
93
- })
94
- ]);
95
- const xhsData = {
96
- fansNum: overAllData.data.fans_count,
97
- favedNum: overAllData.data.faved_count,
98
- watchNumLastWeek: sevenData.data.seven.view_count,
99
- likeNumLastWeek: sevenData.data.seven.like_count,
100
- collectNumLastWeek: sevenData.data.seven.collect_count,
101
- commentNumLastWeek: sevenData.data.seven.comment_count,
102
- fansNumLastWeek: sevenData.data.seven.rise_fans_count,
103
- fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
104
- };
105
- return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.success)(xhsData, "小红书粉丝数据获取成功!");
106
- } catch (error) {
107
- return errorResponse(error instanceof Error ? error.message : "小红书数据获取失败");
108
- }
109
- }
9
+ var _types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/actions/searchAccountInfo/types.ts");
10
+ var _utils_http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/utils/http.ts");
11
+ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/utils/index.ts");
110
12
  async function getWeixinData(params) {
13
+ const { token } = params;
14
+ if (!token) return {
15
+ code: 200,
16
+ message: "缺少token",
17
+ data: null
18
+ };
111
19
  try {
112
20
  const { token } = params;
113
- if (!token) return errorResponse("缺少token", 200);
114
- const http = new _utils_http__WEBPACK_IMPORTED_MODULE_2__.e({
21
+ if (!token) return (0, _types__WEBPACK_IMPORTED_MODULE_3__.V)("缺少token", 200);
22
+ const http = new _utils_http__WEBPACK_IMPORTED_MODULE_1__.e({
115
23
  headers: {
116
24
  cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
117
25
  }
118
26
  });
119
27
  const massRandomIDHtml = await http.api({
120
28
  method: "get",
121
- url: "https://mp.weixin.qq.com/misc/appmsganalysis?action=report&token=1900237878&lang=zh_CN",
29
+ url: "https://mp.weixin.qq.com/misc/appmsganalysis",
122
30
  params: {
123
31
  token,
124
32
  lang: "zh_CN",
@@ -148,11 +56,11 @@ var __webpack_modules__ = {
148
56
  const readAllList = arrays.readAllList || [];
149
57
  const shareAllList = arrays.shareAllList || [];
150
58
  const fansInfoReg = fansInfoHtml.match(/window\.CGI_DATA\['pages\/statistics\/user_statistics'\]\s*=\s*(\{[\s\S]*?\});/);
151
- if (!fansInfoReg) return errorResponse("未找到粉丝信息", 200);
59
+ if (!fansInfoReg) return (0, _types__WEBPACK_IMPORTED_MODULE_3__.V)("未找到粉丝信息", 200);
152
60
  const fansInfo = eval("(" + fansInfoReg[1] + ")");
153
- const yesterday = _utils_index__WEBPACK_IMPORTED_MODULE_1__.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyy-MM-dd");
61
+ const yesterday = _utils__WEBPACK_IMPORTED_MODULE_2__.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyy-MM-dd");
154
62
  const yesterdayFansInfo = fansInfo.list[0]?.list.find((item)=>item.date === yesterday);
155
- if (!yesterdayFansInfo) return errorResponse("未找到粉丝数", 200);
63
+ if (!yesterdayFansInfo) return (0, _types__WEBPACK_IMPORTED_MODULE_3__.V)("未找到粉丝数", 200);
156
64
  const wxData = {
157
65
  fansNum: yesterdayFansInfo.cumulate_user,
158
66
  fansNumYesterday: yesterdayFansInfo.new_user - yesterdayFansInfo.cancel_user,
@@ -161,70 +69,20 @@ var __webpack_modules__ = {
161
69
  };
162
70
  return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.success)(wxData, "微信粉丝数据获取成功!");
163
71
  } catch (error) {
164
- return errorResponse(error instanceof Error ? error.message : "微信数据获取失败");
165
- }
166
- }
167
- async function getBaijiahaoData(params) {
168
- try {
169
- const { token } = params;
170
- if (!token) return errorResponse("缺少token", 200);
171
- const http = new _utils_http__WEBPACK_IMPORTED_MODULE_2__.e({
172
- headers: {
173
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
174
- token: String(token),
175
- Referer: "https://baijiahao.baidu.com/builder/rc/home"
176
- }
177
- });
178
- const yesterday = _utils_index__WEBPACK_IMPORTED_MODULE_1__.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
179
- const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
180
- http.api({
181
- method: "get",
182
- url: "https://baijiahao.baidu.com/pcui/home/index"
183
- }),
184
- http.api({
185
- method: "get",
186
- url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
187
- }),
188
- http.api({
189
- method: "get",
190
- url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
191
- }),
192
- http.api({
193
- method: "get",
194
- url: `https://baijiahao.baidu.com/author/eco/statistics/appStatistic?type=all&is_yesterday=false&start_day=${yesterday}&end_day=${yesterday}&stat=0`
195
- })
196
- ]);
197
- const bjhData = {
198
- fansNum: fansData.data.coreData.fansCount,
199
- fansNumYesterday: yesterdayData.data.data.fans_increase,
200
- readNum: readData.data.total.view_count,
201
- incomeNum: incomeData.data.all_income.total_income,
202
- incomeNumYesterday: incomeData.data.all_income.yesterday_income,
203
- recommendNumYesterday: yesterdayData.data.data.recommend_count,
204
- readNumYesterday: yesterdayData.data.data.view_count,
205
- likeNumYesterday: yesterdayData.data.data.likes_count,
206
- commentNumYesterday: yesterdayData.data.data.comment_count
207
- };
208
- return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.success)(bjhData, "百家号粉丝数据获取成功!");
209
- } catch (error) {
210
- return errorResponse(error instanceof Error ? error.message : "百家号数据获取失败");
72
+ return (0, _types__WEBPACK_IMPORTED_MODULE_3__.V)(error instanceof Error ? error.message : "微信数据获取失败");
211
73
  }
212
74
  }
213
- const SearchAccountInfo = async (_task, params)=>{
214
- const { platform } = params;
215
- switch(platform){
216
- case "toutiao":
217
- return getToutiaoData(params);
218
- case "xiaohongshu":
219
- return getXiaohongshuData(params);
220
- case "weixin":
221
- return getWeixinData(params);
222
- case "baijiahao":
223
- return getBaijiahaoData(params);
224
- default:
225
- return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.success)(null, "暂不支持该平台");
226
- }
227
- };
75
+ },
76
+ "./src/actions/searchAccountInfo/types.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
77
+ "use strict";
78
+ __webpack_require__.d(__webpack_exports__, {
79
+ V: ()=>errorResponse
80
+ });
81
+ const errorResponse = (message, code = 500)=>({
82
+ code,
83
+ message,
84
+ data: null
85
+ });
228
86
  },
229
87
  "./src/utils/http.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
230
88
  "use strict";
@@ -1596,65 +1454,6 @@ var __webpack_modules__ = {
1596
1454
  }
1597
1455
  module[a0_0x45db08(0xae)] = GenAB;
1598
1456
  },
1599
- "./src/utils/xhsXsEncrypt.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1600
- "use strict";
1601
- __webpack_require__.d(__webpack_exports__, {
1602
- H: ()=>XsEncrypt
1603
- });
1604
- const external_node_buffer_namespaceObject = require("node:buffer");
1605
- const external_node_crypto_namespaceObject = require("node:crypto");
1606
- var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
1607
- class XsEncrypt {
1608
- async encryptMD5(url) {
1609
- return external_node_crypto_default().createHash("md5").update(url, "utf8").digest("hex");
1610
- }
1611
- async encryptText(text) {
1612
- const textEncoded = external_node_buffer_namespaceObject.Buffer.from(text).toString("base64");
1613
- const cipher = external_node_crypto_default().createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
1614
- const ciphertext = cipher.update(textEncoded, "utf8", "base64");
1615
- return ciphertext + cipher.final("base64");
1616
- }
1617
- async base64ToHex(encodedData) {
1618
- const decodedData = external_node_buffer_namespaceObject.Buffer.from(encodedData, "base64");
1619
- return decodedData.toString("hex");
1620
- }
1621
- async encryptPayload(payload, platform) {
1622
- const hexPayload = await this.base64ToHex(payload);
1623
- const obj = {
1624
- signSvn: "56",
1625
- signType: "x2",
1626
- appID: platform,
1627
- signVersion: "1",
1628
- payload: hexPayload
1629
- };
1630
- const jsonString = JSON.stringify(obj, null, 0);
1631
- return external_node_buffer_namespaceObject.Buffer.from(jsonString).toString("base64");
1632
- }
1633
- async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
1634
- const text = `x1=${await this.encryptMD5(`url=${url}`)};x2=0|0|0|1|0|0|1|0|0|0|1|0|0|0|0|1|0|0|0;x3=${a1};x4=${ts};`;
1635
- return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
1636
- }
1637
- dumps(...rest) {
1638
- const [data, replacer = null, space = 0] = rest;
1639
- return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
1640
- }
1641
- constructor(){
1642
- this.words = [
1643
- 929260340,
1644
- 1633971297,
1645
- 895580464,
1646
- 925905270
1647
- ];
1648
- this.keyBytes = external_node_buffer_namespaceObject.Buffer.concat(this.words.map((word)=>new Uint8Array(external_node_buffer_namespaceObject.Buffer.from([
1649
- word >> 24 & 0xff,
1650
- word >> 16 & 0xff,
1651
- word >> 8 & 0xff,
1652
- 0xff & word
1653
- ]))));
1654
- this.iv = external_node_buffer_namespaceObject.Buffer.from("4uzjr7mbsibcaldp", "utf8");
1655
- }
1656
- }
1657
- },
1658
1457
  "@iflyrpa/share": function(module) {
1659
1458
  "use strict";
1660
1459
  module.exports = require("@iflyrpa/share");
@@ -2995,280 +2794,533 @@ var __webpack_exports__ = {};
2995
2794
  }, "百家号账号有效性检测失败!");
2996
2795
  }
2997
2796
  };
2998
- var searchAccountInfo = __webpack_require__("./src/actions/searchAccountInfo/index.ts");
2999
- var xhsXsEncrypt = __webpack_require__("./src/utils/xhsXsEncrypt.ts");
3000
- const FetchArticles = async (_task, params)=>{
3001
- const { platform, cookies, token, pageNum = 1, pageSize = 10, onlySuccess = false, showOriginalData = false } = params;
2797
+ var types = __webpack_require__("./src/actions/searchAccountInfo/types.ts");
2798
+ async function getBaijiahaoData(params) {
3002
2799
  try {
3003
- switch(platform){
3004
- case "toutiao":
3005
- {
3006
- const http = new utils_http.e({
3007
- headers: {
3008
- cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
3009
- }
3010
- });
3011
- const visitedUid = await http.api({
3012
- url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?",
3013
- method: "get",
3014
- params: {
3015
- app_id: 1231
3016
- }
3017
- });
3018
- const articleInfo = await http.api({
3019
- method: "get",
3020
- url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
3021
- params: {
3022
- provider_type: "mp_provider",
3023
- aid: "13",
3024
- app_name: "news_article",
3025
- category: "mp_all",
3026
- channel: "",
3027
- stream_api_version: "88",
3028
- genre_type_switch: '{"repost":1,"small_video":1,"toutiao_graphic":1,"weitoutiao":1,"xigua_video":1}',
3029
- device_platform: "pc",
3030
- platform_id: "0",
3031
- visited_uid: visitedUid.user_id_str,
3032
- offset: (pageNum - 1) * pageSize,
3033
- count: pageSize,
3034
- keyword: "",
3035
- client_extra_params: `{"category":"mp_all","real_app_id":"1231","need_forward":"true","offset_mode":"1","page_index":"1","status":${onlySuccess ? "2" : "8"},"source":"0"}`,
3036
- app_id: "1231"
3037
- }
3038
- });
3039
- const articleCell = articleInfo.data.map((item)=>({
3040
- title: item.assembleCell.itemCell.articleBase.title,
3041
- imageUrl: item.assembleCell.itemCell.imageList.staggerFeedCover[0].url,
3042
- createTime: item.assembleCell.itemCell.articleBase.publishTime,
3043
- redirectUrl: item.assembleCell.itemCell.articleBase.articleURL,
3044
- showNum: item.assembleCell.itemCell.itemCounter.showCount,
3045
- readNum: item.assembleCell.itemCell.itemCounter.readCount,
3046
- likeNum: item.assembleCell.itemCell.itemCounter.diggCount,
3047
- commentNum: item.assembleCell.itemCell.itemCounter.commentCount,
3048
- ...showOriginalData ? {
3049
- originalData: item
3050
- } : {}
3051
- }));
3052
- const api_base_info_json = JSON.parse(articleInfo.api_base_info.app_extra_params);
3053
- return (0, share_.success)({
3054
- articleCell,
3055
- pagination: {
3056
- total: api_base_info_json.total_count,
3057
- pageNum,
3058
- pageSize
3059
- }
3060
- }, "头条号文章获取成功");
2800
+ const { token } = params;
2801
+ if (!token) return (0, types.V)("缺少token", 200);
2802
+ const http = new utils_http.e({
2803
+ headers: {
2804
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2805
+ token: String(token),
2806
+ Referer: "https://baijiahao.baidu.com/builder/rc/home"
2807
+ }
2808
+ });
2809
+ const yesterday = utils.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
2810
+ const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
2811
+ http.api({
2812
+ method: "get",
2813
+ url: "https://baijiahao.baidu.com/pcui/home/index"
2814
+ }),
2815
+ http.api({
2816
+ method: "get",
2817
+ url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
2818
+ }),
2819
+ http.api({
2820
+ method: "get",
2821
+ url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
2822
+ }),
2823
+ http.api({
2824
+ method: "get",
2825
+ url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
2826
+ params: {
2827
+ type: "all",
2828
+ is_yesterday: false,
2829
+ start_day: yesterday,
2830
+ end_day: yesterday,
2831
+ stat: 0
3061
2832
  }
3062
- case "weixin":
3063
- {
3064
- if (!token) return {
3065
- code: 200,
3066
- message: "缺少token",
3067
- data: null
3068
- };
3069
- const http = new utils_http.e({
3070
- headers: {
3071
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
3072
- }
3073
- });
3074
- const ParsePublishPage = (body)=>{
3075
- const decodeHtml = (str)=>str.replace(/&quot;/g, '"').replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&#39;/g, "'").replace(/&nbsp;/g, ' ');
3076
- const match = body.match(/publish_page\s*=\s*(\{[\s\S]*?\})\s*;/);
3077
- if (!match) throw new Error('无法提取 publish_page 字段');
3078
- const rawPublishPageStr = match[1];
3079
- const parsedData = JSON.parse(rawPublishPageStr);
3080
- const finalData = {
3081
- ...parsedData,
3082
- publish_list: parsedData.publish_list.map((item)=>{
3083
- const decoded = decodeHtml(item.publish_info);
3084
- const parsedInfo = JSON.parse(decoded);
3085
- return {
3086
- publish_type: item.publish_type,
3087
- publish_info: parsedInfo
3088
- };
3089
- })
3090
- };
3091
- return finalData;
3092
- };
3093
- const rawArticlesInfo = await http.api({
3094
- method: "get",
3095
- url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish?sub=list&begin=0&count=10&token=1453947575&lang=zh_CN',
3096
- params: {
3097
- sub: "list",
3098
- begin: (pageNum - 1) * pageSize,
3099
- count: pageSize,
3100
- token: token,
3101
- lang: "zh_CN"
3102
- }
3103
- });
3104
- const articlesInfo = ParsePublishPage(rawArticlesInfo);
3105
- const articleCell = articlesInfo?.publish_list.map((item)=>({
3106
- title: item.publish_info.appmsg_info[0].title,
3107
- imageUrl: item.publish_info.appmsg_info[0].cover,
3108
- createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3109
- redirectUrl: item.publish_info.appmsg_info[0].content_url,
3110
- readNum: item.publish_info.appmsg_info[0].read_num,
3111
- likeNum: item.publish_info.appmsg_info[0].old_like_num,
3112
- shareNum: item.publish_info.appmsg_info[0].share_num,
3113
- recommendNum: item.publish_info.appmsg_info[0].like_num,
3114
- ...showOriginalData ? {
3115
- originalData: item
3116
- } : {}
3117
- }));
3118
- return (0, share_.success)({
3119
- articleCell,
3120
- ...onlySuccess ? {
3121
- pagination: {
3122
- total: articlesInfo?.total_count,
3123
- pageNum,
3124
- pageSize
3125
- }
3126
- } : null
3127
- }, "微信文章获取成功");
2833
+ })
2834
+ ]);
2835
+ const bjhData = {
2836
+ fansNum: fansData.data.coreData.fansCount,
2837
+ fansNumYesterday: -1 == yesterdayData.data.data.fans_increase ? null : yesterdayData.data.data.fans_increase,
2838
+ readNum: readData.data.total.view_count,
2839
+ incomeNum: incomeData.data.all_income.total_income,
2840
+ incomeNumYesterday: -1 == incomeData.data.all_income.yesterday_income ? null : incomeData.data.all_income.yesterday_income,
2841
+ recommendNumYesterday: -1 == yesterdayData.data.data.recommend_count ? null : yesterdayData.data.data.recommend_count,
2842
+ readNumYesterday: -1 == yesterdayData.data.data.view_count ? null : yesterdayData.data.data.view_count,
2843
+ likeNumYesterday: -1 == yesterdayData.data.data.likes_count ? null : yesterdayData.data.data.likes_count,
2844
+ commentNumYesterday: -1 == yesterdayData.data.data.comment_count ? null : yesterdayData.data.data.comment_count
2845
+ };
2846
+ return (0, share_.success)(bjhData, "百家号粉丝数据获取成功!");
2847
+ } catch (error) {
2848
+ return (0, types.V)(error instanceof Error ? error.message : "百家号数据获取失败");
2849
+ }
2850
+ }
2851
+ async function getToutiaoData(params) {
2852
+ const { cookies } = params;
2853
+ try {
2854
+ const http = new utils_http.e({
2855
+ headers: {
2856
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2857
+ referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
2858
+ }
2859
+ });
2860
+ const [totalData, fansDataYesterday, contentDataYesterday] = await Promise.all([
2861
+ http.api({
2862
+ method: "get",
2863
+ url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
2864
+ params: {
2865
+ app_id: 1231
3128
2866
  }
3129
- case "baijiahao":
3130
- {
3131
- if (!token) return {
3132
- code: 200,
3133
- message: "缺少token",
3134
- data: null
3135
- };
3136
- const http = new utils_http.e({
3137
- headers: {
3138
- cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
3139
- token: token
3140
- }
3141
- });
3142
- async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
3143
- return await http.api({
3144
- method: "get",
3145
- url: "https://baijiahao.baidu.com/pcui/article/lists",
3146
- params: {
3147
- currentPage: pageNum,
3148
- pageSize: pageSize,
3149
- search: "",
3150
- type: "",
3151
- collection: onlySuccess ? "publish" : "",
3152
- clearBeforeFetch: false,
3153
- dynamic: 1
3154
- }
3155
- });
3156
- }
3157
- const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
3158
- let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
3159
- const totalPage = articleInfo.data.page?.totalPage || 1;
3160
- let currentPage = pageNum + 1;
3161
- const usedPages = new Set();
3162
- while(filtered.length < pageSize && currentPage <= totalPage){
3163
- if (usedPages.has(currentPage)) {
3164
- currentPage++;
3165
- continue;
3166
- }
3167
- const res = await fetchArticles(currentPage, pageSize, onlySuccess);
3168
- usedPages.add(currentPage);
3169
- const validItems = res.data.list.filter((item)=>"draft" !== item.status);
3170
- filtered.push(...validItems);
3171
- currentPage++;
3172
- }
3173
- const final = filtered.slice(0, pageSize);
3174
- const articleCell = final.map((item)=>({
3175
- title: item.title,
3176
- imageUrl: JSON.parse(item.cover_images)[0].src,
3177
- createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
3178
- redirectUrl: item.url,
3179
- recommendNum: item.rec_amount,
3180
- collectNum: item.collection_amount,
3181
- readNum: item.read_amount,
3182
- likeNum: item.like_amount,
3183
- commentNum: item.comment_amount,
3184
- shareNum: item.share_amount,
3185
- ...showOriginalData ? {
3186
- originalData: item
3187
- } : {}
3188
- }));
3189
- return (0, share_.success)({
3190
- articleCell,
3191
- ...onlySuccess ? {
3192
- pagination: {
3193
- total: articleInfo.data.page?.totalCount,
3194
- pageNum,
3195
- pageSize
3196
- }
3197
- } : null
3198
- }, "百家号文章获取成功");
2867
+ }),
2868
+ http.api({
2869
+ method: "get",
2870
+ url: "https://mp.toutiao.com/mp/agw/statistic/v2/fans/latest_stat",
2871
+ params: {
2872
+ app_id: 1231
3199
2873
  }
3200
- case "xiaohongshu":
3201
- {
3202
- const xsEncrypt = new xhsXsEncrypt.H();
3203
- const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
3204
- if (!a1Cookie) return {
3205
- code: 200,
3206
- message: "账号数据异常",
3207
- data: null
3208
- };
3209
- if (10 != pageSize) return {
3210
- code: 200,
3211
- message: "小红书pageSize不可修改",
3212
- data: null
2874
+ }),
2875
+ http.api({
2876
+ method: "get",
2877
+ url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
2878
+ params: {
2879
+ type: 0,
2880
+ app_id: 1231
2881
+ }
2882
+ })
2883
+ ]);
2884
+ const ttData = {
2885
+ fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
2886
+ fansNumYesterday: fansDataYesterday.fans_stat.change_count,
2887
+ readNum: Number(totalData.data.statistic.data.total_read_play_count),
2888
+ incomeNum: totalData.data.statistic.data.total_income,
2889
+ incomeNumYesterday: totalData.data.statistic.data.yesterday_income,
2890
+ showNumYesterday: contentDataYesterday.author_stat.consume_data.impression_count,
2891
+ readNumYesterday: contentDataYesterday.author_stat.consume_data.go_detail_count,
2892
+ likeNumYesterday: contentDataYesterday.author_stat.interaction_data.digg_count,
2893
+ commentNumYesterday: contentDataYesterday.author_stat.interaction_data.comment_count
2894
+ };
2895
+ return (0, share_.success)(ttData, "头条号粉丝数据获取成功!");
2896
+ } catch (error) {
2897
+ return (0, types.V)(error instanceof Error ? error.message : "头条号数据获取失败");
2898
+ }
2899
+ }
2900
+ var getWxInfo = __webpack_require__("./src/actions/searchAccountInfo/getWxInfo.ts");
2901
+ const external_node_buffer_namespaceObject = require("node:buffer");
2902
+ const external_node_crypto_namespaceObject = require("node:crypto");
2903
+ var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
2904
+ class XsEncrypt {
2905
+ async encryptMD5(url) {
2906
+ return external_node_crypto_default().createHash("md5").update(url, "utf8").digest("hex");
2907
+ }
2908
+ async encryptText(text) {
2909
+ const textEncoded = external_node_buffer_namespaceObject.Buffer.from(text).toString("base64");
2910
+ const cipher = external_node_crypto_default().createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
2911
+ const ciphertext = cipher.update(textEncoded, "utf8", "base64");
2912
+ return ciphertext + cipher.final("base64");
2913
+ }
2914
+ async base64ToHex(encodedData) {
2915
+ const decodedData = external_node_buffer_namespaceObject.Buffer.from(encodedData, "base64");
2916
+ return decodedData.toString("hex");
2917
+ }
2918
+ async encryptPayload(payload, platform) {
2919
+ const hexPayload = await this.base64ToHex(payload);
2920
+ const obj = {
2921
+ signSvn: "56",
2922
+ signType: "x2",
2923
+ appID: platform,
2924
+ signVersion: "1",
2925
+ payload: hexPayload
2926
+ };
2927
+ const jsonString = JSON.stringify(obj, null, 0);
2928
+ return external_node_buffer_namespaceObject.Buffer.from(jsonString).toString("base64");
2929
+ }
2930
+ async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
2931
+ const text = `x1=${await this.encryptMD5(`url=${url}`)};x2=0|0|0|1|0|0|1|0|0|0|1|0|0|0|0|1|0|0|0;x3=${a1};x4=${ts};`;
2932
+ return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
2933
+ }
2934
+ dumps(...rest) {
2935
+ const [data, replacer = null, space = 0] = rest;
2936
+ return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
2937
+ }
2938
+ constructor(){
2939
+ this.words = [
2940
+ 929260340,
2941
+ 1633971297,
2942
+ 895580464,
2943
+ 925905270
2944
+ ];
2945
+ this.keyBytes = external_node_buffer_namespaceObject.Buffer.concat(this.words.map((word)=>new Uint8Array(external_node_buffer_namespaceObject.Buffer.from([
2946
+ word >> 24 & 0xff,
2947
+ word >> 16 & 0xff,
2948
+ word >> 8 & 0xff,
2949
+ 0xff & word
2950
+ ]))));
2951
+ this.iv = external_node_buffer_namespaceObject.Buffer.from("4uzjr7mbsibcaldp", "utf8");
2952
+ }
2953
+ }
2954
+ async function getXiaohongshuData(params) {
2955
+ try {
2956
+ const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
2957
+ if (!a1Cookie) return (0, types.V)("账号数据异常,请重新绑定账号后重试。", 200);
2958
+ const http = new utils_http.e({
2959
+ headers: {
2960
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2961
+ referer: "https://creator.xiaohongshu.com",
2962
+ origin: "https://creator.xiaohongshu.com"
2963
+ }
2964
+ });
2965
+ const xsEncrypt = new XsEncrypt();
2966
+ const xt = Date.now().toString();
2967
+ const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
2968
+ const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
2969
+ const [overAllData, sevenData] = await Promise.all([
2970
+ http.api({
2971
+ method: "get",
2972
+ url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
2973
+ }),
2974
+ http.api({
2975
+ method: "get",
2976
+ baseURL: "https://creator.xiaohongshu.com",
2977
+ url: sevenDataUrl,
2978
+ headers: {
2979
+ "x-s": xs,
2980
+ "x-t": xt
2981
+ }
2982
+ })
2983
+ ]);
2984
+ const xhsData = {
2985
+ fansNum: overAllData.data.fans_count,
2986
+ favedNum: overAllData.data.faved_count,
2987
+ watchNumLastWeek: sevenData.data.seven.view_count,
2988
+ likeNumLastWeek: sevenData.data.seven.like_count,
2989
+ collectNumLastWeek: sevenData.data.seven.collect_count,
2990
+ commentNumLastWeek: sevenData.data.seven.comment_count,
2991
+ fansNumLastWeek: sevenData.data.seven.rise_fans_count,
2992
+ fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
2993
+ };
2994
+ return (0, share_.success)(xhsData, "小红书粉丝数据获取成功!");
2995
+ } catch (error) {
2996
+ return (0, types.V)(error instanceof Error ? error.message : "小红书数据获取失败");
2997
+ }
2998
+ }
2999
+ const SearchAccountInfo = async (_task, params)=>{
3000
+ const { platform } = params;
3001
+ switch(platform){
3002
+ case "toutiao":
3003
+ return getToutiaoData(params);
3004
+ case "xiaohongshu":
3005
+ return getXiaohongshuData(params);
3006
+ case "weixin":
3007
+ return (0, getWxInfo.n)(params);
3008
+ case "baijiahao":
3009
+ return getBaijiahaoData(params);
3010
+ default:
3011
+ return (0, share_.success)(null, "暂不支持该平台");
3012
+ }
3013
+ };
3014
+ const errorResponse = (message, code = 500)=>({
3015
+ code,
3016
+ message,
3017
+ data: null
3018
+ });
3019
+ async function handleToutiaoData(params) {
3020
+ try {
3021
+ const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3022
+ const http = new utils_http.e({
3023
+ headers: {
3024
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
3025
+ }
3026
+ });
3027
+ const visitedUid = await http.api({
3028
+ url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?",
3029
+ method: "get",
3030
+ params: {
3031
+ app_id: 1231
3032
+ }
3033
+ });
3034
+ const articleInfo = await http.api({
3035
+ method: "get",
3036
+ url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
3037
+ params: {
3038
+ provider_type: "mp_provider",
3039
+ aid: "13",
3040
+ app_name: "news_article",
3041
+ category: "mp_all",
3042
+ channel: "",
3043
+ stream_api_version: "88",
3044
+ genre_type_switch: '{"repost":1,"small_video":1,"toutiao_graphic":1,"weitoutiao":1,"xigua_video":1}',
3045
+ device_platform: "pc",
3046
+ platform_id: "0",
3047
+ visited_uid: visitedUid.user_id_str,
3048
+ offset: (pageNum - 1) * pageSize,
3049
+ count: pageSize,
3050
+ keyword: "",
3051
+ client_extra_params: `{"category":"mp_all","real_app_id":"1231","need_forward":"true","offset_mode":"1","page_index":"1","status":${onlySuccess ? "2" : "8"},"source":"0"}`,
3052
+ app_id: "1231"
3053
+ }
3054
+ });
3055
+ const articleCell = articleInfo.data.map((item)=>({
3056
+ title: item.assembleCell.itemCell.articleBase.title,
3057
+ imageUrl: item.assembleCell.itemCell.imageList.staggerFeedCover[0].url,
3058
+ createTime: item.assembleCell.itemCell.articleBase.publishTime,
3059
+ redirectUrl: item.assembleCell.itemCell.articleBase.articleURL,
3060
+ showNum: item.assembleCell.itemCell.itemCounter.showCount,
3061
+ readNum: item.assembleCell.itemCell.itemCounter.readCount,
3062
+ likeNum: item.assembleCell.itemCell.itemCounter.diggCount,
3063
+ commentNum: item.assembleCell.itemCell.itemCounter.commentCount,
3064
+ ...showOriginalData ? {
3065
+ originalData: item
3066
+ } : {}
3067
+ }));
3068
+ const api_base_info_json = JSON.parse(articleInfo.api_base_info.app_extra_params);
3069
+ return (0, share_.success)({
3070
+ articleCell,
3071
+ ...onlySuccess ? {
3072
+ pagination: {
3073
+ total: api_base_info_json.total_count || -1,
3074
+ pageNum,
3075
+ pageSize
3076
+ }
3077
+ } : null
3078
+ }, "头条号文章获取成功");
3079
+ } catch (error) {
3080
+ return errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
3081
+ }
3082
+ }
3083
+ async function handleWeixinData(params) {
3084
+ try {
3085
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3086
+ if (!token) return {
3087
+ code: 200,
3088
+ message: "缺少token",
3089
+ data: null
3090
+ };
3091
+ const http = new utils_http.e({
3092
+ headers: {
3093
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
3094
+ }
3095
+ });
3096
+ const ParsePublishPage = (body)=>{
3097
+ const decodeHtml = (str)=>str.replace(/&quot;/g, '"').replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&#39;/g, "'").replace(/&nbsp;/g, ' ');
3098
+ const match = body.match(/publish_page\s*=\s*(\{[\s\S]*?\})\s*;/);
3099
+ if (!match) throw new Error('无法提取 publish_page 字段');
3100
+ const rawPublishPageStr = match[1];
3101
+ const parsedData = JSON.parse(rawPublishPageStr);
3102
+ const finalData = {
3103
+ ...parsedData,
3104
+ publish_list: parsedData.publish_list.map((item)=>{
3105
+ const decoded = decodeHtml(item.publish_info);
3106
+ const parsedInfo = JSON.parse(decoded);
3107
+ return {
3108
+ publish_type: item.publish_type,
3109
+ publish_info: parsedInfo
3213
3110
  };
3214
- const http = new utils_http.e({
3215
- headers: {
3216
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
3217
- referer: "https://creator.xiaohongshu.com",
3218
- origin: "https://creator.xiaohongshu.com"
3219
- }
3220
- });
3221
- const xt = Date.now().toString();
3222
- const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
3223
- const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
3224
- const articleInfo = await http.api({
3225
- method: "get",
3226
- baseURL: "https://edith.xiaohongshu.com",
3227
- url: serveUrl,
3228
- headers: {
3229
- "x-s": xs,
3230
- "x-t": xt
3231
- }
3232
- });
3233
- const articleCell = articleInfo.data.notes.map((item)=>({
3234
- title: item.display_title,
3235
- imageUrl: item.images_list[0].url,
3236
- createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
3237
- redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
3238
- readNum: item.view_count,
3239
- likeNum: item.likes,
3240
- commentNum: item.comments_count,
3241
- collectNum: item.collected_count,
3242
- shareNum: item.shared_count,
3243
- ...showOriginalData ? {
3244
- originalData: item
3245
- } : {}
3246
- }));
3247
- return (0, share_.success)({
3248
- articleCell,
3249
- ...onlySuccess ? {
3250
- pagination: {
3251
- total: articleInfo.data.tags[0].notes_count,
3252
- pageNum,
3253
- pageSize
3254
- }
3255
- } : null
3256
- }, "小红书文章获取成功");
3111
+ })
3112
+ };
3113
+ return finalData;
3114
+ };
3115
+ const rawArticlesInfo = await http.api({
3116
+ method: "get",
3117
+ url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish',
3118
+ params: {
3119
+ sub: "list",
3120
+ begin: (pageNum - 1) * pageSize,
3121
+ count: pageSize,
3122
+ token: token,
3123
+ lang: "zh_CN"
3124
+ }
3125
+ });
3126
+ const articlesInfo = ParsePublishPage(rawArticlesInfo);
3127
+ const articleCell = articlesInfo?.publish_list.map((item)=>({
3128
+ title: item.publish_info.appmsg_info[0].title,
3129
+ imageUrl: item.publish_info.appmsg_info[0].cover,
3130
+ createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3131
+ redirectUrl: item.publish_info.appmsg_info[0].content_url,
3132
+ readNum: item.publish_info.appmsg_info[0].read_num,
3133
+ likeNum: item.publish_info.appmsg_info[0].old_like_num,
3134
+ shareNum: item.publish_info.appmsg_info[0].share_num,
3135
+ recommendNum: item.publish_info.appmsg_info[0].like_num,
3136
+ ...showOriginalData ? {
3137
+ originalData: item
3138
+ } : {}
3139
+ }));
3140
+ return (0, share_.success)({
3141
+ articleCell,
3142
+ ...onlySuccess ? {
3143
+ pagination: {
3144
+ total: articlesInfo?.total_count,
3145
+ pageNum,
3146
+ pageSize
3257
3147
  }
3258
- default:
3259
- return {
3260
- code: 200,
3261
- message: "暂不支持该平台",
3262
- data: null
3263
- };
3148
+ } : null
3149
+ }, "微信文章获取成功");
3150
+ } catch (error) {
3151
+ return errorResponse(error instanceof Error ? error.message : "微信数据获取失败");
3152
+ }
3153
+ }
3154
+ async function handleBaijiahaoData(params) {
3155
+ try {
3156
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3157
+ if (!token) return {
3158
+ code: 200,
3159
+ message: "缺少token",
3160
+ data: null
3161
+ };
3162
+ const http = new utils_http.e({
3163
+ headers: {
3164
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
3165
+ token: token
3166
+ }
3167
+ });
3168
+ async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
3169
+ return await http.api({
3170
+ method: "get",
3171
+ url: "https://baijiahao.baidu.com/pcui/article/lists",
3172
+ params: {
3173
+ currentPage: pageNum,
3174
+ pageSize: pageSize,
3175
+ search: "",
3176
+ type: "",
3177
+ collection: onlySuccess ? "publish" : "",
3178
+ clearBeforeFetch: false,
3179
+ dynamic: 1
3180
+ }
3181
+ });
3182
+ }
3183
+ const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
3184
+ let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
3185
+ const totalPage = articleInfo.data.page?.totalPage || 1;
3186
+ let currentPage = pageNum + 1;
3187
+ const usedPages = new Set();
3188
+ while(filtered.length < pageSize && currentPage <= totalPage){
3189
+ if (usedPages.has(currentPage)) {
3190
+ currentPage++;
3191
+ continue;
3192
+ }
3193
+ const res = await fetchArticles(currentPage, pageSize, onlySuccess);
3194
+ usedPages.add(currentPage);
3195
+ const validItems = res.data.list.filter((item)=>"draft" !== item.status);
3196
+ filtered.push(...validItems);
3197
+ currentPage++;
3264
3198
  }
3199
+ const final = filtered.slice(0, pageSize);
3200
+ const articleCell = final.map((item)=>({
3201
+ title: item.title,
3202
+ imageUrl: JSON.parse(item.cover_images)[0].src,
3203
+ createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
3204
+ redirectUrl: item.url,
3205
+ recommendNum: item.rec_amount,
3206
+ collectNum: item.collection_amount,
3207
+ readNum: item.read_amount,
3208
+ likeNum: item.like_amount,
3209
+ commentNum: item.comment_amount,
3210
+ shareNum: item.share_amount,
3211
+ ...showOriginalData ? {
3212
+ originalData: item
3213
+ } : {}
3214
+ }));
3215
+ return (0, share_.success)({
3216
+ articleCell,
3217
+ ...onlySuccess ? {
3218
+ pagination: {
3219
+ total: articleInfo.data.page?.totalCount,
3220
+ pageNum,
3221
+ pageSize
3222
+ }
3223
+ } : null
3224
+ }, "百家号文章获取成功");
3265
3225
  } catch (error) {
3266
- console.error("获取文章数据失败:", error);
3267
- return {
3268
- code: 500,
3269
- message: "获取文章数据失败",
3226
+ return errorResponse(error instanceof Error ? error.message : "百家号数据获取失败");
3227
+ }
3228
+ }
3229
+ async function handleXiaohongshuData(params) {
3230
+ try {
3231
+ const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3232
+ const xsEncrypt = new XsEncrypt();
3233
+ const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
3234
+ if (!a1Cookie) return {
3235
+ code: 200,
3236
+ message: "账号数据异常",
3270
3237
  data: null
3271
3238
  };
3239
+ if (onlySuccess && 10 != pageSize) return {
3240
+ code: 200,
3241
+ message: "小红书pageSize不可修改",
3242
+ data: null
3243
+ };
3244
+ const http = new utils_http.e({
3245
+ headers: {
3246
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
3247
+ referer: "https://creator.xiaohongshu.com",
3248
+ origin: "https://creator.xiaohongshu.com"
3249
+ }
3250
+ });
3251
+ async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
3252
+ const xt = Date.now().toString();
3253
+ const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
3254
+ const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
3255
+ return await http.api({
3256
+ method: "get",
3257
+ baseURL: "https://edith.xiaohongshu.com",
3258
+ url: serveUrl,
3259
+ headers: {
3260
+ "x-s": xs,
3261
+ "x-t": xt
3262
+ }
3263
+ });
3264
+ }
3265
+ const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
3266
+ let hasNextpage = -1 != articleInfo.data.page;
3267
+ let filtered = articleInfo.data.notes;
3268
+ let currentPage = pageNum + 1;
3269
+ const usedPages = new Set();
3270
+ while(filtered.length < pageSize && hasNextpage){
3271
+ if (usedPages.has(currentPage)) {
3272
+ currentPage++;
3273
+ continue;
3274
+ }
3275
+ const res = await fetchArticles(currentPage, a1Cookie, onlySuccess);
3276
+ usedPages.add(currentPage);
3277
+ const validItems = res.data.notes;
3278
+ filtered.push(...validItems);
3279
+ currentPage++;
3280
+ hasNextpage = -1 != res.data.page;
3281
+ }
3282
+ const final = filtered.slice(0, pageSize);
3283
+ const articleCell = final.map((item)=>({
3284
+ title: item.display_title,
3285
+ imageUrl: item.images_list[0].url,
3286
+ createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
3287
+ redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
3288
+ readNum: item.view_count,
3289
+ likeNum: item.likes,
3290
+ commentNum: item.comments_count,
3291
+ collectNum: item.collected_count,
3292
+ shareNum: item.shared_count,
3293
+ ...showOriginalData ? {
3294
+ originalData: item
3295
+ } : {}
3296
+ }));
3297
+ return (0, share_.success)({
3298
+ articleCell,
3299
+ ...onlySuccess ? {
3300
+ pagination: {
3301
+ total: articleInfo.data.tags[0]?.notes_count || -1,
3302
+ pageNum,
3303
+ pageSize
3304
+ }
3305
+ } : null
3306
+ }, "小红书文章获取成功");
3307
+ } catch (error) {
3308
+ return errorResponse(error instanceof Error ? error.message : "小红书数据获取失败");
3309
+ }
3310
+ }
3311
+ const FetchArticles = async (_task, params)=>{
3312
+ const { platform } = params;
3313
+ switch(platform){
3314
+ case "toutiao":
3315
+ return handleToutiaoData(params);
3316
+ case "weixin":
3317
+ return handleWeixinData(params);
3318
+ case "baijiahao":
3319
+ return handleBaijiahaoData(params);
3320
+ case "xiaohongshu":
3321
+ return handleXiaohongshuData(params);
3322
+ default:
3323
+ return (0, share_.success)(null, "暂不支持该平台");
3272
3324
  }
3273
3325
  };
3274
3326
  const getWeixinConfig = async (_task, params)=>{
@@ -4824,7 +4876,7 @@ var __webpack_exports__ = {};
4824
4876
  903: "账户已登出,需重新登陆重试!",
4825
4877
  902: "登录已过期,请重新登录!"
4826
4878
  };
4827
- const mock_xsEncrypt = new xhsXsEncrypt.H();
4879
+ const mock_xsEncrypt = new XsEncrypt();
4828
4880
  const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
4829
4881
  const tmpCachePath = task.getTmpPath();
4830
4882
  const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
@@ -5013,7 +5065,7 @@ var __webpack_exports__ = {};
5013
5065
  });
5014
5066
  return (0, share_.success)(publishResult.data?.id);
5015
5067
  };
5016
- const rpa_xsEncrypt = new xhsXsEncrypt.H();
5068
+ const rpa_xsEncrypt = new XsEncrypt();
5017
5069
  const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
5018
5070
  const commonCookies = {
5019
5071
  path: "/",
@@ -5228,7 +5280,7 @@ var __webpack_exports__ = {};
5228
5280
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
5229
5281
  return (0, utils.jo)(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
5230
5282
  };
5231
- var package_namespaceObject = JSON.parse('{"i8":"1.2.14-beta.0"}');
5283
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.14-beta.2"}');
5232
5284
  class Action {
5233
5285
  constructor(task){
5234
5286
  this.task = task;
@@ -5253,7 +5305,7 @@ var __webpack_exports__ = {};
5253
5305
  return this.bindTask(FetchArticles, params);
5254
5306
  }
5255
5307
  SearchAccountInfo(params) {
5256
- return this.bindTask(searchAccountInfo.A, params);
5308
+ return this.bindTask(SearchAccountInfo, params);
5257
5309
  }
5258
5310
  TTSessionCheck(params) {
5259
5311
  return this.bindTask(TTSessionCheck, params);