@iflyrpa/actions 1.2.14 → 1.2.16-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1811,12 +1811,20 @@ const getBaijiahaoConfig = async (_task, params)=>{
1811
1811
  type: "news"
1812
1812
  }
1813
1813
  });
1814
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(res?.data?.article.activity_list.map((_item)=>({
1814
+ const data = res?.data?.article.activity_list.map((_item)=>({
1815
1815
  id: _item.id,
1816
1816
  name: _item.name,
1817
1817
  detail: _item.detail,
1818
1818
  is_enable: _item.is_enable
1819
- })) ?? [], "获取头条发布配置项成功");
1819
+ })) ?? [];
1820
+ data.push({
1821
+ id: "bjh_publish_num_left",
1822
+ name: "账号剩余发文数",
1823
+ detail: "",
1824
+ is_enable: 1,
1825
+ publish_num_left: res.data.ability.publish_num_left
1826
+ });
1827
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(data, "获取百家号配置项成功!");
1820
1828
  };
1821
1829
  const searchToutiaoTopicList = async (_task, params)=>{
1822
1830
  const http = new Http({
@@ -1933,6 +1941,57 @@ const searchXiaohongshuLocation = async (_task, params)=>{
1933
1941
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
1934
1942
  }
1935
1943
  };
1944
+ class XsEncrypt {
1945
+ async encryptMD5(url) {
1946
+ return __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createHash("md5").update(url, "utf8").digest("hex");
1947
+ }
1948
+ async encryptText(text) {
1949
+ const textEncoded = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(text).toString("base64");
1950
+ const cipher = __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
1951
+ const ciphertext = cipher.update(textEncoded, "utf8", "base64");
1952
+ return ciphertext + cipher.final("base64");
1953
+ }
1954
+ async base64ToHex(encodedData) {
1955
+ const decodedData = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(encodedData, "base64");
1956
+ return decodedData.toString("hex");
1957
+ }
1958
+ async encryptPayload(payload, platform) {
1959
+ const hexPayload = await this.base64ToHex(payload);
1960
+ const obj = {
1961
+ signSvn: "56",
1962
+ signType: "x2",
1963
+ appID: platform,
1964
+ signVersion: "1",
1965
+ payload: hexPayload
1966
+ };
1967
+ const jsonString = JSON.stringify(obj, null, 0);
1968
+ return __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(jsonString).toString("base64");
1969
+ }
1970
+ async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
1971
+ 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};`;
1972
+ return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
1973
+ }
1974
+ dumps(...rest) {
1975
+ const [data, replacer = null, space = 0] = rest;
1976
+ return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
1977
+ }
1978
+ constructor(){
1979
+ this.words = [
1980
+ 929260340,
1981
+ 1633971297,
1982
+ 895580464,
1983
+ 925905270
1984
+ ];
1985
+ this.keyBytes = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.concat(this.words.map((word)=>new Uint8Array(__WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from([
1986
+ word >> 24 & 0xff,
1987
+ word >> 16 & 0xff,
1988
+ word >> 8 & 0xff,
1989
+ 0xff & word
1990
+ ]))));
1991
+ this.iv = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from("4uzjr7mbsibcaldp", "utf8");
1992
+ }
1993
+ }
1994
+ const searchXiaohongshuTopicList_xsEncrypt = new XsEncrypt();
1936
1995
  const searchXiaohongshuTopicList = async (_task, params)=>{
1937
1996
  const http = new Http({
1938
1997
  headers: {
@@ -1941,20 +2000,35 @@ const searchXiaohongshuTopicList = async (_task, params)=>{
1941
2000
  origin: "https://creator.xiaohongshu.com"
1942
2001
  }
1943
2002
  });
2003
+ const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
2004
+ if (!a1Cookie) return {
2005
+ code: 200,
2006
+ message: "账号数据异常,请重新绑定账号后重试。",
2007
+ data: []
2008
+ };
1944
2009
  try {
2010
+ const xt = Date.now().toString();
2011
+ const topicData = {
2012
+ keyword: params.searchValue,
2013
+ suggest_topic_request: {
2014
+ title: "",
2015
+ desc: `#${params.searchValue}`
2016
+ },
2017
+ page: {
2018
+ page_size: 20,
2019
+ page: 1
2020
+ }
2021
+ };
2022
+ const topicDataStr = searchXiaohongshuTopicList_xsEncrypt.dumps(topicData);
2023
+ const fatchTopic = `/web_api/sns/v1/search/topic${topicDataStr}`;
2024
+ const xs = await searchXiaohongshuTopicList_xsEncrypt.encryptXs(fatchTopic, a1Cookie, xt);
1945
2025
  const result = await http.api({
1946
2026
  method: "post",
1947
2027
  url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
1948
- data: {
1949
- keyword: params.searchValue,
1950
- suggest_topic_request: {
1951
- title: "",
1952
- desc: `#${params.searchValue}`
1953
- },
1954
- page: {
1955
- page_size: 20,
1956
- page: 1
1957
- }
2028
+ data: topicData,
2029
+ headers: {
2030
+ "x-s": xs,
2031
+ "x-t": xt
1958
2032
  },
1959
2033
  defaultErrorMsg: "话题搜索异常,请稍后重试。"
1960
2034
  });
@@ -2497,6 +2571,726 @@ const BjhFansExport = async (_task, params)=>{
2497
2571
  }, "获取粉丝数失败,请检查登陆有效性!");
2498
2572
  }
2499
2573
  };
