@iflyrpa/actions 1.2.14-beta.0 → 1.2.14-beta.2

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 : "微信数据获取失败");
72
+ return (0, _types__WEBPACK_IMPORTED_MODULE_3__.V)(error instanceof Error ? error.message : "微信数据获取失败");
165
73
  }
166
74
  }
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 : "百家号数据获取失败");
211
- }
212
- }
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,531 @@ 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: yesterdayData.data.data.fans_increase,
2838
+ readNum: readData.data.total.view_count,
2839
+ incomeNum: incomeData.data.all_income.total_income,
2840
+ incomeNumYesterday: incomeData.data.all_income.yesterday_income,
2841
+ recommendNumYesterday: yesterdayData.data.data.recommend_count,
2842
+ readNumYesterday: yesterdayData.data.data.view_count,
2843
+ likeNumYesterday: yesterdayData.data.data.likes_count,
2844
+ commentNumYesterday: 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
+ pagination: {
3072
+ total: api_base_info_json.total_count,
3073
+ pageNum,
3074
+ pageSize
3075
+ }
3076
+ }, "头条号文章获取成功");
3077
+ } catch (error) {
3078
+ return errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
3079
+ }
3080
+ }
3081
+ async function handleWeixinData(params) {
3082
+ try {
3083
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3084
+ if (!token) return {
3085
+ code: 200,
3086
+ message: "缺少token",
3087
+ data: null
3088
+ };
3089
+ const http = new utils_http.e({
3090
+ headers: {
3091
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
3092
+ }
3093
+ });
3094
+ const ParsePublishPage = (body)=>{
3095
+ const decodeHtml = (str)=>str.replace(/&quot;/g, '"').replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&#39;/g, "'").replace(/&nbsp;/g, ' ');
3096
+ const match = body.match(/publish_page\s*=\s*(\{[\s\S]*?\})\s*;/);
3097
+ if (!match) throw new Error('无法提取 publish_page 字段');
3098
+ const rawPublishPageStr = match[1];
3099
+ const parsedData = JSON.parse(rawPublishPageStr);
3100
+ const finalData = {
3101
+ ...parsedData,
3102
+ publish_list: parsedData.publish_list.map((item)=>{
3103
+ const decoded = decodeHtml(item.publish_info);
3104
+ const parsedInfo = JSON.parse(decoded);
3105
+ return {
3106
+ publish_type: item.publish_type,
3107
+ publish_info: parsedInfo
3213
3108
  };
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
- }, "小红书文章获取成功");
3109
+ })
3110
+ };
3111
+ return finalData;
3112
+ };
3113
+ const rawArticlesInfo = await http.api({
3114
+ method: "get",
3115
+ url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish',
3116
+ params: {
3117
+ sub: "list",
3118
+ begin: (pageNum - 1) * pageSize,
3119
+ count: pageSize,
3120
+ token: token,
3121
+ lang: "zh_CN"
3122
+ }
3123
+ });
3124
+ const articlesInfo = ParsePublishPage(rawArticlesInfo);
3125
+ const articleCell = articlesInfo?.publish_list.map((item)=>({
3126
+ title: item.publish_info.appmsg_info[0].title,
3127
+ imageUrl: item.publish_info.appmsg_info[0].cover,
3128
+ createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3129
+ redirectUrl: item.publish_info.appmsg_info[0].content_url,
3130
+ readNum: item.publish_info.appmsg_info[0].read_num,
3131
+ likeNum: item.publish_info.appmsg_info[0].old_like_num,
3132
+ shareNum: item.publish_info.appmsg_info[0].share_num,
3133
+ recommendNum: item.publish_info.appmsg_info[0].like_num,
3134
+ ...showOriginalData ? {
3135
+ originalData: item
3136
+ } : {}
3137
+ }));
3138
+ return (0, share_.success)({
3139
+ articleCell,
3140
+ ...onlySuccess ? {
3141
+ pagination: {
3142
+ total: articlesInfo?.total_count,
3143
+ pageNum,
3144
+ pageSize
3257
3145
  }
3258
- default:
3259
- return {
3260
- code: 200,
3261
- message: "暂不支持该平台",
3262
- data: null
3263
- };
3146
+ } : null
3147
+ }, "微信文章获取成功");
3148
+ } catch (error) {
3149
+ return errorResponse(error instanceof Error ? error.message : "微信数据获取失败");
3150
+ }
3151
+ }
3152
+ async function handleBaijiahaoData(params) {
3153
+ try {
3154
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3155
+ if (!token) return {
3156
+ code: 200,
3157
+ message: "缺少token",
3158
+ data: null
3159
+ };
3160
+ const http = new utils_http.e({
3161
+ headers: {
3162
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
3163
+ token: token
3164
+ }
3165
+ });
3166
+ async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
3167
+ return await http.api({
3168
+ method: "get",
3169
+ url: "https://baijiahao.baidu.com/pcui/article/lists",
3170
+ params: {
3171
+ currentPage: pageNum,
3172
+ pageSize: pageSize,
3173
+ search: "",
3174
+ type: "",
3175
+ collection: onlySuccess ? "publish" : "",
3176
+ clearBeforeFetch: false,
3177
+ dynamic: 1
3178
+ }
3179
+ });
3264
3180
  }
3181
+ const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
3182
+ let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
3183
+ const totalPage = articleInfo.data.page?.totalPage || 1;
3184
+ let currentPage = pageNum + 1;
3185
+ const usedPages = new Set();
3186
+ while(filtered.length < pageSize && currentPage <= totalPage){
3187
+ if (usedPages.has(currentPage)) {
3188
+ currentPage++;
3189
+ continue;
3190
+ }
3191
+ const res = await fetchArticles(currentPage, pageSize, onlySuccess);
3192
+ usedPages.add(currentPage);
3193
+ const validItems = res.data.list.filter((item)=>"draft" !== item.status);
3194
+ filtered.push(...validItems);
3195
+ currentPage++;
3196
+ }
3197
+ const final = filtered.slice(0, pageSize);
3198
+ const articleCell = final.map((item)=>({
3199
+ title: item.title,
3200
+ imageUrl: JSON.parse(item.cover_images)[0].src,
3201
+ createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
3202
+ redirectUrl: item.url,
3203
+ recommendNum: item.rec_amount,
3204
+ collectNum: item.collection_amount,
3205
+ readNum: item.read_amount,
3206
+ likeNum: item.like_amount,
3207
+ commentNum: item.comment_amount,
3208
+ shareNum: item.share_amount,
3209
+ ...showOriginalData ? {
3210
+ originalData: item
3211
+ } : {}
3212
+ }));
3213
+ return (0, share_.success)({
3214
+ articleCell,
3215
+ ...onlySuccess ? {
3216
+ pagination: {
3217
+ total: articleInfo.data.page?.totalCount,
3218
+ pageNum,
3219
+ pageSize
3220
+ }
3221
+ } : null
3222
+ }, "百家号文章获取成功");
3265
3223
  } catch (error) {
3266
- console.error("获取文章数据失败:", error);
3267
- return {
3268
- code: 500,
3269
- message: "获取文章数据失败",
3224
+ return errorResponse(error instanceof Error ? error.message : "百家号数据获取失败");
3225
+ }
3226
+ }
3227
+ async function handleXiaohongshuData(params) {
3228
+ try {
3229
+ const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3230
+ const xsEncrypt = new XsEncrypt();
3231
+ const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
3232
+ if (!a1Cookie) return {
3233
+ code: 200,
3234
+ message: "账号数据异常",
3270
3235
  data: null
3271
3236
  };
3237
+ if (onlySuccess && 10 != pageSize) return {
3238
+ code: 200,
3239
+ message: "小红书pageSize不可修改",
3240
+ data: null
3241
+ };
3242
+ const http = new utils_http.e({
3243
+ headers: {
3244
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
3245
+ referer: "https://creator.xiaohongshu.com",
3246
+ origin: "https://creator.xiaohongshu.com"
3247
+ }
3248
+ });
3249
+ async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
3250
+ const xt = Date.now().toString();
3251
+ const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
3252
+ const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
3253
+ return await http.api({
3254
+ method: "get",
3255
+ baseURL: "https://edith.xiaohongshu.com",
3256
+ url: serveUrl,
3257
+ headers: {
3258
+ "x-s": xs,
3259
+ "x-t": xt
3260
+ }
3261
+ });
3262
+ }
3263
+ const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
3264
+ let hasNextpage = -1 != articleInfo.data.page;
3265
+ let filtered = articleInfo.data.notes;
3266
+ let currentPage = pageNum + 1;
3267
+ const usedPages = new Set();
3268
+ while(filtered.length < pageSize && hasNextpage){
3269
+ if (usedPages.has(currentPage)) {
3270
+ currentPage++;
3271
+ continue;
3272
+ }
3273
+ const res = await fetchArticles(currentPage, a1Cookie, onlySuccess);
3274
+ usedPages.add(currentPage);
3275
+ const validItems = res.data.notes;
3276
+ filtered.push(...validItems);
3277
+ currentPage++;
3278
+ hasNextpage = -1 != res.data.page;
3279
+ }
3280
+ const final = filtered.slice(0, pageSize);
3281
+ const articleCell = final.map((item)=>({
3282
+ title: item.display_title,
3283
+ imageUrl: item.images_list[0].url,
3284
+ createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
3285
+ redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
3286
+ readNum: item.view_count,
3287
+ likeNum: item.likes,
3288
+ commentNum: item.comments_count,
3289
+ collectNum: item.collected_count,
3290
+ shareNum: item.shared_count,
3291
+ ...showOriginalData ? {
3292
+ originalData: item
3293
+ } : {}
3294
+ }));
3295
+ return (0, share_.success)({
3296
+ articleCell,
3297
+ ...onlySuccess ? {
3298
+ pagination: {
3299
+ total: articleInfo.data.tags[0]?.notes_count || -1,
3300
+ pageNum,
3301
+ pageSize
3302
+ }
3303
+ } : null
3304
+ }, "小红书文章获取成功");
3305
+ } catch (error) {
3306
+ return errorResponse(error instanceof Error ? error.message : "小红书数据获取失败");
3307
+ }
3308
+ }
3309
+ const FetchArticles = async (_task, params)=>{
3310
+ const { platform } = params;
3311
+ switch(platform){
3312
+ case "toutiao":
3313
+ return handleToutiaoData(params);
3314
+ case "weixin":
3315
+ return handleWeixinData(params);
3316
+ case "baijiahao":
3317
+ return handleBaijiahaoData(params);
3318
+ case "xiaohongshu":
3319
+ return handleXiaohongshuData(params);
3320
+ default:
3321
+ return (0, share_.success)(null, "暂不支持该平台");
3272
3322
  }
3273
3323
  };
