@iflyrpa/actions 1.2.14-beta.1 → 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/bundle.js CHANGED
@@ -1818,117 +1818,25 @@ var __webpack_modules__ = {
1818
1818
  })
1819
1819
  };
1820
1820
  },
1821
- "./src/actions/searchAccountInfo/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1821
+ "./src/actions/searchAccountInfo/getWxInfo.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1822
1822
  "use strict";
1823
1823
  __webpack_require__.d(__webpack_exports__, {
1824
- A: ()=>SearchAccountInfo
1824
+ n: ()=>getWeixinData
1825
1825
  });
1826
1826
  var _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../share/dist/index.mjs");
1827
- var _utils_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/utils/index.ts");
1827
+ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/actions/searchAccountInfo/types.ts");
1828
1828
  var _utils_http__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/http.ts");
1829
- var _utils_xhsXsEncrypt__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/utils/xhsXsEncrypt.ts");
1830
- const errorResponse = (message, code = 500)=>({
1831
- code,
1832
- message,
1833
- data: null
1834
- });
1835
- async function getToutiaoData(params) {
1836
- try {
1837
- const http = new _utils_http__WEBPACK_IMPORTED_MODULE_3__.e({
1838
- headers: {
1839
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
1840
- referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
1841
- }
1842
- });
1843
- const [totalData, fansDataYesterday, contentDataYesterday] = await Promise.all([
1844
- http.api({
1845
- method: "get",
1846
- url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
1847
- params: {
1848
- app_id: 1231
1849
- }
1850
- }),
1851
- http.api({
1852
- method: "get",
1853
- url: "https://mp.toutiao.com/mp/agw/statistic/v2/fans/latest_stat",
1854
- params: {
1855
- app_id: 1231
1856
- }
1857
- }),
1858
- http.api({
1859
- method: "get",
1860
- url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
1861
- params: {
1862
- type: 0,
1863
- app_id: 1231
1864
- }
1865
- })
1866
- ]);
1867
- const ttData = {
1868
- fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
1869
- fansNumYesterday: fansDataYesterday.fans_stat.change_count,
1870
- readNum: Number(totalData.data.statistic.data.total_read_play_count),
1871
- incomeNum: totalData.data.statistic.data.total_income,
1872
- incomeNumYesterday: totalData.data.statistic.data.yesterday_income,
1873
- showNumYesterday: contentDataYesterday.author_stat.consume_data.impression_count,
1874
- readNumYesterday: contentDataYesterday.author_stat.consume_data.go_detail_count,
1875
- likeNumYesterday: contentDataYesterday.author_stat.interaction_data.digg_count,
1876
- commentNumYesterday: contentDataYesterday.author_stat.interaction_data.comment_count
1877
- };
1878
- return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.Vp)(ttData, "头条号粉丝数据获取成功!");
1879
- } catch (error) {
1880
- return errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
1881
- }
1882
- }
1883
- async function getXiaohongshuData(params) {
1884
- try {
1885
- const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
1886
- if (!a1Cookie) return errorResponse("账号数据异常,请重新绑定账号后重试。", 200);
1887
- const http = new _utils_http__WEBPACK_IMPORTED_MODULE_3__.e({
1888
- headers: {
1889
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
1890
- referer: "https://creator.xiaohongshu.com",
1891
- origin: "https://creator.xiaohongshu.com"
1892
- }
1893
- });
1894
- const xsEncrypt = new _utils_xhsXsEncrypt__WEBPACK_IMPORTED_MODULE_2__.H();
1895
- const xt = Date.now().toString();
1896
- const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
1897
- const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
1898
- const [overAllData, sevenData] = await Promise.all([
1899
- http.api({
1900
- method: "get",
1901
- url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
1902
- }),
1903
- http.api({
1904
- method: "get",
1905
- baseURL: "https://creator.xiaohongshu.com",
1906
- url: sevenDataUrl,
1907
- headers: {
1908
- "x-s": xs,
1909
- "x-t": xt
1910
- }
1911
- })
1912
- ]);
1913
- const xhsData = {
1914
- fansNum: overAllData.data.fans_count,
1915
- favedNum: overAllData.data.faved_count,
1916
- watchNumLastWeek: sevenData.data.seven.view_count,
1917
- likeNumLastWeek: sevenData.data.seven.like_count,
1918
- collectNumLastWeek: sevenData.data.seven.collect_count,
1919
- commentNumLastWeek: sevenData.data.seven.comment_count,
1920
- fansNumLastWeek: sevenData.data.seven.rise_fans_count,
1921
- fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
1922
- };
1923
- return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.Vp)(xhsData, "小红书粉丝数据获取成功!");
1924
- } catch (error) {
1925
- return errorResponse(error instanceof Error ? error.message : "小红书数据获取失败");
1926
- }
1927
- }
1829
+ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/utils/index.ts");
1928
1830
  async function getWeixinData(params) {
1831
+ const { token } = params;
1832
+ if (!token) return {
1833
+ code: 200,
1834
+ message: "缺少token",
1835
+ data: null
1836
+ };
1929
1837
  try {
1930
1838
  const { token } = params;
1931
- if (!token) return errorResponse("缺少token", 200);
1839
+ if (!token) return (0, _types__WEBPACK_IMPORTED_MODULE_2__.V)("缺少token", 200);
1932
1840
  const http = new _utils_http__WEBPACK_IMPORTED_MODULE_3__.e({
1933
1841
  headers: {
1934
1842
  cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
@@ -1936,7 +1844,7 @@ var __webpack_modules__ = {
1936
1844
  });
1937
1845
  const massRandomIDHtml = await http.api({
1938
1846
  method: "get",
1939
- url: "https://mp.weixin.qq.com/misc/appmsganalysis?action=report&token=1900237878&lang=zh_CN",
1847
+ url: "https://mp.weixin.qq.com/misc/appmsganalysis",
1940
1848
  params: {
1941
1849
  token,
1942
1850
  lang: "zh_CN",
@@ -1966,11 +1874,11 @@ var __webpack_modules__ = {
1966
1874
  const readAllList = arrays.readAllList || [];
1967
1875
  const shareAllList = arrays.shareAllList || [];
1968
1876
  const fansInfoReg = fansInfoHtml.match(/window\.CGI_DATA\['pages\/statistics\/user_statistics'\]\s*=\s*(\{[\s\S]*?\});/);
1969
- if (!fansInfoReg) return errorResponse("未找到粉丝信息", 200);
1877
+ if (!fansInfoReg) return (0, _types__WEBPACK_IMPORTED_MODULE_2__.V)("未找到粉丝信息", 200);
1970
1878
  const fansInfo = eval("(" + fansInfoReg[1] + ")");
1971
- const yesterday = _utils_index__WEBPACK_IMPORTED_MODULE_1__.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyy-MM-dd");
1879
+ const yesterday = _utils__WEBPACK_IMPORTED_MODULE_1__.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyy-MM-dd");
1972
1880
  const yesterdayFansInfo = fansInfo.list[0]?.list.find((item)=>item.date === yesterday);
1973
- if (!yesterdayFansInfo) return errorResponse("未找到粉丝数", 200);
1881
+ if (!yesterdayFansInfo) return (0, _types__WEBPACK_IMPORTED_MODULE_2__.V)("未找到粉丝数", 200);
1974
1882
  const wxData = {
1975
1883
  fansNum: yesterdayFansInfo.cumulate_user,
1976
1884
  fansNumYesterday: yesterdayFansInfo.new_user - yesterdayFansInfo.cancel_user,
@@ -1979,70 +1887,20 @@ var __webpack_modules__ = {
1979
1887
  };
1980
1888
  return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.Vp)(wxData, "微信粉丝数据获取成功!");
1981
1889
  } catch (error) {
1982
- return errorResponse(error instanceof Error ? error.message : "微信数据获取失败");
1890
+ return (0, _types__WEBPACK_IMPORTED_MODULE_2__.V)(error instanceof Error ? error.message : "微信数据获取失败");
1983
1891
  }
1984
1892
  }
1985
- async function getBaijiahaoData(params) {
1986
- try {
1987
- const { token } = params;
1988
- if (!token) return errorResponse("缺少token", 200);
1989
- const http = new _utils_http__WEBPACK_IMPORTED_MODULE_3__.e({
1990
- headers: {
1991
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
1992
- token: String(token),
1993
- Referer: "https://baijiahao.baidu.com/builder/rc/home"
1994
- }
1995
- });
1996
- const yesterday = _utils_index__WEBPACK_IMPORTED_MODULE_1__.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
1997
- const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
1998
- http.api({
1999
- method: "get",
2000
- url: "https://baijiahao.baidu.com/pcui/home/index"
2001
- }),
2002
- http.api({
2003
- method: "get",
2004
- url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
2005
- }),
2006
- http.api({
2007
- method: "get",
2008
- url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
2009
- }),
2010
- http.api({
2011
- method: "get",
2012
- url: `https://baijiahao.baidu.com/author/eco/statistics/appStatistic?type=all&is_yesterday=false&start_day=${yesterday}&end_day=${yesterday}&stat=0`
2013
- })
2014
- ]);
2015
- const bjhData = {
2016
- fansNum: fansData.data.coreData.fansCount,
2017
- fansNumYesterday: yesterdayData.data.data.fans_increase,
2018
- readNum: readData.data.total.view_count,
2019
- incomeNum: incomeData.data.all_income.total_income,
2020
- incomeNumYesterday: incomeData.data.all_income.yesterday_income,
2021
- recommendNumYesterday: yesterdayData.data.data.recommend_count,
2022
- readNumYesterday: yesterdayData.data.data.view_count,
2023
- likeNumYesterday: yesterdayData.data.data.likes_count,
2024
- commentNumYesterday: yesterdayData.data.data.comment_count
2025
- };
2026
- return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.Vp)(bjhData, "百家号粉丝数据获取成功!");
2027
- } catch (error) {
2028
- return errorResponse(error instanceof Error ? error.message : "百家号数据获取失败");
2029
- }
2030
- }
2031
- const SearchAccountInfo = async (_task, params)=>{
2032
- const { platform } = params;
2033
- switch(platform){
2034
- case "toutiao":
2035
- return getToutiaoData(params);
2036
- case "xiaohongshu":
2037
- return getXiaohongshuData(params);
2038
- case "weixin":
2039
- return getWeixinData(params);
2040
- case "baijiahao":
2041
- return getBaijiahaoData(params);
2042
- default:
2043
- return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.Vp)(null, "暂不支持该平台");
2044
- }
2045
- };
1893
+ },
1894
+ "./src/actions/searchAccountInfo/types.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1895
+ "use strict";
1896
+ __webpack_require__.d(__webpack_exports__, {
1897
+ V: ()=>errorResponse
1898
+ });
1899
+ const errorResponse = (message, code = 500)=>({
1900
+ code,
1901
+ message,
1902
+ data: null
1903
+ });
2046
1904
  },