2574
+ const TTSessionCheck = async (_task, params)=>{
2575
+ const http = new Http({
2576
+ headers: {
2577
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2578
+ referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
2579
+ }
2580
+ });
2581
+ try {
2582
+ const res = await http.api({
2583
+ method: "get",
2584
+ url: "https://mp.toutiao.com/mp/agw/creator_center/user_info",
2585
+ defaultErrorMsg: `头条号登录状态失效。`
2586
+ });
2587
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.code ? {
2588
+ isValidSession: true
2589
+ } : {
2590
+ isValidSession: false
2591
+ }, "头条账号有效性检测完成!");
2592
+ } catch (error) {
2593
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
2594
+ isValidSession: false
2595
+ }, "头条账号有效性检测失败!");
2596
+ }
2597
+ };
2598
+ const WxSessionCheck = async (_task, params)=>{
2599
+ const http = new Http({
2600
+ headers: {
2601
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
2602
+ }
2603
+ });
2604
+ const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
2605
+ try {
2606
+ const res = await http.api({
2607
+ method: "get",
2608
+ url: "https://mp.weixin.qq.com/cgi-bin/appmsgpublish",
2609
+ params: {
2610
+ fingerprint,
2611
+ sub: "list",
2612
+ begin: 0,
2613
+ count: 10,
2614
+ query: "",
2615
+ type: 1011102103,
2616
+ show_type: "",
2617
+ free_publish_type: 1102103,
2618
+ sub_action: "list_ex",
2619
+ search_card: 0,
2620
+ token: params.token,
2621
+ lang: "zh_CN",
2622
+ f: "json",
2623
+ ajax: 1
2624
+ }
2625
+ });
2626
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.base_resp.ret ? {
2627
+ isValidSession: true
2628
+ } : {
2629
+ isValidSession: false
2630
+ }, "微信账号有效性检测完成!");
2631
+ } catch (error) {
2632
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
2633
+ isValidSession: false
2634
+ }, "微信账号有效性检测失败!");
2635
+ }
2636
+ };
2637
+ const XhsSessionCheck = async (_task, params)=>{
2638
+ const http = new Http({
2639
+ headers: {
2640
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2641
+ referer: "https://creator.xiaohongshu.com/new/home?source=official"
2642
+ }
2643
+ });
2644
+ try {
2645
+ const res = await http.api({
2646
+ method: "get",
2647
+ url: "https://creator.xiaohongshu.com/api/galaxy/user/info"
2648
+ });
2649
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.result ? {
2650
+ isValidSession: true
2651
+ } : {
2652
+ isValidSession: false
2653
+ }, "小红书账号有效性检测完成!");
2654
+ } catch (error) {
2655
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
2656
+ isValidSession: false
2657
+ }, "小红书账号有效性检测完成!");
2658
+ }
2659
+ };
2660
+ const BjhSessionCheck = async (_task, params)=>{
2661
+ const http = new Http({
2662
+ headers: {
2663
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2664
+ referer: "https://baijiahao.baidu.com/builder/rc/home"
2665
+ }
2666
+ });
2667
+ try {
2668
+ const res = await http.api({
2669
+ method: "get",
2670
+ url: "https://baijiahao.baidu.com/pcui/home/index",
2671
+ defaultErrorMsg: `百家号登录状态失效。`
2672
+ });
2673
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.errno ? {
2674
+ isValidSession: true
2675
+ } : {
2676
+ isValidSession: false
2677
+ }, "百家号账号有效性检测完成!");
2678
+ } catch (error) {
2679
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
2680
+ isValidSession: false
2681
+ }, "百家号账号有效性检测失败!");
2682
+ }
2683
+ };
2684
+ const types_errorResponse = (message, code = 500)=>({
2685
+ code,
2686
+ message,
2687
+ data: null
2688
+ });
2689
+ async function getBaijiahaoData(params) {
2690
+ try {
2691
+ const { token } = params;
2692
+ if (!token) return types_errorResponse("缺少token", 200);
2693
+ const http = new Http({
2694
+ headers: {
2695
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2696
+ token: String(token),
2697
+ Referer: "https://baijiahao.baidu.com/builder/rc/home"
2698
+ }
2699
+ });
2700
+ const yesterday = TimeFormatter.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
2701
+ const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
2702
+ http.api({
2703
+ method: "get",
2704
+ url: "https://baijiahao.baidu.com/pcui/home/index"
2705
+ }),
2706
+ http.api({
2707
+ method: "get",
2708
+ url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
2709
+ }),
2710
+ http.api({
2711
+ method: "get",
2712
+ url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
2713
+ }),
2714
+ http.api({
2715
+ method: "get",
2716
+ url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
2717
+ params: {
2718
+ type: "all",
2719
+ is_yesterday: false,
2720
+ start_day: yesterday,
2721
+ end_day: yesterday,
2722
+ stat: 0
2723
+ }
2724
+ })
2725
+ ]);
2726
+ const bjhData = {
2727
+ fansNum: fansData.data.coreData.fansCount,
2728
+ fansNumYesterday: -1 == yesterdayData.data.data.fans_increase ? null : yesterdayData.data.data.fans_increase,
2729
+ readNum: readData.data.total.view_count,
2730
+ incomeNum: incomeData.data.all_income.total_income,
2731
+ incomeNumYesterday: -1 == incomeData.data.all_income.yesterday_income ? null : incomeData.data.all_income.yesterday_income,
2732
+ recommendNumYesterday: -1 == yesterdayData.data.data.recommend_count ? null : yesterdayData.data.data.recommend_count,
2733
+ readNumYesterday: -1 == yesterdayData.data.data.view_count ? null : yesterdayData.data.data.view_count,
2734
+ likeNumYesterday: -1 == yesterdayData.data.data.likes_count ? null : yesterdayData.data.data.likes_count,
2735
+ commentNumYesterday: -1 == yesterdayData.data.data.comment_count ? null : yesterdayData.data.data.comment_count
2736
+ };
2737
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(bjhData, "百家号平台数据获取成功!");
2738
+ } catch (error) {
2739
+ return types_errorResponse(error instanceof Error ? error.message : "百家号平台数据获取失败");
2740
+ }
2741
+ }
2742
+ async function getToutiaoData(params) {
2743
+ const { cookies } = params;
2744
+ try {
2745
+ const http = new Http({
2746
+ headers: {
2747
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2748
+ referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
2749
+ }
2750
+ });
2751
+ const [totalData, contentDataYesterday] = await Promise.all([
2752
+ http.api({
2753
+ method: "get",
2754
+ url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
2755
+ params: {
2756
+ app_id: 1231
2757
+ }
2758
+ }),
2759
+ http.api({
2760
+ method: "get",
2761
+ url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
2762
+ params: {
2763
+ type: 0,
2764
+ app_id: 1231
2765
+ }
2766
+ })
2767
+ ]);
2768
+ const ttData = {
2769
+ fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
2770
+ fansNumYesterday: void 0 !== totalData.data.statistic.data.yesterday_fans ? Number(totalData.data.statistic.data.yesterday_fans) : null,
2771
+ readNum: Number(totalData.data.statistic.data.total_read_play_count),
2772
+ incomeNum: totalData.data.statistic.data.total_income,
2773
+ incomeNumYesterday: totalData.data.statistic.data.is_yesterday_income_ready ? totalData.data.statistic.data.yesterday_income : null,
2774
+ showNumYesterday: contentDataYesterday.author_stat.consume_data.impression_count,
2775
+ readNumYesterday: contentDataYesterday.author_stat.consume_data.go_detail_count,
2776
+ likeNumYesterday: contentDataYesterday.author_stat.interaction_data.digg_count,
2777
+ commentNumYesterday: contentDataYesterday.author_stat.interaction_data.comment_count
2778
+ };
2779
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(ttData, "头条号粉丝数据获取成功!");
2780
+ } catch (error) {
2781
+ return types_errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
2782
+ }
2783
+ }
2784
+ async function getWeixinData(params) {
2785
+ const { token } = params;
2786
+ if (!token) return {
2787
+ code: 200,
2788
+ message: "缺少token",
2789
+ data: null
2790
+ };
2791
+ try {
2792
+ const { token } = params;
2793
+ if (!token) return types_errorResponse("缺少token", 200);
2794
+ const http = new Http({
2795
+ headers: {
2796
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
2797
+ }
2798
+ });
2799
+ const userInfo = {
2800
+ originalCount: 0,
2801
+ totalUsers: 0,
2802
+ userIncrease: 0,
2803
+ yesterday: {
2804
+ read: 0,
2805
+ share: 0,
2806
+ subscribe: 0
2807
+ }
2808
+ };
2809
+ const userInfoHtml = await http.api({
2810
+ method: "get",
2811
+ url: "https://mp.weixin.qq.com/cgi-bin/home",
2812
+ params: {
2813
+ t: "home/index",
2814
+ token,
2815
+ lang: "zh_CN"
2816
+ }
2817
+ });
2818
+ const originalMatch = userInfoHtml.trim().match(/原创内容[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
2819
+ if (originalMatch) userInfo.originalCount = parseInt(originalMatch[1].replace(/,/g, ''), 10);
2820
+ const totalUsersMatch = userInfoHtml.match(/总用户数[\s\S]*?<div[^>]*class=["']weui-desktop-user_sum["'][^>]*>[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
2821
+ if (totalUsersMatch) userInfo.totalUsers = parseInt(totalUsersMatch[1].replace(/,/g, ''), 10);
2822
+ const increaseMatch = userInfoHtml.match(/weui-desktop-user_increase_num[^>]*>\s*([+-]?)\s*<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
2823
+ if (increaseMatch) {
2824
+ const sign = '-' === increaseMatch[1] ? -1 : 1;
2825
+ userInfo.userIncrease = sign * parseInt(increaseMatch[2].replace(/,/g, ''), 10);
2826
+ }
2827
+ const readMatch = userInfoHtml.match(/昨日阅读[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
2828
+ if (readMatch) userInfo.yesterday.read = parseInt(readMatch[1].replace(/,/g, ''), 10);
2829
+ const shareMatch = userInfoHtml.match(/昨日分享[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
2830
+ if (shareMatch) userInfo.yesterday.share = parseInt(shareMatch[1].replace(/,/g, ''), 10);
2831
+ const subscribeMatch = userInfoHtml.match(/昨日新增关注[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
2832
+ if (subscribeMatch) userInfo.yesterday.subscribe = parseInt(subscribeMatch[1].replace(/,/g, ''), 10);
2833
+ const wxData = {
2834
+ fansNum: userInfo.totalUsers,
2835
+ fansNumYesterday: userInfo.yesterday.subscribe,
2836
+ readNumYesterday: userInfo.yesterday.read,
2837
+ shareNumYesterday: userInfo.yesterday.share
2838
+ };
2839
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(wxData, "微信平台数据获取成功!");
2840
+ } catch (error) {
2841
+ return types_errorResponse(error instanceof Error ? error.message : "微信平台数据获取失败");
2842
+ }
2843
+ }
2844
+ async function getXiaohongshuData(params) {
2845
+ try {
2846
+ const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
2847
+ if (!a1Cookie) return types_errorResponse("账号数据异常,请重新绑定账号后重试。", 200);
2848
+ const http = new Http({
2849
+ headers: {
2850
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2851
+ referer: "https://creator.xiaohongshu.com",
2852
+ origin: "https://creator.xiaohongshu.com"
2853
+ }
2854
+ });
2855
+ const xsEncrypt = new XsEncrypt();
2856
+ const xt = Date.now().toString();
2857
+ const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
2858
+ const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
2859
+ const [overAllData, sevenData] = await Promise.all([
2860
+ http.api({
2861
+ method: "get",
2862
+ url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
2863
+ }),
2864
+ http.api({
2865
+ method: "get",
2866
+ baseURL: "https://creator.xiaohongshu.com",
2867
+ url: sevenDataUrl,
2868
+ headers: {
2869
+ "x-s": xs,
2870
+ "x-t": xt
2871
+ }
2872
+ })
2873
+ ]);
2874
+ const xhsData = {
2875
+ fansNum: overAllData.data.fans_count,
2876
+ favedNum: overAllData.data.faved_count,
2877
+ watchNumLastWeek: sevenData.data.seven.view_count,
2878
+ likeNumLastWeek: sevenData.data.seven.like_count,
2879
+ collectNumLastWeek: sevenData.data.seven.collect_count,
2880
+ commentNumLastWeek: sevenData.data.seven.comment_count,
2881
+ fansNumLastWeek: sevenData.data.seven.rise_fans_count,
2882
+ fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
2883
+ };
2884
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(xhsData, "小红书平台数据获取成功!");
2885
+ } catch (error) {
2886
+ return types_errorResponse(error instanceof Error ? error.message : "小红书平台数据获取失败");
2887
+ }
2888
+ }
2889
+ const SearchAccountInfo = async (_task, params)=>{
2890
+ const { platform } = params;
2891
+ switch(platform){
2892
+ case "toutiao":
2893
+ return getToutiaoData(params);
2894
+ case "xiaohongshu":
2895
+ return getXiaohongshuData(params);
2896
+ case "weixin":
2897
+ return getWeixinData(params);
2898
+ case "baijiahao":
2899
+ return getBaijiahaoData(params);
2900
+ default:
2901
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(null, "暂不支持该平台");
2902
+ }
2903
+ };
2904
+ const searchPublishInfo_types_errorResponse = (message, code = 500)=>({
2905
+ code,
2906
+ message,
2907
+ data: null
2908
+ });
2909
+ async function handleToutiaoData(params) {
2910
+ try {
2911
+ const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
2912
+ const http = new Http({
2913
+ headers: {
2914
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
2915
+ }
2916
+ });
2917
+ const visitedUid = await http.api({
2918
+ url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?",
2919
+ method: "get",
2920
+ params: {
2921
+ app_id: 1231
2922
+ }
2923
+ });
2924
+ const articleInfo = await http.api({
2925
+ method: "get",
2926
+ url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
2927
+ params: {
2928
+ provider_type: "mp_provider",
2929
+ aid: "13",
2930
+ app_name: "news_article",
2931
+ category: "mp_all",
2932
+ channel: "",
2933
+ stream_api_version: "88",
2934
+ genre_type_switch: '{"repost":1,"small_video":1,"toutiao_graphic":1,"weitoutiao":1,"xigua_video":1}',
2935
+ device_platform: "pc",
2936
+ platform_id: "0",
2937
+ visited_uid: visitedUid.user_id_str,
2938
+ offset: (pageNum - 1) * pageSize,
2939
+ count: pageSize,
2940
+ keyword: "",
2941
+ 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"}`,
2942
+ app_id: "1231"
2943
+ }
2944
+ });
2945
+ const articleCell = articleInfo.data.map((item)=>({
2946
+ title: item.assembleCell.itemCell.articleBase.title,
2947
+ imageUrl: item.assembleCell.itemCell.imageList.staggerFeedCover[0].url,
2948
+ createTime: item.assembleCell.itemCell.articleBase.publishTime,
2949
+ redirectUrl: item.assembleCell.itemCell.articleBase.articleURL,
2950
+ showNum: item.assembleCell.itemCell.itemCounter.showCount,
2951
+ readNum: item.assembleCell.itemCell.itemCounter.readCount,
2952
+ likeNum: item.assembleCell.itemCell.itemCounter.diggCount,
2953
+ commentNum: item.assembleCell.itemCell.itemCounter.commentCount,
2954
+ ...showOriginalData ? {
2955
+ originalData: item
2956
+ } : {}
2957
+ }));
2958
+ const api_base_info_json = JSON.parse(articleInfo.api_base_info.app_extra_params);
2959
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
2960
+ articleCell,
2961
+ ...onlySuccess ? {
2962
+ pagination: {
2963
+ total: api_base_info_json.total_count || -1,
2964
+ pageNum,
2965
+ pageSize
2966
+ }
2967
+ } : null
2968
+ }, "头条号文章文章获取成功");
2969
+ } catch (error) {
2970
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
2971
+ }
2972
+ }
2973
+ async function handleWeixinData(params) {
2974
+ try {
2975
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
2976
+ if (!token) return {
2977
+ code: 200,
2978
+ message: "缺少token",
2979
+ data: null
2980
+ };
2981
+ const http = new Http({
2982
+ headers: {
2983
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
2984
+ }
2985
+ });
2986
+ const ParsePublishPage = (body)=>{
2987
+ const match = body.match(/publish_page\s*=\s*({[\s\S]*?});/);
2988
+ if (!match) throw new Error('无法提取 publish_page 字段');
2989
+ let parsedData = JSON.parse(match[1]);
2990
+ const decodeEntities = function(str, decode = false) {
2991
+ const encodeMap = [
2992
+ "&",
2993
+ "&amp;",
2994
+ "<",
2995
+ "&lt;",
2996
+ ">",
2997
+ "&gt;",
2998
+ " ",
2999
+ "&nbsp;",
3000
+ '"',
3001
+ "&quot;",
3002
+ "'",
3003
+ "&#39;"
3004
+ ];
3005
+ const decodeMap = [
3006
+ "&#39;",
3007
+ "'",
3008
+ "&quot;",
3009
+ '"',
3010
+ "&nbsp;",
3011
+ " ",
3012
+ "&gt;",
3013
+ ">",
3014
+ "&lt;",
3015
+ "<",
3016
+ "&amp;",
3017
+ "&",
3018
+ "&#60;",
3019
+ "<",
3020
+ "&#62;",
3021
+ ">"
3022
+ ];
3023
+ const map = decode ? decodeMap : encodeMap;
3024
+ let result = str;
3025
+ for(let i = 0; i < map.length; i += 2)result = result.replace(new RegExp(map[i], "g"), map[i + 1]);
3026
+ return result;
3027
+ };
3028
+ const finalData = {
3029
+ ...parsedData,
3030
+ publish_list: parsedData.publish_list.map((item)=>{
3031
+ const decoded = decodeEntities(item.publish_info, true);
3032
+ const parsedInfo = JSON.parse(decoded);
3033
+ return {
3034
+ publish_type: item.publish_type,
3035
+ publish_info: parsedInfo
3036
+ };
3037
+ })
3038
+ };
3039
+ return finalData;
3040
+ };
3041
+ async function fetchArticles(begin, pageSize, token) {
3042
+ return http.api({
3043
+ method: "get",
3044
+ url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish',
3045
+ params: {
3046
+ sub: "list",
3047
+ begin: begin,
3048
+ count: pageSize,
3049
+ token: token,
3050
+ lang: "zh_CN"
3051
+ }
3052
+ });
3053
+ }
3054
+ let size = pageSize > 20 ? 20 : pageSize;
3055
+ let rawArticlesInfo = await fetchArticles((pageNum - 1) * size, size, token);
3056
+ let articlesInfo = ParsePublishPage(rawArticlesInfo);
3057
+ if (!onlySuccess && pageSize > 20) {
3058
+ let totalFetched = articlesInfo.publish_list.length;
3059
+ let nextPage = pageNum + 1;
3060
+ while(totalFetched < pageSize){
3061
+ const remaining = pageSize - totalFetched;
3062
+ const currentPageSize = remaining > 20 ? 20 : remaining;
3063
+ let _rawArticlesInfo = await fetchArticles((nextPage - 1) * 20, currentPageSize, token);
3064
+ let parsed = ParsePublishPage(_rawArticlesInfo);
3065
+ articlesInfo.publish_list = articlesInfo.publish_list.concat(parsed.publish_list);
3066
+ totalFetched = articlesInfo.publish_list.length;
3067
+ if (parsed.publish_list.length < currentPageSize) break;
3068
+ nextPage++;
3069
+ }
3070
+ }
3071
+ const articleCell = articlesInfo?.publish_list.map((item)=>({
3072
+ title: item.publish_info.appmsg_info[0].title,
3073
+ imageUrl: item.publish_info.appmsg_info[0].cover,
3074
+ createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3075
+ redirectUrl: item.publish_info.appmsg_info[0].content_url,
3076
+ readNum: item.publish_info.appmsg_info[0].read_num,
3077
+ likeNum: item.publish_info.appmsg_info[0].old_like_num,
3078
+ shareNum: item.publish_info.appmsg_info[0].share_num,
3079
+ recommendNum: item.publish_info.appmsg_info[0].like_num,
3080
+ ...showOriginalData ? {
3081
+ originalData: item
3082
+ } : {}
3083
+ }));
3084
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
3085
+ articleCell,
3086
+ ...onlySuccess ? {
3087
+ pagination: {
3088
+ total: articlesInfo?.total_count,
3089
+ pageNum,
3090
+ pageSize
3091
+ }
3092
+ } : null
3093
+ }, "微信文章文章获取成功");
3094
+ } catch (error) {
3095
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
3096
+ }
3097
+ }
3098
+ async function handleBaijiahaoData(params) {
3099
+ try {
3100
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3101
+ if (!token) return {
3102
+ code: 200,
3103
+ message: "缺少token",
3104
+ data: null
3105
+ };
3106
+ const http = new Http({
3107
+ headers: {
3108
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
3109
+ token: token
3110
+ }
3111
+ });
3112
+ async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
3113
+ return await http.api({
3114
+ method: "get",
3115
+ url: "https://baijiahao.baidu.com/pcui/article/lists",
3116
+ params: {
3117
+ currentPage: pageNum,
3118
+ pageSize: pageSize,
3119
+ search: "",
3120
+ type: "",
3121
+ collection: onlySuccess ? "publish" : "",
3122
+ clearBeforeFetch: false,
3123
+ dynamic: 1
3124
+ }
3125
+ });
3126
+ }
3127
+ const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
3128
+ let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
3129
+ const totalPage = articleInfo.data.page?.totalPage || 1;
3130
+ let currentPage = pageNum + 1;
3131
+ const usedPages = new Set();
3132
+ while(filtered.length < pageSize && currentPage <= totalPage){
3133
+ if (usedPages.has(currentPage)) {
3134
+ currentPage++;
3135
+ continue;
3136
+ }
3137
+ const res = await fetchArticles(currentPage, pageSize, onlySuccess);
3138
+ usedPages.add(currentPage);
3139
+ const validItems = res.data.list.filter((item)=>"draft" !== item.status);
3140
+ filtered.push(...validItems);
3141
+ currentPage++;
3142
+ }
3143
+ const final = filtered.slice(0, pageSize);
3144
+ const articleCell = final.map((item)=>({
3145
+ title: item.title,
3146
+ imageUrl: JSON.parse(item.cover_images)[0].src,
3147
+ createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
3148
+ redirectUrl: item.url,
3149
+ recommendNum: item.rec_amount,
3150
+ collectNum: item.collection_amount,
3151
+ readNum: item.read_amount,
3152
+ likeNum: item.like_amount,
3153
+ commentNum: item.comment_amount,
3154
+ shareNum: item.share_amount,
3155
+ ...showOriginalData ? {
3156
+ originalData: item
3157
+ } : {}
3158
+ }));
3159
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
3160
+ articleCell,
3161
+ ...onlySuccess ? {
3162
+ pagination: {
3163
+ total: articleInfo.data.page?.totalCount,
3164
+ pageNum,
3165
+ pageSize
3166
+ }
3167
+ } : null
3168
+ }, "百家号文章数据获取成功");
3169
+ } catch (error) {
3170
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
3171
+ }
3172
+ }
3173
+ async function handleXiaohongshuData(params) {
3174
+ try {
3175
+ const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3176
+ const xsEncrypt = new XsEncrypt();
3177
+ const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
3178
+ if (!a1Cookie) return {
3179
+ code: 200,
3180
+ message: "账号数据异常",
3181
+ data: null
3182
+ };
3183
+ if (onlySuccess && 10 != pageSize) return {
3184
+ code: 200,
3185
+ message: "小红书pageSize不可修改",
3186
+ data: null
3187
+ };
3188
+ const http = new Http({
3189
+ headers: {
3190
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
3191
+ referer: "https://creator.xiaohongshu.com",
3192
+ origin: "https://creator.xiaohongshu.com"
3193
+ }
3194
+ });
3195
+ async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
3196
+ const xt = Date.now().toString();
3197
+ const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
3198
+ const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
3199
+ return await http.api({
3200
+ method: "get",
3201
+ baseURL: "https://edith.xiaohongshu.com",
3202
+ url: serveUrl,
3203
+ headers: {
3204
+ "x-s": xs,
3205
+ "x-t": xt
3206
+ }
3207
+ });
3208
+ }
3209
+ const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
3210
+ let hasNextpage = -1 != articleInfo.data.page;
3211
+ let filtered = articleInfo.data.notes;
3212
+ let currentPage = pageNum + 1;
3213
+ const usedPages = new Set();
3214
+ while(filtered.length < pageSize && hasNextpage){
3215
+ if (usedPages.has(currentPage)) {
3216
+ currentPage++;
3217
+ continue;
3218
+ }
3219
+ const res = await fetchArticles(currentPage, a1Cookie, onlySuccess);
3220
+ usedPages.add(currentPage);
3221
+ const validItems = res.data.notes;
3222
+ filtered.push(...validItems);
3223
+ currentPage++;
3224
+ hasNextpage = -1 != res.data.page;
3225
+ }
3226
+ const final = filtered.slice(0, pageSize);
3227
+ const articleCell = final.map((item)=>({
3228
+ title: item.display_title,
3229
+ imageUrl: item.images_list[0].url,
3230
+ createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
3231
+ redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
3232
+ readNum: item.view_count,
3233
+ likeNum: item.likes,
3234
+ commentNum: item.comments_count,
3235
+ collectNum: item.collected_count,
3236
+ shareNum: item.shared_count,
3237
+ ...showOriginalData ? {
3238
+ originalData: item
3239
+ } : {}
3240
+ }));
3241
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
3242
+ articleCell,
3243
+ ...onlySuccess ? {
3244
+ pagination: {
3245
+ nextPage: hasNextpage,
3246
+ pageNum,
3247
+ pageSize
3248
+ }
3249
+ } : null
3250
+ }, "小红书文章数据获取成功");
3251
+ } catch (error) {
3252
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "小红书文章数据获取失败");
3253
+ }
3254
+ }
3255
+ const FetchArticles = async (_task, params)=>{
3256
+ const { platform } = params;
3257
+ switch(platform){
3258
+ case "toutiao":
3259
+ return handleToutiaoData(params);
3260
+ case "weixin":
3261
+ return handleWeixinData(params);
3262
+ case "baijiahao":
3263
+ return handleBaijiahaoData(params);
3264
+ case "xiaohongshu":
3265
+ return handleXiaohongshuData(params);
3266
+ default:
3267
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(null, "暂不支持该平台");
3268
+ }
3269
+ };
3270
+ const getWeixinConfig = async (_task, params)=>{
3271
+ const http = new Http({
3272
+ headers: {
3273
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
3274
+ }
3275
+ });
3276
+ const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
3277
+ const res = await http.api({
3278
+ method: "get",
3279
+ url: "https://mp.weixin.qq.com/cgi-bin/masssendpage",
3280
+ params: {
3281
+ f: 'json',
3282
+ token: params.token,
3283
+ lang: 'zh_CN',
3284
+ ajax: 1,
3285
+ fingerprint: fingerprint,
3286
+ random: Math.random().toString()
3287
+ }
3288
+ });
3289
+ const filtered = {
3290
+ publishQuota: 0 === res.base_resp.ret ? res.quota_detail_list.filter((item)=>"kQuotaTypeMassSendNormal" === item.quota_type).map((item)=>item.quota_item_list) : []
3291
+ };
3292
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(filtered, 0 === res.base_resp.ret ? "微信配置信息获取成功!" : "微信配置信息获取失败!");
3293
+ };
2500
3294
  const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