3274
3324
  const getWeixinConfig = async (_task, params)=>{
@@ -4824,7 +4874,7 @@ var __webpack_exports__ = {};
4824
4874
  903: "账户已登出,需重新登陆重试!",
4825
4875
  902: "登录已过期,请重新登录!"
4826
4876
  };
4827
- const mock_xsEncrypt = new xhsXsEncrypt.H();
4877
+ const mock_xsEncrypt = new XsEncrypt();
4828
4878
  const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
4829
4879
  const tmpCachePath = task.getTmpPath();
4830
4880
  const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
@@ -5013,7 +5063,7 @@ var __webpack_exports__ = {};
5013
5063
  });
5014
5064
  return (0, share_.success)(publishResult.data?.id);
5015
5065
  };
5016
- const rpa_xsEncrypt = new xhsXsEncrypt.H();
5066
+ const rpa_xsEncrypt = new XsEncrypt();
5017
5067
  const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
5018
5068
  const commonCookies = {
5019
5069
  path: "/",
@@ -5228,9 +5278,7 @@ var __webpack_exports__ = {};
5228
5278
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
5229
5279
  return (0, utils.jo)(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
5230
5280
  };
5231
- var package_namespaceObject = {
5232
- i8: "1.2.13"
5233
- };
5281
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.14-beta.1"}');
5234
5282
  class Action {
5235
5283
  constructor(task){
5236
5284
  this.task = task;
@@ -5255,7 +5303,7 @@ var __webpack_exports__ = {};
5255
5303
  return this.bindTask(FetchArticles, params);
5256
5304
  }
5257
5305
  SearchAccountInfo(params) {
5258
- return this.bindTask(searchAccountInfo.A, params);
5306
+ return this.bindTask(SearchAccountInfo, params);
5259
5307
  }
5260
5308
  TTSessionCheck(params) {
5261
5309
  return this.bindTask(TTSessionCheck, params);