2047
1905
  "./src/utils/http.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2048
1906
  "use strict";
@@ -11677,65 +11535,6 @@ var __webpack_modules__ = {
11677
11535
  }
11678
11536
  module[a0_0x45db08(0xae)] = GenAB;
11679
11537
  },
11680
- "./src/utils/xhsXsEncrypt.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
11681
- "use strict";
11682
- __webpack_require__.d(__webpack_exports__, {
11683
- H: ()=>XsEncrypt
11684
- });
11685
- const external_node_buffer_namespaceObject = require("node:buffer");
11686
- const external_node_crypto_namespaceObject = require("node:crypto");
11687
- var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
11688
- class XsEncrypt {
11689
- async encryptMD5(url) {
11690
- return external_node_crypto_default().createHash("md5").update(url, "utf8").digest("hex");
11691
- }
11692
- async encryptText(text) {
11693
- const textEncoded = external_node_buffer_namespaceObject.Buffer.from(text).toString("base64");
11694
- const cipher = external_node_crypto_default().createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
11695
- const ciphertext = cipher.update(textEncoded, "utf8", "base64");
11696
- return ciphertext + cipher.final("base64");
11697
- }
11698
- async base64ToHex(encodedData) {
11699
- const decodedData = external_node_buffer_namespaceObject.Buffer.from(encodedData, "base64");
11700
- return decodedData.toString("hex");
11701
- }
11702
- async encryptPayload(payload, platform) {
11703
- const hexPayload = await this.base64ToHex(payload);
11704
- const obj = {
11705
- signSvn: "56",
11706
- signType: "x2",
11707
- appID: platform,
11708
- signVersion: "1",
11709
- payload: hexPayload
11710
- };
11711
- const jsonString = JSON.stringify(obj, null, 0);
11712
- return external_node_buffer_namespaceObject.Buffer.from(jsonString).toString("base64");
11713
- }
11714
- async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
11715
- 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};`;
11716
- return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
11717
- }
11718
- dumps(...rest) {
11719
- const [data, replacer = null, space = 0] = rest;
11720
- return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
11721
- }
11722
- constructor(){
11723
- this.words = [
11724
- 929260340,
11725
- 1633971297,
11726
- 895580464,
11727
- 925905270
11728
- ];
11729
- this.keyBytes = external_node_buffer_namespaceObject.Buffer.concat(this.words.map((word)=>new Uint8Array(external_node_buffer_namespaceObject.Buffer.from([
11730
- word >> 24 & 0xff,
11731
- word >> 16 & 0xff,
11732
- word >> 8 & 0xff,
11733
- 0xff & word
11734
- ]))));
11735
- this.iv = external_node_buffer_namespaceObject.Buffer.from("4uzjr7mbsibcaldp", "utf8");
11736
- }
11737
- }
11738
- },
11739
11538
  assert: function(module) {
11740
11539
  "use strict";
11741
11540
  module.exports = require("assert");
@@ -15882,280 +15681,531 @@ var __webpack_exports__ = {};
15882
15681
  }, "百家号账号有效性检测失败!");
15883
15682
  }
15884
15683
  };
15885
- var searchAccountInfo = __webpack_require__("./src/actions/searchAccountInfo/index.ts");
15886
- var xhsXsEncrypt = __webpack_require__("./src/utils/xhsXsEncrypt.ts");
15887
- const FetchArticles = async (_task, params)=>{
15888
- const { platform, cookies, token, pageNum = 1, pageSize = 10, onlySuccess = false, showOriginalData = false } = params;
15684
+ var types = __webpack_require__("./src/actions/searchAccountInfo/types.ts");
15685
+ async function getBaijiahaoData(params) {
15889
15686
  try {
15890
- switch(platform){
15891
- case "toutiao":
15892
- {
15893
- const http = new utils_http.e({
15894
- headers: {
15895
- cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
15896
- }
15897
- });
15898
- const visitedUid = await http.api({
15899
- url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?",
15900
- method: "get",
15901
- params: {
15902
- app_id: 1231
15903
- }
15904
- });
15905
- const articleInfo = await http.api({
15906
- method: "get",
15907
- url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
15908
- params: {
15909
- provider_type: "mp_provider",
15910
- aid: "13",
15911
- app_name: "news_article",
15912
- category: "mp_all",
15913
- channel: "",
15914
- stream_api_version: "88",
15915
- genre_type_switch: '{"repost":1,"small_video":1,"toutiao_graphic":1,"weitoutiao":1,"xigua_video":1}',
15916
- device_platform: "pc",
15917
- platform_id: "0",
15918
- visited_uid: visitedUid.user_id_str,
15919
- offset: (pageNum - 1) * pageSize,
15920
- count: pageSize,
15921
- keyword: "",
15922
- 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"}`,
15923
- app_id: "1231"
15924
- }
15925
- });
15926
- const articleCell = articleInfo.data.map((item)=>({
15927
- title: item.assembleCell.itemCell.articleBase.title,
15928
- imageUrl: item.assembleCell.itemCell.imageList.staggerFeedCover[0].url,
15929
- createTime: item.assembleCell.itemCell.articleBase.publishTime,
15930
- redirectUrl: item.assembleCell.itemCell.articleBase.articleURL,
15931
- showNum: item.assembleCell.itemCell.itemCounter.showCount,
15932
- readNum: item.assembleCell.itemCell.itemCounter.readCount,
15933
- likeNum: item.assembleCell.itemCell.itemCounter.diggCount,
15934
- commentNum: item.assembleCell.itemCell.itemCounter.commentCount,
15935
- ...showOriginalData ? {
15936
- originalData: item
15937
- } : {}
15938
- }));
15939
- const api_base_info_json = JSON.parse(articleInfo.api_base_info.app_extra_params);
15940
- return (0, dist.Vp)({
15941
- articleCell,
15942
- pagination: {
15943
- total: api_base_info_json.total_count,
15944
- pageNum,
15945
- pageSize
15946
- }
15947
- }, "头条号文章获取成功");
15687
+ const { token } = params;
15688
+ if (!token) return (0, types.V)("缺少token", 200);
15689
+ const http = new utils_http.e({
15690
+ headers: {
15691
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
15692
+ token: String(token),
15693
+ Referer: "https://baijiahao.baidu.com/builder/rc/home"
15694
+ }
15695
+ });
15696
+ const yesterday = utils.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
15697
+ const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
15698
+ http.api({
15699
+ method: "get",
15700
+ url: "https://baijiahao.baidu.com/pcui/home/index"
15701
+ }),
15702
+ http.api({
15703
+ method: "get",
15704
+ url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
15705
+ }),
15706
+ http.api({
15707
+ method: "get",
15708
+ url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
15709
+ }),
15710
+ http.api({
15711
+ method: "get",
15712
+ url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
15713
+ params: {
15714
+ type: "all",
15715
+ is_yesterday: false,
15716
+ start_day: yesterday,
15717
+ end_day: yesterday,
15718
+ stat: 0
15948
15719
  }
15949
- case "weixin":
15950
- {
15951
- if (!token) return {
15952
- code: 200,
15953
- message: "缺少token",
15954
- data: null
15955
- };
15956
- const http = new utils_http.e({
15957
- headers: {
15958
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
15959
- }
15960
- });
15961
- const ParsePublishPage = (body)=>{
15962
- const decodeHtml = (str)=>str.replace(/&quot;/g, '"').replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&#39;/g, "'").replace(/&nbsp;/g, ' ');
15963
- const match = body.match(/publish_page\s*=\s*(\{[\s\S]*?\})\s*;/);
15964
- if (!match) throw new Error('无法提取 publish_page 字段');
15965
- const rawPublishPageStr = match[1];
15966
- const parsedData = JSON.parse(rawPublishPageStr);
15967
- const finalData = {
15968
- ...parsedData,
15969
- publish_list: parsedData.publish_list.map((item)=>{
15970
- const decoded = decodeHtml(item.publish_info);
15971
- const parsedInfo = JSON.parse(decoded);
15972
- return {
15973
- publish_type: item.publish_type,
15974
- publish_info: parsedInfo
15975
- };
15976
- })
15977
- };
15978
- return finalData;
15979
- };
15980
- const rawArticlesInfo = await http.api({
15981
- method: "get",
15982
- url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish?sub=list&begin=0&count=10&token=1453947575&lang=zh_CN',
15983
- params: {
15984
- sub: "list",
15985
- begin: (pageNum - 1) * pageSize,
15986
- count: pageSize,
15987
- token: token,
15988
- lang: "zh_CN"
15989
- }
15990
- });
15991
- const articlesInfo = ParsePublishPage(rawArticlesInfo);
15992
- const articleCell = articlesInfo?.publish_list.map((item)=>({
15993
- title: item.publish_info.appmsg_info[0].title,
15994
- imageUrl: item.publish_info.appmsg_info[0].cover,
15995
- createTime: item.publish_info.appmsg_info[0].line_info.send_time,
15996
- redirectUrl: item.publish_info.appmsg_info[0].content_url,
15997
- readNum: item.publish_info.appmsg_info[0].read_num,
15998
- likeNum: item.publish_info.appmsg_info[0].old_like_num,
15999
- shareNum: item.publish_info.appmsg_info[0].share_num,
16000
- recommendNum: item.publish_info.appmsg_info[0].like_num,
16001
- ...showOriginalData ? {
16002
- originalData: item
16003
- } : {}
16004
- }));
16005
- return (0, dist.Vp)({
16006
- articleCell,
16007
- ...onlySuccess ? {
16008
- pagination: {
16009
- total: articlesInfo?.total_count,
16010
- pageNum,
16011
- pageSize
16012
- }
16013
- } : null
16014
- }, "微信文章获取成功");
15720
+ })
15721
+ ]);
15722
+ const bjhData = {
15723
+ fansNum: fansData.data.coreData.fansCount,
15724
+ fansNumYesterday: yesterdayData.data.data.fans_increase,
15725
+ readNum: readData.data.total.view_count,
15726
+ incomeNum: incomeData.data.all_income.total_income,
15727
+ incomeNumYesterday: incomeData.data.all_income.yesterday_income,
15728
+ recommendNumYesterday: yesterdayData.data.data.recommend_count,
15729
+ readNumYesterday: yesterdayData.data.data.view_count,
15730
+ likeNumYesterday: yesterdayData.data.data.likes_count,
15731
+ commentNumYesterday: yesterdayData.data.data.comment_count
15732
+ };
15733
+ return (0, dist.Vp)(bjhData, "百家号粉丝数据获取成功!");
15734
+ } catch (error) {
15735
+ return (0, types.V)(error instanceof Error ? error.message : "百家号数据获取失败");
15736
+ }
15737
+ }
15738
+ async function getToutiaoData(params) {
15739
+ const { cookies } = params;
15740
+ try {
15741
+ const http = new utils_http.e({
15742
+ headers: {
15743
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
15744
+ referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
15745
+ }
15746
+ });
15747
+ const [totalData, fansDataYesterday, contentDataYesterday] = await Promise.all([
15748
+ http.api({
15749
+ method: "get",
15750
+ url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
15751
+ params: {
15752
+ app_id: 1231
16015
15753
  }
16016
- case "baijiahao":
16017
- {
16018
- if (!token) return {
16019
- code: 200,
16020
- message: "缺少token",
16021
- data: null
16022
- };
16023
- const http = new utils_http.e({
16024
- headers: {
16025
- cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
16026
- token: token
16027
- }
16028
- });
16029
- async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
16030
- return await http.api({
16031
- method: "get",
16032
- url: "https://baijiahao.baidu.com/pcui/article/lists",
16033
- params: {
16034
- currentPage: pageNum,
16035
- pageSize: pageSize,
16036
- search: "",
16037
- type: "",
16038
- collection: onlySuccess ? "publish" : "",
16039
- clearBeforeFetch: false,
16040
- dynamic: 1
16041
- }
16042
- });
16043
- }
16044
- const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
16045
- let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
16046
- const totalPage = articleInfo.data.page?.totalPage || 1;
16047
- let currentPage = pageNum + 1;
16048
- const usedPages = new Set();
16049
- while(filtered.length < pageSize && currentPage <= totalPage){
16050
- if (usedPages.has(currentPage)) {
16051
- currentPage++;
16052
- continue;
16053
- }
16054
- const res = await fetchArticles(currentPage, pageSize, onlySuccess);
16055
- usedPages.add(currentPage);
16056
- const validItems = res.data.list.filter((item)=>"draft" !== item.status);
16057
- filtered.push(...validItems);
16058
- currentPage++;
16059
- }
16060
- const final = filtered.slice(0, pageSize);
16061
- const articleCell = final.map((item)=>({
16062
- title: item.title,
16063
- imageUrl: JSON.parse(item.cover_images)[0].src,
16064
- createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
16065
- redirectUrl: item.url,
16066
- recommendNum: item.rec_amount,
16067
- collectNum: item.collection_amount,
16068
- readNum: item.read_amount,
16069
- likeNum: item.like_amount,
16070
- commentNum: item.comment_amount,
16071
- shareNum: item.share_amount,
16072
- ...showOriginalData ? {
16073
- originalData: item
16074
- } : {}
16075
- }));
16076
- return (0, dist.Vp)({
16077
- articleCell,
16078
- ...onlySuccess ? {
16079
- pagination: {
16080
- total: articleInfo.data.page?.totalCount,
16081
- pageNum,
16082
- pageSize
16083
- }
16084
- } : null
16085
- }, "百家号文章获取成功");
15754
+ }),
15755
+ http.api({
15756
+ method: "get",
15757
+ url: "https://mp.toutiao.com/mp/agw/statistic/v2/fans/latest_stat",
15758
+ params: {
15759
+ app_id: 1231
16086
15760
  }
16087
- case "xiaohongshu":
16088
- {
16089
- const xsEncrypt = new xhsXsEncrypt.H();
16090
- const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
16091
- if (!a1Cookie) return {
16092
- code: 200,
16093
- message: "账号数据异常",
16094
- data: null
16095
- };
16096
- if (10 != pageSize) return {
16097
- code: 200,
16098
- message: "小红书pageSize不可修改",
16099
- data: null
15761
+ }),
15762
+ http.api({
15763
+ method: "get",
15764
+ url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
15765
+ params: {
15766
+ type: 0,
15767
+ app_id: 1231
15768
+ }
15769
+ })
15770
+ ]);
15771
+ const ttData = {
15772
+ fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
15773
+ fansNumYesterday: fansDataYesterday.fans_stat.change_count,
15774
+ readNum: Number(totalData.data.statistic.data.total_read_play_count),
15775
+ incomeNum: totalData.data.statistic.data.total_income,
15776
+ incomeNumYesterday: totalData.data.statistic.data.yesterday_income,
15777
+ showNumYesterday: contentDataYesterday.author_stat.consume_data.impression_count,
15778
+ readNumYesterday: contentDataYesterday.author_stat.consume_data.go_detail_count,
15779
+ likeNumYesterday: contentDataYesterday.author_stat.interaction_data.digg_count,
15780
+ commentNumYesterday: contentDataYesterday.author_stat.interaction_data.comment_count
15781
+ };
15782
+ return (0, dist.Vp)(ttData, "头条号粉丝数据获取成功!");
15783
+ } catch (error) {
15784
+ return (0, types.V)(error instanceof Error ? error.message : "头条号数据获取失败");
15785
+ }
15786
+ }
15787
+ var getWxInfo = __webpack_require__("./src/actions/searchAccountInfo/getWxInfo.ts");
15788
+ const external_node_buffer_namespaceObject = require("node:buffer");
15789
+ const external_node_crypto_namespaceObject = require("node:crypto");
15790
+ var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
15791
+ class XsEncrypt {
15792
+ async encryptMD5(url) {
15793
+ return external_node_crypto_default().createHash("md5").update(url, "utf8").digest("hex");
15794
+ }
15795
+ async encryptText(text) {
15796
+ const textEncoded = external_node_buffer_namespaceObject.Buffer.from(text).toString("base64");
15797
+ const cipher = external_node_crypto_default().createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
15798
+ const ciphertext = cipher.update(textEncoded, "utf8", "base64");
15799
+ return ciphertext + cipher.final("base64");
15800
+ }
15801
+ async base64ToHex(encodedData) {
15802
+ const decodedData = external_node_buffer_namespaceObject.Buffer.from(encodedData, "base64");
15803
+ return decodedData.toString("hex");
15804
+ }
15805
+ async encryptPayload(payload, platform) {
15806
+ const hexPayload = await this.base64ToHex(payload);
15807
+ const obj = {
15808
+ signSvn: "56",
15809
+ signType: "x2",
15810
+ appID: platform,
15811
+ signVersion: "1",
15812
+ payload: hexPayload
15813
+ };
15814
+ const jsonString = JSON.stringify(obj, null, 0);
15815
+ return external_node_buffer_namespaceObject.Buffer.from(jsonString).toString("base64");
15816
+ }
15817
+ async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
15818
+ 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};`;
15819
+ return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
15820
+ }
15821
+ dumps(...rest) {
15822
+ const [data, replacer = null, space = 0] = rest;
15823
+ return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
15824
+ }
15825
+ constructor(){
15826
+ this.words = [
15827
+ 929260340,
15828
+ 1633971297,
15829
+ 895580464,
15830
+ 925905270
15831
+ ];
15832
+ this.keyBytes = external_node_buffer_namespaceObject.Buffer.concat(this.words.map((word)=>new Uint8Array(external_node_buffer_namespaceObject.Buffer.from([
15833
+ word >> 24 & 0xff,
15834
+ word >> 16 & 0xff,
15835
+ word >> 8 & 0xff,
15836
+ 0xff & word
15837
+ ]))));
15838
+ this.iv = external_node_buffer_namespaceObject.Buffer.from("4uzjr7mbsibcaldp", "utf8");
15839
+ }
15840
+ }
15841
+ async function getXiaohongshuData(params) {
15842
+ try {
15843
+ const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
15844
+ if (!a1Cookie) return (0, types.V)("账号数据异常,请重新绑定账号后重试。", 200);
15845
+ const http = new utils_http.e({
15846
+ headers: {
15847
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
15848
+ referer: "https://creator.xiaohongshu.com",
15849
+ origin: "https://creator.xiaohongshu.com"
15850
+ }
15851
+ });
15852
+ const xsEncrypt = new XsEncrypt();
15853
+ const xt = Date.now().toString();
15854
+ const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
15855
+ const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
15856
+ const [overAllData, sevenData] = await Promise.all([
15857
+ http.api({
15858
+ method: "get",
15859
+ url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
15860
+ }),
15861
+ http.api({
15862
+ method: "get",
15863
+ baseURL: "https://creator.xiaohongshu.com",
15864
+ url: sevenDataUrl,
15865
+ headers: {
15866
+ "x-s": xs,
15867
+ "x-t": xt
15868
+ }
15869
+ })
15870
+ ]);
15871
+ const xhsData = {
15872
+ fansNum: overAllData.data.fans_count,
15873
+ favedNum: overAllData.data.faved_count,
15874
+ watchNumLastWeek: sevenData.data.seven.view_count,
15875
+ likeNumLastWeek: sevenData.data.seven.like_count,
15876
+ collectNumLastWeek: sevenData.data.seven.collect_count,
15877
+ commentNumLastWeek: sevenData.data.seven.comment_count,
15878
+ fansNumLastWeek: sevenData.data.seven.rise_fans_count,
15879
+ fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
15880
+ };
15881
+ return (0, dist.Vp)(xhsData, "小红书粉丝数据获取成功!");
15882
+ } catch (error) {
15883
+ return (0, types.V)(error instanceof Error ? error.message : "小红书数据获取失败");
15884
+ }
15885
+ }
15886
+ const SearchAccountInfo = async (_task, params)=>{
15887
+ const { platform } = params;
15888
+ switch(platform){
15889
+ case "toutiao":
15890
+ return getToutiaoData(params);
15891
+ case "xiaohongshu":
15892
+ return getXiaohongshuData(params);
15893
+ case "weixin":
15894
+ return (0, getWxInfo.n)(params);
15895
+ case "baijiahao":
15896
+ return getBaijiahaoData(params);
15897
+ default:
15898
+ return (0, dist.Vp)(null, "暂不支持该平台");
15899
+ }
15900
+ };
15901
+ const errorResponse = (message, code = 500)=>({
15902
+ code,
15903
+ message,
15904
+ data: null
15905
+ });
15906
+ async function handleToutiaoData(params) {
15907
+ try {
15908
+ const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
15909
+ const http = new utils_http.e({
15910
+ headers: {
15911
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
15912
+ }
15913
+ });
15914
+ const visitedUid = await http.api({
15915
+ url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?",
15916
+ method: "get",
15917
+ params: {
15918
+ app_id: 1231
15919
+ }
15920
+ });
15921
+ const articleInfo = await http.api({
15922
+ method: "get",
15923
+ url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
15924
+ params: {
15925
+ provider_type: "mp_provider",
15926
+ aid: "13",
15927
+ app_name: "news_article",
15928
+ category: "mp_all",
15929
+ channel: "",
15930
+ stream_api_version: "88",
15931
+ genre_type_switch: '{"repost":1,"small_video":1,"toutiao_graphic":1,"weitoutiao":1,"xigua_video":1}',
15932
+ device_platform: "pc",
15933
+ platform_id: "0",
15934
+ visited_uid: visitedUid.user_id_str,
15935
+ offset: (pageNum - 1) * pageSize,
15936
+ count: pageSize,
15937
+ keyword: "",
15938
+ 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"}`,
15939
+ app_id: "1231"
15940
+ }
15941
+ });
15942
+ const articleCell = articleInfo.data.map((item)=>({
15943
+ title: item.assembleCell.itemCell.articleBase.title,
15944
+ imageUrl: item.assembleCell.itemCell.imageList.staggerFeedCover[0].url,
15945
+ createTime: item.assembleCell.itemCell.articleBase.publishTime,
15946
+ redirectUrl: item.assembleCell.itemCell.articleBase.articleURL,
15947
+ showNum: item.assembleCell.itemCell.itemCounter.showCount,
15948
+ readNum: item.assembleCell.itemCell.itemCounter.readCount,
15949
+ likeNum: item.assembleCell.itemCell.itemCounter.diggCount,
15950
+ commentNum: item.assembleCell.itemCell.itemCounter.commentCount,
15951
+ ...showOriginalData ? {
15952
+ originalData: item
15953
+ } : {}
15954
+ }));
15955
+ const api_base_info_json = JSON.parse(articleInfo.api_base_info.app_extra_params);
15956
+ return (0, dist.Vp)({
15957
+ articleCell,
15958
+ pagination: {
15959
+ total: api_base_info_json.total_count,
15960
+ pageNum,
15961
+ pageSize
15962
+ }
15963
+ }, "头条号文章获取成功");
15964
+ } catch (error) {
15965
+ return errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
15966
+ }
15967
+ }
15968
+ async function handleWeixinData(params) {
15969
+ try {
15970
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
15971
+ if (!token) return {
15972
+ code: 200,
15973
+ message: "缺少token",
15974
+ data: null
15975
+ };
15976
+ const http = new utils_http.e({
15977
+ headers: {
15978
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
15979
+ }
15980
+ });
15981
+ const ParsePublishPage = (body)=>{
15982
+ const decodeHtml = (str)=>str.replace(/&quot;/g, '"').replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&#39;/g, "'").replace(/&nbsp;/g, ' ');
15983
+ const match = body.match(/publish_page\s*=\s*(\{[\s\S]*?\})\s*;/);
15984
+ if (!match) throw new Error('无法提取 publish_page 字段');
15985
+ const rawPublishPageStr = match[1];
15986
+ const parsedData = JSON.parse(rawPublishPageStr);
15987
+ const finalData = {
15988
+ ...parsedData,
15989
+ publish_list: parsedData.publish_list.map((item)=>{
15990
+ const decoded = decodeHtml(item.publish_info);
15991
+ const parsedInfo = JSON.parse(decoded);
15992
+ return {
15993
+ publish_type: item.publish_type,
15994
+ publish_info: parsedInfo
16100
15995
  };
16101
- const http = new utils_http.e({
16102
- headers: {
16103
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
16104
- referer: "https://creator.xiaohongshu.com",
16105
- origin: "https://creator.xiaohongshu.com"
16106
- }
16107
- });
16108
- const xt = Date.now().toString();
16109
- const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
16110
- const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
16111
- const articleInfo = await http.api({
16112
- method: "get",
16113
- baseURL: "https://edith.xiaohongshu.com",
16114
- url: serveUrl,
16115
- headers: {
16116
- "x-s": xs,
16117
- "x-t": xt
16118
- }
16119
- });
16120
- const articleCell = articleInfo.data.notes.map((item)=>({
16121
- title: item.display_title,
16122
- imageUrl: item.images_list[0].url,
16123
- createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
16124
- redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
16125
- readNum: item.view_count,
16126
- likeNum: item.likes,
16127
- commentNum: item.comments_count,
16128
- collectNum: item.collected_count,
16129
- shareNum: item.shared_count,
16130
- ...showOriginalData ? {
16131
- originalData: item
16132
- } : {}
16133
- }));
16134
- return (0, dist.Vp)({
16135
- articleCell,
16136
- ...onlySuccess ? {
16137
- pagination: {
16138
- total: articleInfo.data.tags[0].notes_count,
16139
- pageNum,
16140
- pageSize
16141
- }
16142
- } : null
16143
- }, "小红书文章获取成功");
15996
+ })
15997
+ };
15998
+ return finalData;
15999
+ };
16000
+ const rawArticlesInfo = await http.api({
16001
+ method: "get",
16002
+ url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish',
16003
+ params: {
16004
+ sub: "list",
16005
+ begin: (pageNum - 1) * pageSize,
16006
+ count: pageSize,
16007
+ token: token,
16008
+ lang: "zh_CN"
16009
+ }
16010
+ });
16011
+ const articlesInfo = ParsePublishPage(rawArticlesInfo);
16012
+ const articleCell = articlesInfo?.publish_list.map((item)=>({
16013
+ title: item.publish_info.appmsg_info[0].title,
16014
+ imageUrl: item.publish_info.appmsg_info[0].cover,
16015
+ createTime: item.publish_info.appmsg_info[0].line_info.send_time,
16016
+ redirectUrl: item.publish_info.appmsg_info[0].content_url,
16017
+ readNum: item.publish_info.appmsg_info[0].read_num,
16018
+ likeNum: item.publish_info.appmsg_info[0].old_like_num,
16019
+ shareNum: item.publish_info.appmsg_info[0].share_num,
16020
+ recommendNum: item.publish_info.appmsg_info[0].like_num,
16021
+ ...showOriginalData ? {
16022
+ originalData: item
16023
+ } : {}
16024
+ }));
16025
+ return (0, dist.Vp)({
16026
+ articleCell,
16027
+ ...onlySuccess ? {
16028
+ pagination: {
16029
+ total: articlesInfo?.total_count,
16030
+ pageNum,
16031
+ pageSize
16144
16032
  }
16145
- default:
16146
- return {
16147
- code: 200,
16148
- message: "暂不支持该平台",
16149
- data: null
16150
- };
16033
+ } : null
16034
+ }, "微信文章获取成功");
16035
+ } catch (error) {
16036
+ return errorResponse(error instanceof Error ? error.message : "微信数据获取失败");
16037
+ }
16038
+ }
16039
+ async function handleBaijiahaoData(params) {
16040
+ try {
16041
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
16042
+ if (!token) return {
16043
+ code: 200,
16044
+ message: "缺少token",
16045
+ data: null
16046
+ };
16047
+ const http = new utils_http.e({
16048
+ headers: {
16049
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
16050
+ token: token
16051
+ }
16052
+ });
16053
+ async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
16054
+ return await http.api({
16055
+ method: "get",
16056
+ url: "https://baijiahao.baidu.com/pcui/article/lists",
16057
+ params: {
16058
+ currentPage: pageNum,
16059
+ pageSize: pageSize,
16060
+ search: "",
16061
+ type: "",
16062
+ collection: onlySuccess ? "publish" : "",
16063
+ clearBeforeFetch: false,
16064
+ dynamic: 1
16065
+ }
16066
+ });
16151
16067
  }
16068
+ const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
16069
+ let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
16070
+ const totalPage = articleInfo.data.page?.totalPage || 1;
16071
+ let currentPage = pageNum + 1;
16072
+ const usedPages = new Set();
16073
+ while(filtered.length < pageSize && currentPage <= totalPage){
16074
+ if (usedPages.has(currentPage)) {
16075
+ currentPage++;
16076
+ continue;
16077
+ }
16078
+ const res = await fetchArticles(currentPage, pageSize, onlySuccess);
16079
+ usedPages.add(currentPage);
16080
+ const validItems = res.data.list.filter((item)=>"draft" !== item.status);
16081
+ filtered.push(...validItems);
16082
+ currentPage++;
16083
+ }
16084
+ const final = filtered.slice(0, pageSize);
16085
+ const articleCell = final.map((item)=>({
16086
+ title: item.title,
16087
+ imageUrl: JSON.parse(item.cover_images)[0].src,
16088
+ createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
16089
+ redirectUrl: item.url,
16090
+ recommendNum: item.rec_amount,
16091
+ collectNum: item.collection_amount,
16092
+ readNum: item.read_amount,
16093
+ likeNum: item.like_amount,
16094
+ commentNum: item.comment_amount,
16095
+ shareNum: item.share_amount,
16096
+ ...showOriginalData ? {
16097
+ originalData: item
16098
+ } : {}
16099
+ }));
16100
+ return (0, dist.Vp)({
16101
+ articleCell,
16102
+ ...onlySuccess ? {
16103
+ pagination: {
16104
+ total: articleInfo.data.page?.totalCount,
16105
+ pageNum,
16106
+ pageSize
16107
+ }
16108
+ } : null
16109
+ }, "百家号文章获取成功");
16152
16110
  } catch (error) {
16153
- console.error("获取文章数据失败:", error);
16154
- return {
16155
- code: 500,
16156
- message: "获取文章数据失败",
16111
+ return errorResponse(error instanceof Error ? error.message : "百家号数据获取失败");
16112
+ }
16113
+ }
16114
+ async function handleXiaohongshuData(params) {
16115
+ try {
16116
+ const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
16117
+ const xsEncrypt = new XsEncrypt();
16118
+ const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
16119
+ if (!a1Cookie) return {
16120
+ code: 200,
16121
+ message: "账号数据异常",
16157
16122
  data: null
16158
16123
  };
16124
+ if (onlySuccess && 10 != pageSize) return {
16125
+ code: 200,
16126
+ message: "小红书pageSize不可修改",
16127
+ data: null
16128
+ };
16129
+ const http = new utils_http.e({
16130
+ headers: {
16131
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
16132
+ referer: "https://creator.xiaohongshu.com",
16133
+ origin: "https://creator.xiaohongshu.com"
16134
+ }
16135
+ });
16136
+ async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
16137
+ const xt = Date.now().toString();
16138
+ const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
16139
+ const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
16140
+ return await http.api({
16141
+ method: "get",
16142
+ baseURL: "https://edith.xiaohongshu.com",
16143
+ url: serveUrl,
16144
+ headers: {
16145
+ "x-s": xs,
16146
+ "x-t": xt
16147
+ }
16148
+ });
16149
+ }
16150
+ const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
16151
+ let hasNextpage = -1 != articleInfo.data.page;
16152
+ let filtered = articleInfo.data.notes;
16153
+ let currentPage = pageNum + 1;
16154
+ const usedPages = new Set();
16155
+ while(filtered.length < pageSize && hasNextpage){
16156
+ if (usedPages.has(currentPage)) {
16157
+ currentPage++;
16158
+ continue;
16159
+ }
16160
+ const res = await fetchArticles(currentPage, a1Cookie, onlySuccess);
16161
+ usedPages.add(currentPage);
16162
+ const validItems = res.data.notes;
16163
+ filtered.push(...validItems);
16164
+ currentPage++;
16165
+ hasNextpage = -1 != res.data.page;
16166
+ }
16167
+ const final = filtered.slice(0, pageSize);
16168
+ const articleCell = final.map((item)=>({
16169
+ title: item.display_title,
16170
+ imageUrl: item.images_list[0].url,
16171
+ createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
16172
+ redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
16173
+ readNum: item.view_count,
16174
+ likeNum: item.likes,
16175
+ commentNum: item.comments_count,
16176
+ collectNum: item.collected_count,
16177
+ shareNum: item.shared_count,
16178
+ ...showOriginalData ? {
16179
+ originalData: item
16180
+ } : {}
16181
+ }));
16182
+ return (0, dist.Vp)({
16183
+ articleCell,
16184
+ ...onlySuccess ? {
16185
+ pagination: {
16186
+ total: articleInfo.data.tags[0]?.notes_count || -1,
16187
+ pageNum,
16188
+ pageSize
16189
+ }
16190
+ } : null
16191
+ }, "小红书文章获取成功");
16192
+ } catch (error) {
16193
+ return errorResponse(error instanceof Error ? error.message : "小红书数据获取失败");
16194
+ }
16195
+ }
16196
+ const FetchArticles = async (_task, params)=>{
16197
+ const { platform } = params;
16198
+ switch(platform){
16199
+ case "toutiao":
16200
+ return handleToutiaoData(params);
16201
+ case "weixin":
16202
+ return handleWeixinData(params);
16203
+ case "baijiahao":
16204
+ return handleBaijiahaoData(params);
16205
+ case "xiaohongshu":
16206
+ return handleXiaohongshuData(params);
16207
+ default:
16208
+ return (0, dist.Vp)(null, "暂不支持该平台");
16159
16209
  }
16160
16210
  };