2501
3295
  const tmpCachePath = task.getTmpPath();
2502
3296
  const http = new Http({
@@ -4018,63 +4812,14 @@ const weixinmpPublish = async (task, params)=>{
4018
4812
  if ("mockApi" === params.actionType) return weixinmpPublish_mock_mockAction(task, params);
4019
4813
  return executeAction(weixinmpPublish_mock_mockAction, weixinmpPublish_rpa_rpaAction)(task, params);
4020
4814
  };
4021
- class XsEncrypt {
4022
- async encryptMD5(url) {
4023
- return __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createHash("md5").update(url, "utf8").digest("hex");
4024
- }
4025
- async encryptText(text) {
4026
- const textEncoded = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(text).toString("base64");
4027
- const cipher = __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
4028
- const ciphertext = cipher.update(textEncoded, "utf8", "base64");
4029
- return ciphertext + cipher.final("base64");
4030
- }
4031
- async base64ToHex(encodedData) {
4032
- const decodedData = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(encodedData, "base64");
4033
- return decodedData.toString("hex");
4034
- }
4035
- async encryptPayload(payload, platform) {
4036
- const hexPayload = await this.base64ToHex(payload);
4037
- const obj = {
4038
- signSvn: "56",
4039
- signType: "x2",
4040
- appID: platform,
4041
- signVersion: "1",
4042
- payload: hexPayload
4043
- };
4044
- const jsonString = JSON.stringify(obj, null, 0);
4045
- return __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(jsonString).toString("base64");
4046
- }
4047
- async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
4048
- 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};`;
4049
- return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
4050
- }
4051
- dumps(...rest) {
4052
- const [data, replacer = null, space = 0] = rest;
4053
- return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
4054
- }
4055
- constructor(){
4056
- this.words = [
4057
- 929260340,
4058
- 1633971297,
4059
- 895580464,
4060
- 925905270
4061
- ];
4062
- this.keyBytes = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.concat(this.words.map((word)=>new Uint8Array(__WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from([
4063
- word >> 24 & 0xff,
4064
- word >> 16 & 0xff,
4065
- word >> 8 & 0xff,
4066
- 0xff & word
4067
- ]))));
4068
- this.iv = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from("4uzjr7mbsibcaldp", "utf8");
4069
- }
4070
- }
4071
4815
  const xiaohongshuPublish_mock_errnoMap = {
4072
4816
  915: "所属C端账号手机号被修改,请重新登录",
4073
4817
  914: "所属C端账号密码被修改,请重新登录",
4074
4818
  903: "账户已登出,需重新登陆重试!",
4075
- 902: "登录已过期,请重新登录!"
4819
+ 902: "登录已过期,请重新登录!",
4820
+ 906: "账号存在风险,请重新登录"
4076
4821
  };
4077
- const xsEncrypt = new XsEncrypt();
4822
+ const mock_xsEncrypt = new XsEncrypt();
4078
4823
  const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
4079
4824
  const tmpCachePath = task.getTmpPath();
4080
4825
  const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
@@ -4104,7 +4849,7 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
4104
4849
  });
4105
4850
  const fetchCoverUrl = `/api/media/v1/upload/creator/permit?biz_name=spectrum&scene=image&file_count=${params.banners.length}&version=1&source=web`;
4106
4851
  const xt = Date.now().toString();
4107
- const xs = await xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt);
4852
+ const xs = await mock_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt);
4108
4853
  const coverIdInfo = await http.api({
4109
4854
  method: "get",
4110
4855
  baseURL: "https://creator.xiaohongshu.com",
@@ -4115,41 +4860,71 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
4115
4860
  "x-t": xt
4116
4861
  }
4117
4862
  });
4118
- const coverIds = coverIdInfo.data.uploadTempPermits[0].fileIds;
4119
- const ossToken = coverIdInfo.data.uploadTempPermits[0].token;
4120
- if (!coverIds || !ossToken) return {
4863
+ let uploadInfos = [];
4864
+ coverIdInfo.data.uploadTempPermits.map((item)=>{
4865
+ uploadInfos.push({
4866
+ bucket: "",
4867
+ uploadAddr: item.uploadAddr,
4868
+ fileIds: item.fileIds,
4869
+ token: item.token
4870
+ });
4871
+ });
4872
+ if (0 === uploadInfos.length) return {
4121
4873
  code: 200,
4122
4874
  message: "图片上传失败,请稍后重试!",
4123
4875
  data: ""
4124
4876
  };
4125
- const uploadFile = async (url, index)=>{
4877
+ const uploadFile = async (url, index, infoIndex = 0)=>{
4126
4878
  const fileName = (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.getFilenameFromUrl)(url);
4127
4879
  const localUrl = await (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
4128
- const ossFileId = coverIds[index];
4129
4880
  const fileBuffer = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(localUrl);
4130
- await http.api({
4131
- method: "put",
4132
- url: `https://ros-upload.xiaohongshu.com/${ossFileId}`,
4133
- data: fileBuffer,
4134
- headers: {
4135
- "x-cos-security-token": ossToken
4136
- },
4137
- defaultErrorMsg: "图片上传异常,请稍后重试发布。"
4138
- });
4139
- return {
4140
- ossFileId,
4141
- ossToken
4881
+ const tryUpload = async (uploadIndex)=>{
4882
+ if (uploadIndex >= uploadInfos.length) {
4883
+ __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].unlinkSync(localUrl);
4884
+ return {
4885
+ ossFileId: "",
4886
+ ossToken: ""
4887
+ };
4888
+ }
4889
+ const currentInfo = uploadInfos[uploadIndex];
4890
+ const ossFileId = currentInfo.fileIds[0];
4891
+ const ossToken = currentInfo.token;
4892
+ const ossDomain = currentInfo.uploadAddr;
4893
+ try {
4894
+ await http.api({
4895
+ method: "put",
4896
+ url: `https://${ossDomain}/${ossFileId}`,
4897
+ data: fileBuffer,
4898
+ headers: {
4899
+ "x-cos-security-token": ossToken
4900
+ },
4901
+ defaultErrorMsg: "图片上传异常,请稍后重试发布。"
4902
+ });
4903
+ return {
4904
+ ossFileId,
4905
+ ossToken
4906
+ };
4907
+ } catch (error) {
4908
+ return tryUpload(uploadIndex + 1);
4909
+ }
4142
4910
  };
