@iflyrpa/actions 1.2.16-beta.3 → 1.2.16
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/actions/common/FansTool/index.d.ts +9 -3
- package/dist/actions/getBaijiaohaoConfig/index.d.ts +0 -1
- package/dist/bundle.js +40 -828
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +6 -15
- package/dist/index.js +38 -826
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -826
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/actions/common/sessionCheck/index.d.ts +0 -16
- package/dist/actions/getWeixinConfig/index.d.ts +0 -16
- package/dist/actions/searchAccountInfo/getBjhInfo.d.ts +0 -3
- package/dist/actions/searchAccountInfo/getTTInfo.d.ts +0 -3
- package/dist/actions/searchAccountInfo/getWxInfo.d.ts +0 -3
- package/dist/actions/searchAccountInfo/getXhsInfo.d.ts +0 -3
- package/dist/actions/searchAccountInfo/index.d.ts +0 -8
- package/dist/actions/searchAccountInfo/types.d.ts +0 -44
- package/dist/actions/searchPublishInfo/handleBjhData.d.ts +0 -3
- package/dist/actions/searchPublishInfo/handleTTData.d.ts +0 -3
- package/dist/actions/searchPublishInfo/handleWXData.d.ts +0 -3
- package/dist/actions/searchPublishInfo/handleXhsData.d.ts +0 -3
- package/dist/actions/searchPublishInfo/index.d.ts +0 -15
- package/dist/actions/searchPublishInfo/types.d.ts +0 -52
package/dist/index.js
CHANGED
|
@@ -1168,14 +1168,7 @@ var __webpack_exports__ = {};
|
|
|
1168
1168
|
};
|
|
1169
1169
|
}
|
|
1170
1170
|
constructor(config){
|
|
1171
|
-
this.apiClient = external_axios_default().create(
|
|
1172
|
-
...config,
|
|
1173
|
-
proxy: {
|
|
1174
|
-
host: "localhost",
|
|
1175
|
-
port: 9000,
|
|
1176
|
-
protocol: "http"
|
|
1177
|
-
}
|
|
1178
|
-
});
|
|
1171
|
+
this.apiClient = external_axios_default().create(config);
|
|
1179
1172
|
}
|
|
1180
1173
|
addResponseInterceptor(findError) {
|
|
1181
1174
|
this.apiClient.interceptors.response.use((response)=>{
|
|
@@ -1866,20 +1859,12 @@ var __webpack_exports__ = {};
|
|
|
1866
1859
|
type: "news"
|
|
1867
1860
|
}
|
|
1868
1861
|
});
|
|
1869
|
-
|
|
1862
|
+
return (0, share_namespaceObject.success)(res?.data?.article.activity_list.map((_item)=>({
|
|
1870
1863
|
id: _item.id,
|
|
1871
1864
|
name: _item.name,
|
|
1872
1865
|
detail: _item.detail,
|
|
1873
1866
|
is_enable: _item.is_enable
|
|
1874
|
-
})) ?? [];
|
|
1875
|
-
data.push({
|
|
1876
|
-
id: "bjh_publish_num_left",
|
|
1877
|
-
name: "账号剩余发文数",
|
|
1878
|
-
detail: "",
|
|
1879
|
-
is_enable: 1,
|
|
1880
|
-
publish_num_left: res.data.ability.publish_num_left
|
|
1881
|
-
});
|
|
1882
|
-
return (0, share_namespaceObject.success)(data, "获取百家号配置项成功!");
|
|
1867
|
+
})) ?? [], "获取头条发布配置项成功");
|
|
1883
1868
|
};
|
|
1884
1869
|
const searchToutiaoTopicList = async (_task, params)=>{
|
|
1885
1870
|
const http = new Http({
|
|
@@ -2049,7 +2034,7 @@ var __webpack_exports__ = {};
|
|
|
2049
2034
|
this.iv = external_node_buffer_namespaceObject.Buffer.from("4uzjr7mbsibcaldp", "utf8");
|
|
2050
2035
|
}
|
|
2051
2036
|
}
|
|
2052
|
-
const
|
|
2037
|
+
const xsEncrypt = new XsEncrypt();
|
|
2053
2038
|
const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
2054
2039
|
const http = new Http({
|
|
2055
2040
|
headers: {
|
|
@@ -2077,9 +2062,9 @@ var __webpack_exports__ = {};
|
|
|
2077
2062
|
page: 1
|
|
2078
2063
|
}
|
|
2079
2064
|
};
|
|
2080
|
-
const topicDataStr =
|
|
2065
|
+
const topicDataStr = xsEncrypt.dumps(topicData);
|
|
2081
2066
|
const fatchTopic = `/web_api/sns/v1/search/topic${topicDataStr}`;
|
|
2082
|
-
const xs = await
|
|
2067
|
+
const xs = await xsEncrypt.encryptXs(fatchTopic, a1Cookie, xt);
|
|
2083
2068
|
const result = await http.api({
|
|
2084
2069
|
method: "post",
|
|
2085
2070
|
url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
|
|
@@ -2629,770 +2614,6 @@ var __webpack_exports__ = {};
|
|
|
2629
2614
|
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2630
2615
|
}
|
|
2631
2616
|
};
|
|
2632
|
-
const TTSessionCheck = async (_task, params)=>{
|
|
2633
|
-
const http = new Http({
|
|
2634
|
-
headers: {
|
|
2635
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2636
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2637
|
-
}
|
|
2638
|
-
});
|
|
2639
|
-
try {
|
|
2640
|
-
const res = await http.api({
|
|
2641
|
-
method: "get",
|
|
2642
|
-
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info",
|
|
2643
|
-
defaultErrorMsg: `头条号登录状态失效。`
|
|
2644
|
-
});
|
|
2645
|
-
return (0, share_namespaceObject.success)(0 === res.code ? {
|
|
2646
|
-
isValidSession: true
|
|
2647
|
-
} : {
|
|
2648
|
-
isValidSession: false
|
|
2649
|
-
}, "头条账号有效性检测完成!");
|
|
2650
|
-
} catch (error) {
|
|
2651
|
-
return (0, share_namespaceObject.success)({
|
|
2652
|
-
isValidSession: false
|
|
2653
|
-
}, "头条账号有效性检测失败!");
|
|
2654
|
-
}
|
|
2655
|
-
};
|
|
2656
|
-
const WxSessionCheck = async (_task, params)=>{
|
|
2657
|
-
const http = new Http({
|
|
2658
|
-
headers: {
|
|
2659
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2660
|
-
}
|
|
2661
|
-
});
|
|
2662
|
-
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
2663
|
-
try {
|
|
2664
|
-
const res = await http.api({
|
|
2665
|
-
method: "get",
|
|
2666
|
-
url: "https://mp.weixin.qq.com/cgi-bin/appmsgpublish",
|
|
2667
|
-
params: {
|
|
2668
|
-
fingerprint,
|
|
2669
|
-
sub: "list",
|
|
2670
|
-
begin: 0,
|
|
2671
|
-
count: 10,
|
|
2672
|
-
query: "",
|
|
2673
|
-
type: 1011102103,
|
|
2674
|
-
show_type: "",
|
|
2675
|
-
free_publish_type: 1102103,
|
|
2676
|
-
sub_action: "list_ex",
|
|
2677
|
-
search_card: 0,
|
|
2678
|
-
token: params.token,
|
|
2679
|
-
lang: "zh_CN",
|
|
2680
|
-
f: "json",
|
|
2681
|
-
ajax: 1
|
|
2682
|
-
}
|
|
2683
|
-
});
|
|
2684
|
-
return (0, share_namespaceObject.success)(0 === res.base_resp.ret ? {
|
|
2685
|
-
isValidSession: true
|
|
2686
|
-
} : {
|
|
2687
|
-
isValidSession: false
|
|
2688
|
-
}, "微信账号有效性检测完成!");
|
|
2689
|
-
} catch (error) {
|
|
2690
|
-
return (0, share_namespaceObject.success)({
|
|
2691
|
-
isValidSession: false
|
|
2692
|
-
}, "微信账号有效性检测失败!");
|
|
2693
|
-
}
|
|
2694
|
-
};
|
|
2695
|
-
const XhsSessionCheck = async (_task, params)=>{
|
|
2696
|
-
const http = new Http({
|
|
2697
|
-
headers: {
|
|
2698
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2699
|
-
referer: "https://creator.xiaohongshu.com/new/home?source=official"
|
|
2700
|
-
}
|
|
2701
|
-
});
|
|
2702
|
-
try {
|
|
2703
|
-
const res = await http.api({
|
|
2704
|
-
method: "get",
|
|
2705
|
-
url: "https://creator.xiaohongshu.com/api/galaxy/user/info"
|
|
2706
|
-
});
|
|
2707
|
-
return (0, share_namespaceObject.success)(0 === res.result ? {
|
|
2708
|
-
isValidSession: true
|
|
2709
|
-
} : {
|
|
2710
|
-
isValidSession: false
|
|
2711
|
-
}, "小红书账号有效性检测完成!");
|
|
2712
|
-
} catch (error) {
|
|
2713
|
-
return (0, share_namespaceObject.success)({
|
|
2714
|
-
isValidSession: false
|
|
2715
|
-
}, "小红书账号有效性检测完成!");
|
|
2716
|
-
}
|
|
2717
|
-
};
|
|
2718
|
-
const BjhSessionCheck = async (_task, params)=>{
|
|
2719
|
-
const http = new Http({
|
|
2720
|
-
headers: {
|
|
2721
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2722
|
-
referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
2723
|
-
}
|
|
2724
|
-
});
|
|
2725
|
-
try {
|
|
2726
|
-
const res = await http.api({
|
|
2727
|
-
method: "get",
|
|
2728
|
-
url: "https://baijiahao.baidu.com/pcui/home/index",
|
|
2729
|
-
defaultErrorMsg: `百家号登录状态失效。`
|
|
2730
|
-
});
|
|
2731
|
-
return (0, share_namespaceObject.success)(0 === res.errno ? {
|
|
2732
|
-
isValidSession: true
|
|
2733
|
-
} : {
|
|
2734
|
-
isValidSession: false
|
|
2735
|
-
}, "百家号账号有效性检测完成!");
|
|
2736
|
-
} catch (error) {
|
|
2737
|
-
return (0, share_namespaceObject.success)({
|
|
2738
|
-
isValidSession: false
|
|
2739
|
-
}, "百家号账号有效性检测失败!");
|
|
2740
|
-
}
|
|
2741
|
-
};
|
|
2742
|
-
const types_errorResponse = (message, code = 500)=>({
|
|
2743
|
-
code,
|
|
2744
|
-
message,
|
|
2745
|
-
data: null
|
|
2746
|
-
});
|
|
2747
|
-
async function getBaijiahaoData(params) {
|
|
2748
|
-
try {
|
|
2749
|
-
const { token } = params;
|
|
2750
|
-
if (!token) return types_errorResponse("缺少token", 200);
|
|
2751
|
-
const http = new Http({
|
|
2752
|
-
headers: {
|
|
2753
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2754
|
-
token: String(token),
|
|
2755
|
-
Referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
2756
|
-
}
|
|
2757
|
-
});
|
|
2758
|
-
const yesterday = TimeFormatter.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
|
|
2759
|
-
const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
|
|
2760
|
-
http.api({
|
|
2761
|
-
method: "get",
|
|
2762
|
-
url: "https://baijiahao.baidu.com/pcui/home/index"
|
|
2763
|
-
}),
|
|
2764
|
-
http.api({
|
|
2765
|
-
method: "get",
|
|
2766
|
-
url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
|
|
2767
|
-
}),
|
|
2768
|
-
http.api({
|
|
2769
|
-
method: "get",
|
|
2770
|
-
url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
|
|
2771
|
-
}),
|
|
2772
|
-
http.api({
|
|
2773
|
-
method: "get",
|
|
2774
|
-
url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
|
|
2775
|
-
params: {
|
|
2776
|
-
type: "all",
|
|
2777
|
-
is_yesterday: false,
|
|
2778
|
-
start_day: yesterday,
|
|
2779
|
-
end_day: yesterday,
|
|
2780
|
-
stat: 0
|
|
2781
|
-
}
|
|
2782
|
-
})
|
|
2783
|
-
]);
|
|
2784
|
-
const bjhData = {
|
|
2785
|
-
fansNum: fansData.data.coreData.fansCount,
|
|
2786
|
-
fansNumYesterday: -1 == yesterdayData.data.data.fans_increase ? null : yesterdayData.data.data.fans_increase,
|
|
2787
|
-
readNum: readData.data.total.view_count,
|
|
2788
|
-
incomeNum: incomeData.data.all_income.total_income,
|
|
2789
|
-
incomeNumYesterday: -1 == incomeData.data.all_income.yesterday_income ? null : incomeData.data.all_income.yesterday_income,
|
|
2790
|
-
recommendNumYesterday: -1 == yesterdayData.data.data.recommend_count ? null : yesterdayData.data.data.recommend_count,
|
|
2791
|
-
readNumYesterday: -1 == yesterdayData.data.data.view_count ? null : yesterdayData.data.data.view_count,
|
|
2792
|
-
likeNumYesterday: -1 == yesterdayData.data.data.likes_count ? null : yesterdayData.data.data.likes_count,
|
|
2793
|
-
commentNumYesterday: -1 == yesterdayData.data.data.comment_count ? null : yesterdayData.data.data.comment_count
|
|
2794
|
-
};
|
|
2795
|
-
return (0, share_namespaceObject.success)(bjhData, "百家号平台数据获取成功!");
|
|
2796
|
-
} catch (error) {
|
|
2797
|
-
return types_errorResponse(error instanceof Error ? error.message : "百家号平台数据获取失败");
|
|
2798
|
-
}
|
|
2799
|
-
}
|
|
2800
|
-
async function getToutiaoData(params) {
|
|
2801
|
-
const { cookies } = params;
|
|
2802
|
-
try {
|
|
2803
|
-
const http = new Http({
|
|
2804
|
-
headers: {
|
|
2805
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2806
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2807
|
-
}
|
|
2808
|
-
});
|
|
2809
|
-
const [totalData, contentDataYesterday] = await Promise.all([
|
|
2810
|
-
http.api({
|
|
2811
|
-
method: "get",
|
|
2812
|
-
url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
|
|
2813
|
-
params: {
|
|
2814
|
-
app_id: 1231
|
|
2815
|
-
}
|
|
2816
|
-
}),
|
|
2817
|
-
http.api({
|
|
2818
|
-
method: "get",
|
|
2819
|
-
url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
|
|
2820
|
-
params: {
|
|
2821
|
-
type: 0,
|
|
2822
|
-
app_id: 1231
|
|
2823
|
-
}
|
|
2824
|
-
})
|
|
2825
|
-
]);
|
|
2826
|
-
const isReday = void 0 !== totalData.data.statistic.data.yesterday_read_count;
|
|
2827
|
-
const ttData = {
|
|
2828
|
-
fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
|
|
2829
|
-
fansNumYesterday: void 0 !== totalData.data.statistic.data.yesterday_fans ? Number(totalData.data.statistic.data.yesterday_fans) : null,
|
|
2830
|
-
readNum: Number(totalData.data.statistic.data.total_read_play_count),
|
|
2831
|
-
incomeNum: totalData.data.statistic.data.total_income,
|
|
2832
|
-
incomeNumYesterday: totalData.data.statistic.data.is_yesterday_income_ready ? totalData.data.statistic.data.yesterday_income : null,
|
|
2833
|
-
showNumYesterday: isReday ? contentDataYesterday.author_stat.consume_data.impression_count : null,
|
|
2834
|
-
readNumYesterday: isReday ? contentDataYesterday.author_stat.consume_data.go_detail_count : null,
|
|
2835
|
-
likeNumYesterday: isReday ? contentDataYesterday.author_stat.interaction_data.digg_count : null,
|
|
2836
|
-
commentNumYesterday: isReday ? contentDataYesterday.author_stat.interaction_data.comment_count : null
|
|
2837
|
-
};
|
|
2838
|
-
return (0, share_namespaceObject.success)(ttData, "头条号粉丝数据获取成功!");
|
|
2839
|
-
} catch (error) {
|
|
2840
|
-
return types_errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
async function getWeixinData(params) {
|
|
2844
|
-
const { token } = params;
|
|
2845
|
-
if (!token) return {
|
|
2846
|
-
code: 200,
|
|
2847
|
-
message: "缺少token",
|
|
2848
|
-
data: null
|
|
2849
|
-
};
|
|
2850
|
-
try {
|
|
2851
|
-
const { token } = params;
|
|
2852
|
-
if (!token) return types_errorResponse("缺少token", 200);
|
|
2853
|
-
const http = new Http({
|
|
2854
|
-
headers: {
|
|
2855
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2856
|
-
}
|
|
2857
|
-
});
|
|
2858
|
-
const userInfo = {
|
|
2859
|
-
originalCount: 0,
|
|
2860
|
-
totalUsers: 0,
|
|
2861
|
-
userIncrease: 0,
|
|
2862
|
-
yesterday: {
|
|
2863
|
-
read: 0,
|
|
2864
|
-
share: 0,
|
|
2865
|
-
subscribe: 0
|
|
2866
|
-
}
|
|
2867
|
-
};
|
|
2868
|
-
const userInfoHtml = await http.api({
|
|
2869
|
-
method: "get",
|
|
2870
|
-
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
2871
|
-
params: {
|
|
2872
|
-
t: "home/index",
|
|
2873
|
-
token,
|
|
2874
|
-
lang: "zh_CN"
|
|
2875
|
-
}
|
|
2876
|
-
});
|
|
2877
|
-
const originalMatch = userInfoHtml.trim().match(/原创内容[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2878
|
-
if (originalMatch) userInfo.originalCount = parseInt(originalMatch[1].replace(/,/g, ''), 10);
|
|
2879
|
-
const totalUsersMatch = userInfoHtml.match(/总用户数[\s\S]*?<div[^>]*class=["']weui-desktop-user_sum["'][^>]*>[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2880
|
-
if (totalUsersMatch) userInfo.totalUsers = parseInt(totalUsersMatch[1].replace(/,/g, ''), 10);
|
|
2881
|
-
const increaseMatch = userInfoHtml.match(/weui-desktop-user_increase_num[^>]*>\s*([+-]?)\s*<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2882
|
-
if (increaseMatch) {
|
|
2883
|
-
const sign = '-' === increaseMatch[1] ? -1 : 1;
|
|
2884
|
-
userInfo.userIncrease = sign * parseInt(increaseMatch[2].replace(/,/g, ''), 10);
|
|
2885
|
-
}
|
|
2886
|
-
const readMatch = userInfoHtml.match(/昨日阅读[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2887
|
-
if (readMatch) userInfo.yesterday.read = parseInt(readMatch[1].replace(/,/g, ''), 10);
|
|
2888
|
-
const shareMatch = userInfoHtml.match(/昨日分享[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2889
|
-
if (shareMatch) userInfo.yesterday.share = parseInt(shareMatch[1].replace(/,/g, ''), 10);
|
|
2890
|
-
const subscribeMatch = userInfoHtml.match(/昨日新增关注[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2891
|
-
if (subscribeMatch) userInfo.yesterday.subscribe = parseInt(subscribeMatch[1].replace(/,/g, ''), 10);
|
|
2892
|
-
const wxData = {
|
|
2893
|
-
fansNum: userInfo.totalUsers,
|
|
2894
|
-
fansNumYesterday: userInfo.yesterday.subscribe,
|
|
2895
|
-
readNumYesterday: userInfo.yesterday.read,
|
|
2896
|
-
shareNumYesterday: userInfo.yesterday.share
|
|
2897
|
-
};
|
|
2898
|
-
return (0, share_namespaceObject.success)(wxData, "微信平台数据获取成功!");
|
|
2899
|
-
} catch (error) {
|
|
2900
|
-
return types_errorResponse(error instanceof Error ? error.message : "微信平台数据获取失败");
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
async function getXiaohongshuData(params) {
|
|
2904
|
-
try {
|
|
2905
|
-
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
2906
|
-
if (!a1Cookie) return types_errorResponse("账号数据异常,请重新绑定账号后重试。", 200);
|
|
2907
|
-
const http = new Http({
|
|
2908
|
-
headers: {
|
|
2909
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2910
|
-
referer: "https://creator.xiaohongshu.com",
|
|
2911
|
-
origin: "https://creator.xiaohongshu.com"
|
|
2912
|
-
}
|
|
2913
|
-
});
|
|
2914
|
-
const xsEncrypt = new XsEncrypt();
|
|
2915
|
-
const xt = Date.now().toString();
|
|
2916
|
-
const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
|
|
2917
|
-
const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
|
|
2918
|
-
const [overAllData, sevenData] = await Promise.all([
|
|
2919
|
-
http.api({
|
|
2920
|
-
method: "get",
|
|
2921
|
-
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
2922
|
-
}),
|
|
2923
|
-
http.api({
|
|
2924
|
-
method: "get",
|
|
2925
|
-
baseURL: "https://creator.xiaohongshu.com",
|
|
2926
|
-
url: sevenDataUrl,
|
|
2927
|
-
headers: {
|
|
2928
|
-
"x-s": xs,
|
|
2929
|
-
"x-t": xt
|
|
2930
|
-
}
|
|
2931
|
-
})
|
|
2932
|
-
]);
|
|
2933
|
-
const xhsData = {
|
|
2934
|
-
fansNum: overAllData.data.fans_count,
|
|
2935
|
-
favedNum: overAllData.data.faved_count,
|
|
2936
|
-
watchNumLastWeek: sevenData.data.seven.view_count,
|
|
2937
|
-
likeNumLastWeek: sevenData.data.seven.like_count,
|
|
2938
|
-
collectNumLastWeek: sevenData.data.seven.collect_count,
|
|
2939
|
-
commentNumLastWeek: sevenData.data.seven.comment_count,
|
|
2940
|
-
fansNumLastWeek: sevenData.data.seven.rise_fans_count,
|
|
2941
|
-
fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
|
|
2942
|
-
};
|
|
2943
|
-
return (0, share_namespaceObject.success)(xhsData, "小红书平台数据获取成功!");
|
|
2944
|
-
} catch (error) {
|
|
2945
|
-
return types_errorResponse(error instanceof Error ? error.message : "小红书平台数据获取失败");
|
|
2946
|
-
}
|
|
2947
|
-
}
|
|
2948
|
-
const SearchAccountInfo = async (_task, params)=>{
|
|
2949
|
-
const { platform } = params;
|
|
2950
|
-
switch(platform){
|
|
2951
|
-
case "toutiao":
|
|
2952
|
-
return getToutiaoData(params);
|
|
2953
|
-
case "xiaohongshu":
|
|
2954
|
-
return getXiaohongshuData(params);
|
|
2955
|
-
case "weixin":
|
|
2956
|
-
return getWeixinData(params);
|
|
2957
|
-
case "baijiahao":
|
|
2958
|
-
return getBaijiahaoData(params);
|
|
2959
|
-
default:
|
|
2960
|
-
return (0, share_namespaceObject.success)(null, "暂不支持该平台");
|
|
2961
|
-
}
|
|
2962
|
-
};
|
|
2963
|
-
const searchPublishInfo_types_errorResponse = (message, code = 500)=>({
|
|
2964
|
-
code,
|
|
2965
|
-
message,
|
|
2966
|
-
data: null
|
|
2967
|
-
});
|
|
2968
|
-
async function handleToutiaoData(params) {
|
|
2969
|
-
try {
|
|
2970
|
-
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
2971
|
-
const http = new Http({
|
|
2972
|
-
headers: {
|
|
2973
|
-
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2974
|
-
}
|
|
2975
|
-
});
|
|
2976
|
-
const visitedUid = await http.api({
|
|
2977
|
-
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?",
|
|
2978
|
-
method: "get",
|
|
2979
|
-
params: {
|
|
2980
|
-
app_id: 1231
|
|
2981
|
-
}
|
|
2982
|
-
});
|
|
2983
|
-
const articleInfo = await http.api({
|
|
2984
|
-
method: "get",
|
|
2985
|
-
url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
|
|
2986
|
-
params: {
|
|
2987
|
-
provider_type: "mp_provider",
|
|
2988
|
-
aid: "13",
|
|
2989
|
-
app_name: "news_article",
|
|
2990
|
-
category: "mp_all",
|
|
2991
|
-
channel: "",
|
|
2992
|
-
stream_api_version: "88",
|
|
2993
|
-
genre_type_switch: '{"repost":1,"small_video":1,"toutiao_graphic":1,"weitoutiao":1,"xigua_video":1}',
|
|
2994
|
-
device_platform: "pc",
|
|
2995
|
-
platform_id: "0",
|
|
2996
|
-
visited_uid: visitedUid.user_id_str,
|
|
2997
|
-
offset: (pageNum - 1) * pageSize,
|
|
2998
|
-
count: pageSize,
|
|
2999
|
-
keyword: "",
|
|
3000
|
-
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"}`,
|
|
3001
|
-
app_id: "1231"
|
|
3002
|
-
}
|
|
3003
|
-
});
|
|
3004
|
-
const articleCell = articleInfo.data.map((item)=>({
|
|
3005
|
-
title: item.assembleCell.itemCell.articleBase.title,
|
|
3006
|
-
imageUrl: item.assembleCell.itemCell.imageList.staggerFeedCover[0].url,
|
|
3007
|
-
createTime: item.assembleCell.itemCell.articleBase.publishTime,
|
|
3008
|
-
redirectUrl: item.assembleCell.itemCell.articleBase.articleURL,
|
|
3009
|
-
showNum: item.assembleCell.itemCell.itemCounter.showCount,
|
|
3010
|
-
readNum: item.assembleCell.itemCell.itemCounter.readCount,
|
|
3011
|
-
likeNum: item.assembleCell.itemCell.itemCounter.diggCount,
|
|
3012
|
-
commentNum: item.assembleCell.itemCell.itemCounter.commentCount,
|
|
3013
|
-
...showOriginalData ? {
|
|
3014
|
-
originalData: item
|
|
3015
|
-
} : {}
|
|
3016
|
-
}));
|
|
3017
|
-
const api_base_info_json = JSON.parse(articleInfo.api_base_info.app_extra_params);
|
|
3018
|
-
return (0, share_namespaceObject.success)({
|
|
3019
|
-
articleCell,
|
|
3020
|
-
...onlySuccess ? {
|
|
3021
|
-
pagination: {
|
|
3022
|
-
total: api_base_info_json.total_count || -1,
|
|
3023
|
-
pageNum,
|
|
3024
|
-
pageSize
|
|
3025
|
-
}
|
|
3026
|
-
} : null
|
|
3027
|
-
}, "头条号文章文章获取成功");
|
|
3028
|
-
} catch (error) {
|
|
3029
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
|
|
3030
|
-
}
|
|
3031
|
-
}
|
|
3032
|
-
async function handleWeixinData(params) {
|
|
3033
|
-
try {
|
|
3034
|
-
const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, cursor, lastPage } = params;
|
|
3035
|
-
if (!token) return {
|
|
3036
|
-
code: 200,
|
|
3037
|
-
message: "缺少token",
|
|
3038
|
-
data: null
|
|
3039
|
-
};
|
|
3040
|
-
const http = new Http({
|
|
3041
|
-
headers: {
|
|
3042
|
-
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
3043
|
-
}
|
|
3044
|
-
});
|
|
3045
|
-
const ParsePublishPage = (body)=>{
|
|
3046
|
-
const match = body.match(/publish_page\s*=\s*({[\s\S]*?});/);
|
|
3047
|
-
if (!match) throw new Error('无法提取 publish_page 字段');
|
|
3048
|
-
let parsedData = JSON.parse(match[1]);
|
|
3049
|
-
const decodeEntities = function(str, decode = false) {
|
|
3050
|
-
const encodeMap = [
|
|
3051
|
-
"&",
|
|
3052
|
-
"&",
|
|
3053
|
-
"<",
|
|
3054
|
-
"<",
|
|
3055
|
-
">",
|
|
3056
|
-
">",
|
|
3057
|
-
" ",
|
|
3058
|
-
" ",
|
|
3059
|
-
'"',
|
|
3060
|
-
""",
|
|
3061
|
-
"'",
|
|
3062
|
-
"'"
|
|
3063
|
-
];
|
|
3064
|
-
const decodeMap = [
|
|
3065
|
-
"'",
|
|
3066
|
-
"'",
|
|
3067
|
-
""",
|
|
3068
|
-
'"',
|
|
3069
|
-
" ",
|
|
3070
|
-
" ",
|
|
3071
|
-
">",
|
|
3072
|
-
">",
|
|
3073
|
-
"<",
|
|
3074
|
-
"<",
|
|
3075
|
-
"&",
|
|
3076
|
-
"&",
|
|
3077
|
-
"<",
|
|
3078
|
-
"<",
|
|
3079
|
-
">",
|
|
3080
|
-
">"
|
|
3081
|
-
];
|
|
3082
|
-
const map = decode ? decodeMap : encodeMap;
|
|
3083
|
-
let result = str;
|
|
3084
|
-
for(let i = 0; i < map.length; i += 2)result = result.replace(new RegExp(map[i], "g"), map[i + 1]);
|
|
3085
|
-
return result;
|
|
3086
|
-
};
|
|
3087
|
-
const finalData = {
|
|
3088
|
-
...parsedData,
|
|
3089
|
-
publish_list: parsedData.publish_list.map((item)=>{
|
|
3090
|
-
const decoded = decodeEntities(item.publish_info, true);
|
|
3091
|
-
const parsedInfo = JSON.parse(decoded);
|
|
3092
|
-
return {
|
|
3093
|
-
publish_type: item.publish_type,
|
|
3094
|
-
publish_info: parsedInfo
|
|
3095
|
-
};
|
|
3096
|
-
})
|
|
3097
|
-
};
|
|
3098
|
-
return finalData;
|
|
3099
|
-
};
|
|
3100
|
-
async function fetchArticles(begin, pageSize, token) {
|
|
3101
|
-
return http.api({
|
|
3102
|
-
method: "get",
|
|
3103
|
-
url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish',
|
|
3104
|
-
params: {
|
|
3105
|
-
sub: "list",
|
|
3106
|
-
begin: begin,
|
|
3107
|
-
count: pageSize,
|
|
3108
|
-
token: token,
|
|
3109
|
-
lang: "zh_CN"
|
|
3110
|
-
}
|
|
3111
|
-
});
|
|
3112
|
-
}
|
|
3113
|
-
let size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
|
|
3114
|
-
let begin = (lastPage ?? pageNum) - 1;
|
|
3115
|
-
let rawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
3116
|
-
let articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
3117
|
-
let articleCell = [];
|
|
3118
|
-
if (!onlySuccess && pageSize > 20) {
|
|
3119
|
-
let totalFetched = articlesInfo.publish_list.length;
|
|
3120
|
-
let nextPage = pageNum + 1;
|
|
3121
|
-
while(totalFetched < pageSize){
|
|
3122
|
-
const remaining = pageSize - totalFetched;
|
|
3123
|
-
const currentPageSize = remaining > 20 ? 20 : remaining;
|
|
3124
|
-
let _rawArticlesInfo = await fetchArticles((nextPage - 1) * 20, currentPageSize, token);
|
|
3125
|
-
let parsed = ParsePublishPage(_rawArticlesInfo);
|
|
3126
|
-
articlesInfo.publish_list = articlesInfo.publish_list.concat(parsed.publish_list);
|
|
3127
|
-
totalFetched = articlesInfo.publish_list.length;
|
|
3128
|
-
if (parsed.publish_list.length < currentPageSize) break;
|
|
3129
|
-
nextPage++;
|
|
3130
|
-
}
|
|
3131
|
-
articleCell = articlesInfo.publish_list.map((item)=>({
|
|
3132
|
-
title: item.publish_info.appmsg_info[0].title,
|
|
3133
|
-
imageUrl: item.publish_info.appmsg_info[0].cover,
|
|
3134
|
-
createTime: item.publish_info.appmsg_info[0].line_info.send_time,
|
|
3135
|
-
redirectUrl: item.publish_info.appmsg_info[0].content_url,
|
|
3136
|
-
readNum: item.publish_info.appmsg_info[0].read_num,
|
|
3137
|
-
likeNum: item.publish_info.appmsg_info[0].old_like_num,
|
|
3138
|
-
shareNum: item.publish_info.appmsg_info[0].share_num,
|
|
3139
|
-
recommendNum: item.publish_info.appmsg_info[0].like_num,
|
|
3140
|
-
...showOriginalData ? {
|
|
3141
|
-
originalData: item
|
|
3142
|
-
} : {}
|
|
3143
|
-
}));
|
|
3144
|
-
}
|
|
3145
|
-
let nextPage = false;
|
|
3146
|
-
if (onlySuccess) {
|
|
3147
|
-
let filteredList = articlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
|
|
3148
|
-
if (cursor) {
|
|
3149
|
-
const cursorIndex = filteredList.findIndex((item)=>item.msgid === cursor);
|
|
3150
|
-
if (-1 !== cursorIndex) filteredList = filteredList.slice(cursorIndex + 1);
|
|
3151
|
-
}
|
|
3152
|
-
let totalFetched = filteredList.length;
|
|
3153
|
-
while(totalFetched < pageSize && begin * size < articlesInfo.total_count){
|
|
3154
|
-
begin += 1;
|
|
3155
|
-
let nextRawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
3156
|
-
let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
|
|
3157
|
-
const newFiltered = nextArticlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
|
|
3158
|
-
filteredList = filteredList.concat(newFiltered);
|
|
3159
|
-
totalFetched = filteredList.length;
|
|
3160
|
-
}
|
|
3161
|
-
filteredList = filteredList.slice(0, pageSize);
|
|
3162
|
-
totalFetched = filteredList.length;
|
|
3163
|
-
if (totalFetched >= pageSize && begin * size < articlesInfo.total_count) {
|
|
3164
|
-
let nextRawArticlesInfo = await fetchArticles((begin + 1) * size, size, token);
|
|
3165
|
-
let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
|
|
3166
|
-
nextPage = nextArticlesInfo.publish_list.length > 0 && nextArticlesInfo.publish_list.some((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey"));
|
|
3167
|
-
}
|
|
3168
|
-
const lastMsgId = filteredList.length > 0 ? filteredList[filteredList.length - 1].msgid : void 0;
|
|
3169
|
-
articleCell = filteredList.map((item)=>({
|
|
3170
|
-
title: item.appmsg_info[0].title,
|
|
3171
|
-
imageUrl: item.appmsg_info[0].cover,
|
|
3172
|
-
createTime: item.appmsg_info[0].line_info.send_time,
|
|
3173
|
-
redirectUrl: item.appmsg_info[0].content_url,
|
|
3174
|
-
readNum: item.appmsg_info[0].read_num,
|
|
3175
|
-
likeNum: item.appmsg_info[0].old_like_num,
|
|
3176
|
-
shareNum: item.appmsg_info[0].share_num,
|
|
3177
|
-
recommendNum: item.appmsg_info[0].like_num,
|
|
3178
|
-
...showOriginalData ? {
|
|
3179
|
-
originalData: item
|
|
3180
|
-
} : {}
|
|
3181
|
-
}));
|
|
3182
|
-
return (0, share_namespaceObject.success)({
|
|
3183
|
-
articleCell,
|
|
3184
|
-
pagination: {
|
|
3185
|
-
nextPage,
|
|
3186
|
-
pageNum,
|
|
3187
|
-
pageSize,
|
|
3188
|
-
lastPage: begin + 1,
|
|
3189
|
-
cursor: lastMsgId
|
|
3190
|
-
}
|
|
3191
|
-
}, "微信文章文章获取成功");
|
|
3192
|
-
}
|
|
3193
|
-
return (0, share_namespaceObject.success)({
|
|
3194
|
-
articleCell
|
|
3195
|
-
}, "微信文章文章获取成功");
|
|
3196
|
-
} catch (error) {
|
|
3197
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
|
|
3198
|
-
}
|
|
3199
|
-
}
|
|
3200
|
-
async function handleBaijiahaoData(params) {
|
|
3201
|
-
try {
|
|
3202
|
-
const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3203
|
-
if (!token) return {
|
|
3204
|
-
code: 200,
|
|
3205
|
-
message: "缺少token",
|
|
3206
|
-
data: null
|
|
3207
|
-
};
|
|
3208
|
-
const http = new Http({
|
|
3209
|
-
headers: {
|
|
3210
|
-
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3211
|
-
token: token
|
|
3212
|
-
}
|
|
3213
|
-
});
|
|
3214
|
-
async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
|
|
3215
|
-
return await http.api({
|
|
3216
|
-
method: "get",
|
|
3217
|
-
url: "https://baijiahao.baidu.com/pcui/article/lists",
|
|
3218
|
-
params: {
|
|
3219
|
-
currentPage: pageNum,
|
|
3220
|
-
pageSize: pageSize,
|
|
3221
|
-
search: "",
|
|
3222
|
-
type: "",
|
|
3223
|
-
collection: onlySuccess ? "publish" : "",
|
|
3224
|
-
clearBeforeFetch: false,
|
|
3225
|
-
dynamic: 1
|
|
3226
|
-
}
|
|
3227
|
-
});
|
|
3228
|
-
}
|
|
3229
|
-
const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
|
|
3230
|
-
let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
|
|
3231
|
-
const totalPage = articleInfo.data.page?.totalPage || 1;
|
|
3232
|
-
let currentPage = pageNum + 1;
|
|
3233
|
-
const usedPages = new Set();
|
|
3234
|
-
while(filtered.length < pageSize && currentPage <= totalPage){
|
|
3235
|
-
if (usedPages.has(currentPage)) {
|
|
3236
|
-
currentPage++;
|
|
3237
|
-
continue;
|
|
3238
|
-
}
|
|
3239
|
-
const res = await fetchArticles(currentPage, pageSize, onlySuccess);
|
|
3240
|
-
usedPages.add(currentPage);
|
|
3241
|
-
const validItems = res.data.list.filter((item)=>"draft" !== item.status);
|
|
3242
|
-
filtered.push(...validItems);
|
|
3243
|
-
currentPage++;
|
|
3244
|
-
}
|
|
3245
|
-
const final = filtered.slice(0, pageSize);
|
|
3246
|
-
const articleCell = final.map((item)=>({
|
|
3247
|
-
title: item.title,
|
|
3248
|
-
imageUrl: JSON.parse(item.cover_images)[0].src,
|
|
3249
|
-
createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
|
|
3250
|
-
redirectUrl: item.url,
|
|
3251
|
-
recommendNum: item.rec_amount | item.forward_num,
|
|
3252
|
-
collectNum: item.collection_amount,
|
|
3253
|
-
readNum: item.read_amount | item.read_num,
|
|
3254
|
-
likeNum: item.like_amount | item.praise_num,
|
|
3255
|
-
commentNum: item.comment_amount | item.comment_num,
|
|
3256
|
-
shareNum: item.share_amount,
|
|
3257
|
-
...showOriginalData ? {
|
|
3258
|
-
originalData: item
|
|
3259
|
-
} : {}
|
|
3260
|
-
}));
|
|
3261
|
-
return (0, share_namespaceObject.success)({
|
|
3262
|
-
articleCell,
|
|
3263
|
-
...onlySuccess ? {
|
|
3264
|
-
pagination: {
|
|
3265
|
-
total: articleInfo.data.page?.totalCount,
|
|
3266
|
-
pageNum,
|
|
3267
|
-
pageSize
|
|
3268
|
-
}
|
|
3269
|
-
} : null
|
|
3270
|
-
}, "百家号文章数据获取成功");
|
|
3271
|
-
} catch (error) {
|
|
3272
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
|
|
3273
|
-
}
|
|
3274
|
-
}
|
|
3275
|
-
async function handleXiaohongshuData(params) {
|
|
3276
|
-
try {
|
|
3277
|
-
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3278
|
-
const xsEncrypt = new XsEncrypt();
|
|
3279
|
-
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
3280
|
-
if (!a1Cookie) return {
|
|
3281
|
-
code: 200,
|
|
3282
|
-
message: "账号数据异常",
|
|
3283
|
-
data: null
|
|
3284
|
-
};
|
|
3285
|
-
if (onlySuccess && 10 != pageSize) return {
|
|
3286
|
-
code: 200,
|
|
3287
|
-
message: "小红书pageSize不可修改",
|
|
3288
|
-
data: null
|
|
3289
|
-
};
|
|
3290
|
-
const http = new Http({
|
|
3291
|
-
headers: {
|
|
3292
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3293
|
-
referer: "https://creator.xiaohongshu.com",
|
|
3294
|
-
origin: "https://creator.xiaohongshu.com"
|
|
3295
|
-
}
|
|
3296
|
-
});
|
|
3297
|
-
async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
|
|
3298
|
-
const xt = Date.now().toString();
|
|
3299
|
-
const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
|
|
3300
|
-
const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
|
|
3301
|
-
return await http.api({
|
|
3302
|
-
method: "get",
|
|
3303
|
-
baseURL: "https://edith.xiaohongshu.com",
|
|
3304
|
-
url: serveUrl,
|
|
3305
|
-
headers: {
|
|
3306
|
-
"x-s": xs,
|
|
3307
|
-
"x-t": xt
|
|
3308
|
-
}
|
|
3309
|
-
});
|
|
3310
|
-
}
|
|
3311
|
-
const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
|
|
3312
|
-
let hasNextpage = -1 != articleInfo.data.page;
|
|
3313
|
-
let filtered = articleInfo.data.notes;
|
|
3314
|
-
let currentPage = pageNum + 1;
|
|
3315
|
-
const usedPages = new Set();
|
|
3316
|
-
while(filtered.length < pageSize && hasNextpage){
|
|
3317
|
-
if (usedPages.has(currentPage)) {
|
|
3318
|
-
currentPage++;
|
|
3319
|
-
continue;
|
|
3320
|
-
}
|
|
3321
|
-
const res = await fetchArticles(currentPage, a1Cookie, onlySuccess);
|
|
3322
|
-
usedPages.add(currentPage);
|
|
3323
|
-
const validItems = res.data.notes;
|
|
3324
|
-
filtered.push(...validItems);
|
|
3325
|
-
currentPage++;
|
|
3326
|
-
hasNextpage = -1 != res.data.page;
|
|
3327
|
-
}
|
|
3328
|
-
const final = filtered.slice(0, pageSize);
|
|
3329
|
-
const articleCell = final.map((item)=>({
|
|
3330
|
-
title: item.display_title,
|
|
3331
|
-
imageUrl: item.images_list[0].url,
|
|
3332
|
-
createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
|
|
3333
|
-
redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
|
|
3334
|
-
readNum: item.view_count,
|
|
3335
|
-
likeNum: item.likes,
|
|
3336
|
-
commentNum: item.comments_count,
|
|
3337
|
-
collectNum: item.collected_count,
|
|
3338
|
-
shareNum: item.shared_count,
|
|
3339
|
-
...showOriginalData ? {
|
|
3340
|
-
originalData: item
|
|
3341
|
-
} : {}
|
|
3342
|
-
}));
|
|
3343
|
-
return (0, share_namespaceObject.success)({
|
|
3344
|
-
articleCell,
|
|
3345
|
-
...onlySuccess ? {
|
|
3346
|
-
pagination: {
|
|
3347
|
-
nextPage: hasNextpage,
|
|
3348
|
-
pageNum,
|
|
3349
|
-
pageSize
|
|
3350
|
-
}
|
|
3351
|
-
} : null
|
|
3352
|
-
}, "小红书文章数据获取成功");
|
|
3353
|
-
} catch (error) {
|
|
3354
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "小红书文章数据获取失败");
|
|
3355
|
-
}
|
|
3356
|
-
}
|
|
3357
|
-
const FetchArticles = async (_task, params)=>{
|
|
3358
|
-
const { platform } = params;
|
|
3359
|
-
switch(platform){
|
|
3360
|
-
case "toutiao":
|
|
3361
|
-
return handleToutiaoData(params);
|
|
3362
|
-
case "weixin":
|
|
3363
|
-
return handleWeixinData(params);
|
|
3364
|
-
case "baijiahao":
|
|
3365
|
-
return handleBaijiahaoData(params);
|
|
3366
|
-
case "xiaohongshu":
|
|
3367
|
-
return handleXiaohongshuData(params);
|
|
3368
|
-
default:
|
|
3369
|
-
return (0, share_namespaceObject.success)(null, "暂不支持该平台");
|
|
3370
|
-
}
|
|
3371
|
-
};
|
|
3372
|
-
const getWeixinConfig = async (_task, params)=>{
|
|
3373
|
-
const http = new Http({
|
|
3374
|
-
headers: {
|
|
3375
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
3376
|
-
}
|
|
3377
|
-
});
|
|
3378
|
-
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
3379
|
-
const res = await http.api({
|
|
3380
|
-
method: "get",
|
|
3381
|
-
url: "https://mp.weixin.qq.com/cgi-bin/masssendpage",
|
|
3382
|
-
params: {
|
|
3383
|
-
f: 'json',
|
|
3384
|
-
token: params.token,
|
|
3385
|
-
lang: 'zh_CN',
|
|
3386
|
-
ajax: 1,
|
|
3387
|
-
fingerprint: fingerprint,
|
|
3388
|
-
random: Math.random().toString()
|
|
3389
|
-
}
|
|
3390
|
-
});
|
|
3391
|
-
const filtered = {
|
|
3392
|
-
publishQuota: 0 === res.base_resp.ret ? res.quota_detail_list.filter((item)=>"kQuotaTypeMassSendNormal" === item.quota_type).map((item)=>item.quota_item_list) : []
|
|
3393
|
-
};
|
|
3394
|
-
return (0, share_namespaceObject.success)(filtered, 0 === res.base_resp.ret ? "微信配置信息获取成功!" : "微信配置信息获取失败!");
|
|
3395
|
-
};
|
|
3396
2617
|
const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
3397
2618
|
const tmpCachePath = task.getTmpPath();
|
|
3398
2619
|
const http = new Http({
|
|
@@ -4963,33 +4184,40 @@ var __webpack_exports__ = {};
|
|
|
4963
4184
|
}
|
|
4964
4185
|
});
|
|
4965
4186
|
let uploadInfos = [];
|
|
4966
|
-
coverIdInfo.data.uploadTempPermits.
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4187
|
+
coverIdInfo.data.uploadTempPermits.forEach((item)=>{
|
|
4188
|
+
item.fileIds.forEach((fileId)=>{
|
|
4189
|
+
uploadInfos.push({
|
|
4190
|
+
bucket: item.bucket || "",
|
|
4191
|
+
uploadAddr: item.uploadAddr || "",
|
|
4192
|
+
fileIds: fileId,
|
|
4193
|
+
token: item.token || ""
|
|
4194
|
+
});
|
|
4972
4195
|
});
|
|
4973
4196
|
});
|
|
4197
|
+
if (uploadInfos.length < params.banners.length) return {
|
|
4198
|
+
code: 200,
|
|
4199
|
+
message: "可用 OSS bucket 数量不足,无法上传所有图片!",
|
|
4200
|
+
data: ""
|
|
4201
|
+
};
|
|
4974
4202
|
if (0 === uploadInfos.length) return {
|
|
4975
4203
|
code: 200,
|
|
4976
4204
|
message: "图片上传失败,请稍后重试!",
|
|
4977
4205
|
data: ""
|
|
4978
4206
|
};
|
|
4979
|
-
const
|
|
4207
|
+
const availableBuckets = Array.from({
|
|
4208
|
+
length: uploadInfos.length
|
|
4209
|
+
}, (_, i)=>i);
|
|
4210
|
+
const uploadFile = async (url, index)=>{
|
|
4980
4211
|
const fileName = (0, share_namespaceObject.getFilenameFromUrl)(url);
|
|
4981
4212
|
const localUrl = await (0, share_namespaceObject.downloadImage)(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
4982
4213
|
const fileBuffer = external_node_fs_default().readFileSync(localUrl);
|
|
4983
|
-
const
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
}
|
|
4991
|
-
const currentInfo = uploadInfos[uploadIndex];
|
|
4992
|
-
const ossFileId = currentInfo.fileIds[0];
|
|
4214
|
+
const MAX_RETRIES = uploadInfos.length;
|
|
4215
|
+
let attempt = 0;
|
|
4216
|
+
while(attempt < MAX_RETRIES){
|
|
4217
|
+
const ossBucketIndex = availableBuckets.shift();
|
|
4218
|
+
if (void 0 === ossBucketIndex) break;
|
|
4219
|
+
const currentInfo = uploadInfos[ossBucketIndex];
|
|
4220
|
+
const ossFileId = currentInfo.fileIds;
|
|
4993
4221
|
const ossToken = currentInfo.token;
|
|
4994
4222
|
const ossDomain = currentInfo.uploadAddr;
|
|
4995
4223
|
try {
|
|
@@ -5007,10 +4235,13 @@ var __webpack_exports__ = {};
|
|
|
5007
4235
|
ossToken
|
|
5008
4236
|
};
|
|
5009
4237
|
} catch (error) {
|
|
5010
|
-
|
|
4238
|
+
attempt++;
|
|
5011
4239
|
}
|
|
4240
|
+
}
|
|
4241
|
+
return {
|
|
4242
|
+
ossFileId: "",
|
|
4243
|
+
ossToken: ""
|
|
5012
4244
|
};
|
|
5013
|
-
return tryUpload(infoIndex);
|
|
5014
4245
|
};
|
|
5015
4246
|
const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
|
|
5016
4247
|
const invalidUpload = coverInfos.find((it)=>"" === it.ossToken || "" == it.ossFileId);
|
|
@@ -5355,7 +4586,9 @@ var __webpack_exports__ = {};
|
|
|
5355
4586
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
5356
4587
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
5357
4588
|
};
|
|
5358
|
-
var package_namespaceObject =
|
|
4589
|
+
var package_namespaceObject = {
|
|
4590
|
+
i8: "1.2.15"
|
|
4591
|
+
};
|
|
5359
4592
|
class Action {
|
|
5360
4593
|
constructor(task){
|
|
5361
4594
|
this.task = task;
|
|
@@ -5376,24 +4609,6 @@ var __webpack_exports__ = {};
|
|
|
5376
4609
|
} else this.task.logger.info(`${func.name} action success`);
|
|
5377
4610
|
return responseData;
|
|
5378
4611
|
}
|
|
5379
|
-
FetchArticles(params) {
|
|
5380
|
-
return this.bindTask(FetchArticles, params);
|
|
5381
|
-
}
|
|
5382
|
-
SearchAccountInfo(params) {
|
|
5383
|
-
return this.bindTask(SearchAccountInfo, params);
|
|
5384
|
-
}
|
|
5385
|
-
TTSessionCheck(params) {
|
|
5386
|
-
return this.bindTask(TTSessionCheck, params);
|
|
5387
|
-
}
|
|
5388
|
-
WxSessionCheck(params) {
|
|
5389
|
-
return this.bindTask(WxSessionCheck, params);
|
|
5390
|
-
}
|
|
5391
|
-
XhsSessionCheck(params) {
|
|
5392
|
-
return this.bindTask(XhsSessionCheck, params);
|
|
5393
|
-
}
|
|
5394
|
-
BjhSessionCheck(params) {
|
|
5395
|
-
return this.bindTask(BjhSessionCheck, params);
|
|
5396
|
-
}
|
|
5397
4612
|
searchToutiaoTopicList(params) {
|
|
5398
4613
|
return this.bindTask(searchToutiaoTopicList, params);
|
|
5399
4614
|
}
|
|
@@ -5418,9 +4633,6 @@ var __webpack_exports__ = {};
|
|
|
5418
4633
|
getToutiaoConfig(params) {
|
|
5419
4634
|
return this.bindTask(getToutiaoConfig, params);
|
|
5420
4635
|
}
|
|
5421
|
-
getWeixinConfig(params) {
|
|
5422
|
-
return this.bindTask(getWeixinConfig, params);
|
|
5423
|
-
}
|
|
5424
4636
|
getBaijiahaoConfig(params) {
|
|
5425
4637
|
return this.bindTask(getBaijiahaoConfig, params);
|
|
5426
4638
|
}
|