16161
16211
  const getWeixinConfig = async (_task, params)=>{
@@ -17710,7 +17760,7 @@ var __webpack_exports__ = {};
17710
17760
  903: "账户已登出,需重新登陆重试!",
17711
17761
  902: "登录已过期,请重新登录!"
17712
17762
  };
17713
- const mock_xsEncrypt = new xhsXsEncrypt.H();
17763
+ const mock_xsEncrypt = new XsEncrypt();
17714
17764
  const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
17715
17765
  const tmpCachePath = task.getTmpPath();
17716
17766
  const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
@@ -17899,7 +17949,7 @@ var __webpack_exports__ = {};
17899
17949
  });
17900
17950
  return (0, dist.Vp)(publishResult.data?.id);
17901
17951
  };
17902
- const rpa_xsEncrypt = new xhsXsEncrypt.H();
17952
+ const rpa_xsEncrypt = new XsEncrypt();
17903
17953
  const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
17904
17954
  const commonCookies = {
17905
17955
  path: "/",
@@ -18114,7 +18164,7 @@ var __webpack_exports__ = {};
18114
18164
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
18115
18165
  return (0, utils.jo)(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
18116
18166
  };
18117
- var package_namespaceObject = JSON.parse('{"i8":"1.2.14-beta.0"}');
18167
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.14-beta.1"}');
18118
18168
  class Action {
18119
18169
  constructor(task){
18120
18170
  this.task = task;
@@ -18139,7 +18189,7 @@ var __webpack_exports__ = {};
18139
18189
  return this.bindTask(FetchArticles, params);
18140
18190
  }
18141
18191
  SearchAccountInfo(params) {
18142
- return this.bindTask(searchAccountInfo.A, params);
18192
+ return this.bindTask(SearchAccountInfo, params);
18143
18193
  }
18144
18194
  TTSessionCheck(params) {
18145
18195
  return this.bindTask(TTSessionCheck, params);