4911
+ return tryUpload(infoIndex);
4143
4912
  };
4144
4913
  const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
4914
+ const invalidUpload = coverInfos.find((it)=>"" === it.ossToken || "" == it.ossFileId);
4915
+ if (invalidUpload) return {
4916
+ code: 200,
4917
+ message: "图片上传异常,请稍后重试发布。",
4918
+ data: ""
4919
+ };
4145
4920
  if (params.topic && params.topic.length > 0) await Promise.all(params.topic.map(async (topic)=>{
4146
4921
  if (!topic["id"]) {
4147
4922
  const topicData = {
4148
4923
  topic_names: topic["name"]
4149
4924
  };
4150
- const topicDataStr = xsEncrypt.dumps(topicData);
4925
+ const topicDataStr = mock_xsEncrypt.dumps(topicData);
4151
4926
  const publishXt = Date.now().toString();
4152
- const publishXs = await xsEncrypt.encryptXs(`/web_api/sns/capa/postgw/topic/batch_customized${topicDataStr}`, a1Cookie, publishXt);
4927
+ const publishXs = await mock_xsEncrypt.encryptXs(`/web_api/sns/capa/postgw/topic/batch_customized${topicDataStr}`, a1Cookie, publishXt);
4153
4928
  let createTopic = await http.api({
4154
4929
  method: "POST",
4155
4930
  url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
@@ -4248,9 +5023,9 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
4248
5023
  } : {}
4249
5024
  };
4250
5025
  publishData.common.business_binds = JSON.stringify(business_binds);
4251
- const publishDataStr = xsEncrypt.dumps(publishData);
5026
+ const publishDataStr = mock_xsEncrypt.dumps(publishData);
4252
5027
  const publishXt = Date.now().toString();
4253
- const publishXs = await xsEncrypt.encryptXs(`/web_api/sns/v2/note${publishDataStr}`, a1Cookie, publishXt);
5028
+ const publishXs = await mock_xsEncrypt.encryptXs(`/web_api/sns/v2/note${publishDataStr}`, a1Cookie, publishXt);
4254
5029
  const publishResult = await http.api({
4255
5030
  method: "post",
4256
5031
  url: "https://edith.xiaohongshu.com/web_api/sns/v2/note",
@@ -4479,7 +5254,7 @@ const xiaohongshuPublish = async (task, params)=>{
4479
5254
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
4480
5255
  };
4481
5256
  var package_namespaceObject = {
4482
- i8: "1.2.13"
5257
+ i8: "1.2.15"
4483
5258
  };
4484
5259
  class Action {
4485
5260
  constructor(task){
@@ -4501,6 +5276,24 @@ class Action {
4501
5276
  } else this.task.logger.info(`${func.name} action success`);
4502
5277
  return responseData;
4503
5278
  }
5279
+ FetchArticles(params) {
5280
+ return this.bindTask(FetchArticles, params);
5281
+ }
5282
+ SearchAccountInfo(params) {
5283
+ return this.bindTask(SearchAccountInfo, params);
5284
+ }
5285
+ TTSessionCheck(params) {
5286
+ return this.bindTask(TTSessionCheck, params);
5287
+ }
5288
+ WxSessionCheck(params) {
5289
+ return this.bindTask(WxSessionCheck, params);
5290
+ }
5291
+ XhsSessionCheck(params) {
5292
+ return this.bindTask(XhsSessionCheck, params);
5293
+ }
5294
+ BjhSessionCheck(params) {
5295
+ return this.bindTask(BjhSessionCheck, params);
5296
+ }
4504
5297
  searchToutiaoTopicList(params) {
4505
5298
  return this.bindTask(searchToutiaoTopicList, params);
4506
5299
  }
@@ -4525,6 +5318,9 @@ class Action {
4525
5318
  getToutiaoConfig(params) {
4526
5319
  return this.bindTask(getToutiaoConfig, params);
4527
5320
  }
5321
+ getWeixinConfig(params) {
5322
+ return this.bindTask(getWeixinConfig, params);
5323
+ }
4528
5324
  getBaijiahaoConfig(params) {
4529
5325
  return this.bindTask(getBaijiahaoConfig, params);
4530
5326
  }