@iflyrpa/actions 1.2.16-beta.4 → 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 -823
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +6 -15
- package/dist/index.js +38 -821
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -821
- 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.mjs
CHANGED
|
@@ -1123,9 +1123,7 @@ class Http {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
}
|
|
1125
1125
|
constructor(config){
|
|
1126
|
-
this.apiClient = __WEBPACK_EXTERNAL_MODULE_axios__["default"].create(
|
|
1127
|
-
...config
|
|
1128
|
-
});
|
|
1126
|
+
this.apiClient = __WEBPACK_EXTERNAL_MODULE_axios__["default"].create(config);
|
|
1129
1127
|
}
|
|
1130
1128
|
addResponseInterceptor(findError) {
|
|
1131
1129
|
this.apiClient.interceptors.response.use((response)=>{
|
|
@@ -1813,20 +1811,12 @@ const getBaijiahaoConfig = async (_task, params)=>{
|
|
|
1813
1811
|
type: "news"
|
|
1814
1812
|
}
|
|
1815
1813
|
});
|
|
1816
|
-
|
|
1814
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(res?.data?.article.activity_list.map((_item)=>({
|
|
1817
1815
|
id: _item.id,
|
|
1818
1816
|
name: _item.name,
|
|
1819
1817
|
detail: _item.detail,
|
|
1820
1818
|
is_enable: _item.is_enable
|
|
1821
|
-
})) ?? [];
|
|
1822
|
-
data.push({
|
|
1823
|
-
id: "bjh_publish_num_left",
|
|
1824
|
-
name: "账号剩余发文数",
|
|
1825
|
-
detail: "",
|
|
1826
|
-
is_enable: 1,
|
|
1827
|
-
publish_num_left: res.data.ability.publish_num_left
|
|
1828
|
-
});
|
|
1829
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(data, "获取百家号配置项成功!");
|
|
1819
|
+
})) ?? [], "获取头条发布配置项成功");
|
|
1830
1820
|
};
|
|
1831
1821
|
const searchToutiaoTopicList = async (_task, params)=>{
|
|
1832
1822
|
const http = new Http({
|
|
@@ -1993,7 +1983,7 @@ class XsEncrypt {
|
|
|
1993
1983
|
this.iv = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from("4uzjr7mbsibcaldp", "utf8");
|
|
1994
1984
|
}
|
|
1995
1985
|
}
|
|
1996
|
-
const
|
|
1986
|
+
const xsEncrypt = new XsEncrypt();
|
|
1997
1987
|
const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
1998
1988
|
const http = new Http({
|
|
1999
1989
|
headers: {
|
|
@@ -2021,9 +2011,9 @@ const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
|
2021
2011
|
page: 1
|
|
2022
2012
|
}
|
|
2023
2013
|
};
|
|
2024
|
-
const topicDataStr =
|
|
2014
|
+
const topicDataStr = xsEncrypt.dumps(topicData);
|
|
2025
2015
|
const fatchTopic = `/web_api/sns/v1/search/topic${topicDataStr}`;
|
|
2026
|
-
const xs = await
|
|
2016
|
+
const xs = await xsEncrypt.encryptXs(fatchTopic, a1Cookie, xt);
|
|
2027
2017
|
const result = await http.api({
|
|
2028
2018
|
method: "post",
|
|
2029
2019
|
url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
|
|
@@ -2573,770 +2563,6 @@ const BjhFansExport = async (_task, params)=>{
|
|
|
2573
2563
|
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2574
2564
|
}
|
|
2575
2565
|
};
|
|
2576
|
-
const TTSessionCheck = async (_task, params)=>{
|
|
2577
|
-
const http = new Http({
|
|
2578
|
-
headers: {
|
|
2579
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2580
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2581
|
-
}
|
|
2582
|
-
});
|
|
2583
|
-
try {
|
|
2584
|
-
const res = await http.api({
|
|
2585
|
-
method: "get",
|
|
2586
|
-
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info",
|
|
2587
|
-
defaultErrorMsg: `头条号登录状态失效。`
|
|
2588
|
-
});
|
|
2589
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.code ? {
|
|
2590
|
-
isValidSession: true
|
|
2591
|
-
} : {
|
|
2592
|
-
isValidSession: false
|
|
2593
|
-
}, "头条账号有效性检测完成!");
|
|
2594
|
-
} catch (error) {
|
|
2595
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2596
|
-
isValidSession: false
|
|
2597
|
-
}, "头条账号有效性检测失败!");
|
|
2598
|
-
}
|
|
2599
|
-
};
|
|
2600
|
-
const WxSessionCheck = async (_task, params)=>{
|
|
2601
|
-
const http = new Http({
|
|
2602
|
-
headers: {
|
|
2603
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2604
|
-
}
|
|
2605
|
-
});
|
|
2606
|
-
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
2607
|
-
try {
|
|
2608
|
-
const res = await http.api({
|
|
2609
|
-
method: "get",
|
|
2610
|
-
url: "https://mp.weixin.qq.com/cgi-bin/appmsgpublish",
|
|
2611
|
-
params: {
|
|
2612
|
-
fingerprint,
|
|
2613
|
-
sub: "list",
|
|
2614
|
-
begin: 0,
|
|
2615
|
-
count: 10,
|
|
2616
|
-
query: "",
|
|
2617
|
-
type: 1011102103,
|
|
2618
|
-
show_type: "",
|
|
2619
|
-
free_publish_type: 1102103,
|
|
2620
|
-
sub_action: "list_ex",
|
|
2621
|
-
search_card: 0,
|
|
2622
|
-
token: params.token,
|
|
2623
|
-
lang: "zh_CN",
|
|
2624
|
-
f: "json",
|
|
2625
|
-
ajax: 1
|
|
2626
|
-
}
|
|
2627
|
-
});
|
|
2628
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.base_resp.ret ? {
|
|
2629
|
-
isValidSession: true
|
|
2630
|
-
} : {
|
|
2631
|
-
isValidSession: false
|
|
2632
|
-
}, "微信账号有效性检测完成!");
|
|
2633
|
-
} catch (error) {
|
|
2634
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2635
|
-
isValidSession: false
|
|
2636
|
-
}, "微信账号有效性检测失败!");
|
|
2637
|
-
}
|
|
2638
|
-
};
|
|
2639
|
-
const XhsSessionCheck = async (_task, params)=>{
|
|
2640
|
-
const http = new Http({
|
|
2641
|
-
headers: {
|
|
2642
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2643
|
-
referer: "https://creator.xiaohongshu.com/new/home?source=official"
|
|
2644
|
-
}
|
|
2645
|
-
});
|
|
2646
|
-
try {
|
|
2647
|
-
const res = await http.api({
|
|
2648
|
-
method: "get",
|
|
2649
|
-
url: "https://creator.xiaohongshu.com/api/galaxy/user/info"
|
|
2650
|
-
});
|
|
2651
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.result ? {
|
|
2652
|
-
isValidSession: true
|
|
2653
|
-
} : {
|
|
2654
|
-
isValidSession: false
|
|
2655
|
-
}, "小红书账号有效性检测完成!");
|
|
2656
|
-
} catch (error) {
|
|
2657
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2658
|
-
isValidSession: false
|
|
2659
|
-
}, "小红书账号有效性检测完成!");
|
|
2660
|
-
}
|
|
2661
|
-
};
|
|
2662
|
-
const BjhSessionCheck = async (_task, params)=>{
|
|
2663
|
-
const http = new Http({
|
|
2664
|
-
headers: {
|
|
2665
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2666
|
-
referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
2667
|
-
}
|
|
2668
|
-
});
|
|
2669
|
-
try {
|
|
2670
|
-
const res = await http.api({
|
|
2671
|
-
method: "get",
|
|
2672
|
-
url: "https://baijiahao.baidu.com/pcui/home/index",
|
|
2673
|
-
defaultErrorMsg: `百家号登录状态失效。`
|
|
2674
|
-
});
|
|
2675
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.errno ? {
|
|
2676
|
-
isValidSession: true
|
|
2677
|
-
} : {
|
|
2678
|
-
isValidSession: false
|
|
2679
|
-
}, "百家号账号有效性检测完成!");
|
|
2680
|
-
} catch (error) {
|
|
2681
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2682
|
-
isValidSession: false
|
|
2683
|
-
}, "百家号账号有效性检测失败!");
|
|
2684
|
-
}
|
|
2685
|
-
};
|
|
2686
|
-
const types_errorResponse = (message, code = 500)=>({
|
|
2687
|
-
code,
|
|
2688
|
-
message,
|
|
2689
|
-
data: null
|
|
2690
|
-
});
|
|
2691
|
-
async function getBaijiahaoData(params) {
|
|
2692
|
-
try {
|
|
2693
|
-
const { token } = params;
|
|
2694
|
-
if (!token) return types_errorResponse("缺少token", 200);
|
|
2695
|
-
const http = new Http({
|
|
2696
|
-
headers: {
|
|
2697
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2698
|
-
token: String(token),
|
|
2699
|
-
Referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
2700
|
-
}
|
|
2701
|
-
});
|
|
2702
|
-
const yesterday = TimeFormatter.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
|
|
2703
|
-
const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
|
|
2704
|
-
http.api({
|
|
2705
|
-
method: "get",
|
|
2706
|
-
url: "https://baijiahao.baidu.com/pcui/home/index"
|
|
2707
|
-
}),
|
|
2708
|
-
http.api({
|
|
2709
|
-
method: "get",
|
|
2710
|
-
url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
|
|
2711
|
-
}),
|
|
2712
|
-
http.api({
|
|
2713
|
-
method: "get",
|
|
2714
|
-
url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
|
|
2715
|
-
}),
|
|
2716
|
-
http.api({
|
|
2717
|
-
method: "get",
|
|
2718
|
-
url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
|
|
2719
|
-
params: {
|
|
2720
|
-
type: "all",
|
|
2721
|
-
is_yesterday: false,
|
|
2722
|
-
start_day: yesterday,
|
|
2723
|
-
end_day: yesterday,
|
|
2724
|
-
stat: 0
|
|
2725
|
-
}
|
|
2726
|
-
})
|
|
2727
|
-
]);
|
|
2728
|
-
const bjhData = {
|
|
2729
|
-
fansNum: fansData.data.coreData.fansCount,
|
|
2730
|
-
fansNumYesterday: -1 == yesterdayData.data.data.fans_increase ? null : yesterdayData.data.data.fans_increase,
|
|
2731
|
-
readNum: readData.data.total.view_count,
|
|
2732
|
-
incomeNum: incomeData.data.all_income.total_income,
|
|
2733
|
-
incomeNumYesterday: -1 == incomeData.data.all_income.yesterday_income ? null : incomeData.data.all_income.yesterday_income,
|
|
2734
|
-
recommendNumYesterday: -1 == yesterdayData.data.data.recommend_count ? null : yesterdayData.data.data.recommend_count,
|
|
2735
|
-
readNumYesterday: -1 == yesterdayData.data.data.view_count ? null : yesterdayData.data.data.view_count,
|
|
2736
|
-
likeNumYesterday: -1 == yesterdayData.data.data.likes_count ? null : yesterdayData.data.data.likes_count,
|
|
2737
|
-
commentNumYesterday: -1 == yesterdayData.data.data.comment_count ? null : yesterdayData.data.data.comment_count
|
|
2738
|
-
};
|
|
2739
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(bjhData, "百家号平台数据获取成功!");
|
|
2740
|
-
} catch (error) {
|
|
2741
|
-
return types_errorResponse(error instanceof Error ? error.message : "百家号平台数据获取失败");
|
|
2742
|
-
}
|
|
2743
|
-
}
|
|
2744
|
-
async function getToutiaoData(params) {
|
|
2745
|
-
const { cookies } = params;
|
|
2746
|
-
try {
|
|
2747
|
-
const http = new Http({
|
|
2748
|
-
headers: {
|
|
2749
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2750
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2751
|
-
}
|
|
2752
|
-
});
|
|
2753
|
-
const [totalData, contentDataYesterday] = await Promise.all([
|
|
2754
|
-
http.api({
|
|
2755
|
-
method: "get",
|
|
2756
|
-
url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
|
|
2757
|
-
params: {
|
|
2758
|
-
app_id: 1231
|
|
2759
|
-
}
|
|
2760
|
-
}),
|
|
2761
|
-
http.api({
|
|
2762
|
-
method: "get",
|
|
2763
|
-
url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
|
|
2764
|
-
params: {
|
|
2765
|
-
type: 0,
|
|
2766
|
-
app_id: 1231
|
|
2767
|
-
}
|
|
2768
|
-
})
|
|
2769
|
-
]);
|
|
2770
|
-
const isReday = void 0 !== totalData.data.statistic.data.yesterday_read_count;
|
|
2771
|
-
const ttData = {
|
|
2772
|
-
fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
|
|
2773
|
-
fansNumYesterday: void 0 !== totalData.data.statistic.data.yesterday_fans ? Number(totalData.data.statistic.data.yesterday_fans) : null,
|
|
2774
|
-
readNum: Number(totalData.data.statistic.data.total_read_play_count),
|
|
2775
|
-
incomeNum: totalData.data.statistic.data.total_income,
|
|
2776
|
-
incomeNumYesterday: totalData.data.statistic.data.is_yesterday_income_ready ? totalData.data.statistic.data.yesterday_income : null,
|
|
2777
|
-
showNumYesterday: isReday ? contentDataYesterday.author_stat.consume_data.impression_count : null,
|
|
2778
|
-
readNumYesterday: isReday ? contentDataYesterday.author_stat.consume_data.go_detail_count : null,
|
|
2779
|
-
likeNumYesterday: isReday ? contentDataYesterday.author_stat.interaction_data.digg_count : null,
|
|
2780
|
-
commentNumYesterday: isReday ? contentDataYesterday.author_stat.interaction_data.comment_count : null
|
|
2781
|
-
};
|
|
2782
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(ttData, "头条号粉丝数据获取成功!");
|
|
2783
|
-
} catch (error) {
|
|
2784
|
-
return types_errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
|
|
2785
|
-
}
|
|
2786
|
-
}
|
|
2787
|
-
async function getWeixinData(params) {
|
|
2788
|
-
const { token } = params;
|
|
2789
|
-
if (!token) return {
|
|
2790
|
-
code: 200,
|
|
2791
|
-
message: "缺少token",
|
|
2792
|
-
data: null
|
|
2793
|
-
};
|
|
2794
|
-
try {
|
|
2795
|
-
const { token } = params;
|
|
2796
|
-
if (!token) return types_errorResponse("缺少token", 200);
|
|
2797
|
-
const http = new Http({
|
|
2798
|
-
headers: {
|
|
2799
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2800
|
-
}
|
|
2801
|
-
});
|
|
2802
|
-
const userInfo = {
|
|
2803
|
-
originalCount: 0,
|
|
2804
|
-
totalUsers: 0,
|
|
2805
|
-
userIncrease: 0,
|
|
2806
|
-
yesterday: {
|
|
2807
|
-
read: 0,
|
|
2808
|
-
share: 0,
|
|
2809
|
-
subscribe: 0
|
|
2810
|
-
}
|
|
2811
|
-
};
|
|
2812
|
-
const userInfoHtml = await http.api({
|
|
2813
|
-
method: "get",
|
|
2814
|
-
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
2815
|
-
params: {
|
|
2816
|
-
t: "home/index",
|
|
2817
|
-
token,
|
|
2818
|
-
lang: "zh_CN"
|
|
2819
|
-
}
|
|
2820
|
-
});
|
|
2821
|
-
const originalMatch = userInfoHtml.trim().match(/原创内容[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2822
|
-
if (originalMatch) userInfo.originalCount = parseInt(originalMatch[1].replace(/,/g, ''), 10);
|
|
2823
|
-
const totalUsersMatch = userInfoHtml.match(/总用户数[\s\S]*?<div[^>]*class=["']weui-desktop-user_sum["'][^>]*>[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2824
|
-
if (totalUsersMatch) userInfo.totalUsers = parseInt(totalUsersMatch[1].replace(/,/g, ''), 10);
|
|
2825
|
-
const increaseMatch = userInfoHtml.match(/weui-desktop-user_increase_num[^>]*>\s*([+-]?)\s*<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2826
|
-
if (increaseMatch) {
|
|
2827
|
-
const sign = '-' === increaseMatch[1] ? -1 : 1;
|
|
2828
|
-
userInfo.userIncrease = sign * parseInt(increaseMatch[2].replace(/,/g, ''), 10);
|
|
2829
|
-
}
|
|
2830
|
-
const readMatch = userInfoHtml.match(/昨日阅读[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2831
|
-
if (readMatch) userInfo.yesterday.read = parseInt(readMatch[1].replace(/,/g, ''), 10);
|
|
2832
|
-
const shareMatch = userInfoHtml.match(/昨日分享[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2833
|
-
if (shareMatch) userInfo.yesterday.share = parseInt(shareMatch[1].replace(/,/g, ''), 10);
|
|
2834
|
-
const subscribeMatch = userInfoHtml.match(/昨日新增关注[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2835
|
-
if (subscribeMatch) userInfo.yesterday.subscribe = parseInt(subscribeMatch[1].replace(/,/g, ''), 10);
|
|
2836
|
-
const wxData = {
|
|
2837
|
-
fansNum: userInfo.totalUsers,
|
|
2838
|
-
fansNumYesterday: userInfo.yesterday.subscribe,
|
|
2839
|
-
readNumYesterday: userInfo.yesterday.read,
|
|
2840
|
-
shareNumYesterday: userInfo.yesterday.share
|
|
2841
|
-
};
|
|
2842
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(wxData, "微信平台数据获取成功!");
|
|
2843
|
-
} catch (error) {
|
|
2844
|
-
return types_errorResponse(error instanceof Error ? error.message : "微信平台数据获取失败");
|
|
2845
|
-
}
|
|
2846
|
-
}
|
|
2847
|
-
async function getXiaohongshuData(params) {
|
|
2848
|
-
try {
|
|
2849
|
-
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
2850
|
-
if (!a1Cookie) return types_errorResponse("账号数据异常,请重新绑定账号后重试。", 200);
|
|
2851
|
-
const http = new Http({
|
|
2852
|
-
headers: {
|
|
2853
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2854
|
-
referer: "https://creator.xiaohongshu.com",
|
|
2855
|
-
origin: "https://creator.xiaohongshu.com"
|
|
2856
|
-
}
|
|
2857
|
-
});
|
|
2858
|
-
const xsEncrypt = new XsEncrypt();
|
|
2859
|
-
const xt = Date.now().toString();
|
|
2860
|
-
const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
|
|
2861
|
-
const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
|
|
2862
|
-
const [overAllData, sevenData] = await Promise.all([
|
|
2863
|
-
http.api({
|
|
2864
|
-
method: "get",
|
|
2865
|
-
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
2866
|
-
}),
|
|
2867
|
-
http.api({
|
|
2868
|
-
method: "get",
|
|
2869
|
-
baseURL: "https://creator.xiaohongshu.com",
|
|
2870
|
-
url: sevenDataUrl,
|
|
2871
|
-
headers: {
|
|
2872
|
-
"x-s": xs,
|
|
2873
|
-
"x-t": xt
|
|
2874
|
-
}
|
|
2875
|
-
})
|
|
2876
|
-
]);
|
|
2877
|
-
const xhsData = {
|
|
2878
|
-
fansNum: overAllData.data.fans_count,
|
|
2879
|
-
favedNum: overAllData.data.faved_count,
|
|
2880
|
-
watchNumLastWeek: sevenData.data.seven.view_count,
|
|
2881
|
-
likeNumLastWeek: sevenData.data.seven.like_count,
|
|
2882
|
-
collectNumLastWeek: sevenData.data.seven.collect_count,
|
|
2883
|
-
commentNumLastWeek: sevenData.data.seven.comment_count,
|
|
2884
|
-
fansNumLastWeek: sevenData.data.seven.rise_fans_count,
|
|
2885
|
-
fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
|
|
2886
|
-
};
|
|
2887
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(xhsData, "小红书平台数据获取成功!");
|
|
2888
|
-
} catch (error) {
|
|
2889
|
-
return types_errorResponse(error instanceof Error ? error.message : "小红书平台数据获取失败");
|
|
2890
|
-
}
|
|
2891
|
-
}
|
|
2892
|
-
const SearchAccountInfo = async (_task, params)=>{
|
|
2893
|
-
const { platform } = params;
|
|
2894
|
-
switch(platform){
|
|
2895
|
-
case "toutiao":
|
|
2896
|
-
return getToutiaoData(params);
|
|
2897
|
-
case "xiaohongshu":
|
|
2898
|
-
return getXiaohongshuData(params);
|
|
2899
|
-
case "weixin":
|
|
2900
|
-
return getWeixinData(params);
|
|
2901
|
-
case "baijiahao":
|
|
2902
|
-
return getBaijiahaoData(params);
|
|
2903
|
-
default:
|
|
2904
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(null, "暂不支持该平台");
|
|
2905
|
-
}
|
|
2906
|
-
};
|
|
2907
|
-
const searchPublishInfo_types_errorResponse = (message, code = 500)=>({
|
|
2908
|
-
code,
|
|
2909
|
-
message,
|
|
2910
|
-
data: null
|
|
2911
|
-
});
|
|
2912
|
-
async function handleToutiaoData(params) {
|
|
2913
|
-
try {
|
|
2914
|
-
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
2915
|
-
const http = new Http({
|
|
2916
|
-
headers: {
|
|
2917
|
-
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2918
|
-
}
|
|
2919
|
-
});
|
|
2920
|
-
const visitedUid = await http.api({
|
|
2921
|
-
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?",
|
|
2922
|
-
method: "get",
|
|
2923
|
-
params: {
|
|
2924
|
-
app_id: 1231
|
|
2925
|
-
}
|
|
2926
|
-
});
|
|
2927
|
-
const articleInfo = await http.api({
|
|
2928
|
-
method: "get",
|
|
2929
|
-
url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
|
|
2930
|
-
params: {
|
|
2931
|
-
provider_type: "mp_provider",
|
|
2932
|
-
aid: "13",
|
|
2933
|
-
app_name: "news_article",
|
|
2934
|
-
category: "mp_all",
|
|
2935
|
-
channel: "",
|
|
2936
|
-
stream_api_version: "88",
|
|
2937
|
-
genre_type_switch: '{"repost":1,"small_video":1,"toutiao_graphic":1,"weitoutiao":1,"xigua_video":1}',
|
|
2938
|
-
device_platform: "pc",
|
|
2939
|
-
platform_id: "0",
|
|
2940
|
-
visited_uid: visitedUid.user_id_str,
|
|
2941
|
-
offset: (pageNum - 1) * pageSize,
|
|
2942
|
-
count: pageSize,
|
|
2943
|
-
keyword: "",
|
|
2944
|
-
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"}`,
|
|
2945
|
-
app_id: "1231"
|
|
2946
|
-
}
|
|
2947
|
-
});
|
|
2948
|
-
const articleCell = articleInfo.data.map((item)=>({
|
|
2949
|
-
title: item.assembleCell.itemCell.articleBase.title,
|
|
2950
|
-
imageUrl: item.assembleCell.itemCell.imageList.staggerFeedCover[0].url,
|
|
2951
|
-
createTime: item.assembleCell.itemCell.articleBase.publishTime,
|
|
2952
|
-
redirectUrl: item.assembleCell.itemCell.articleBase.articleURL,
|
|
2953
|
-
showNum: item.assembleCell.itemCell.itemCounter.showCount,
|
|
2954
|
-
readNum: item.assembleCell.itemCell.itemCounter.readCount,
|
|
2955
|
-
likeNum: item.assembleCell.itemCell.itemCounter.diggCount,
|
|
2956
|
-
commentNum: item.assembleCell.itemCell.itemCounter.commentCount,
|
|
2957
|
-
...showOriginalData ? {
|
|
2958
|
-
originalData: item
|
|
2959
|
-
} : {}
|
|
2960
|
-
}));
|
|
2961
|
-
const api_base_info_json = JSON.parse(articleInfo.api_base_info.app_extra_params);
|
|
2962
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2963
|
-
articleCell,
|
|
2964
|
-
...onlySuccess ? {
|
|
2965
|
-
pagination: {
|
|
2966
|
-
total: api_base_info_json.total_count || -1,
|
|
2967
|
-
pageNum,
|
|
2968
|
-
pageSize
|
|
2969
|
-
}
|
|
2970
|
-
} : null
|
|
2971
|
-
}, "头条号文章文章获取成功");
|
|
2972
|
-
} catch (error) {
|
|
2973
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
|
|
2974
|
-
}
|
|
2975
|
-
}
|
|
2976
|
-
async function handleWeixinData(params) {
|
|
2977
|
-
try {
|
|
2978
|
-
const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, cursor, lastPage } = params;
|
|
2979
|
-
if (!token) return {
|
|
2980
|
-
code: 200,
|
|
2981
|
-
message: "缺少token",
|
|
2982
|
-
data: null
|
|
2983
|
-
};
|
|
2984
|
-
const http = new Http({
|
|
2985
|
-
headers: {
|
|
2986
|
-
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2987
|
-
}
|
|
2988
|
-
});
|
|
2989
|
-
const ParsePublishPage = (body)=>{
|
|
2990
|
-
const match = body.match(/publish_page\s*=\s*({[\s\S]*?});/);
|
|
2991
|
-
if (!match) throw new Error('无法提取 publish_page 字段');
|
|
2992
|
-
let parsedData = JSON.parse(match[1]);
|
|
2993
|
-
const decodeEntities = function(str, decode = false) {
|
|
2994
|
-
const encodeMap = [
|
|
2995
|
-
"&",
|
|
2996
|
-
"&",
|
|
2997
|
-
"<",
|
|
2998
|
-
"<",
|
|
2999
|
-
">",
|
|
3000
|
-
">",
|
|
3001
|
-
" ",
|
|
3002
|
-
" ",
|
|
3003
|
-
'"',
|
|
3004
|
-
""",
|
|
3005
|
-
"'",
|
|
3006
|
-
"'"
|
|
3007
|
-
];
|
|
3008
|
-
const decodeMap = [
|
|
3009
|
-
"'",
|
|
3010
|
-
"'",
|
|
3011
|
-
""",
|
|
3012
|
-
'"',
|
|
3013
|
-
" ",
|
|
3014
|
-
" ",
|
|
3015
|
-
">",
|
|
3016
|
-
">",
|
|
3017
|
-
"<",
|
|
3018
|
-
"<",
|
|
3019
|
-
"&",
|
|
3020
|
-
"&",
|
|
3021
|
-
"<",
|
|
3022
|
-
"<",
|
|
3023
|
-
">",
|
|
3024
|
-
">"
|
|
3025
|
-
];
|
|
3026
|
-
const map = decode ? decodeMap : encodeMap;
|
|
3027
|
-
let result = str;
|
|
3028
|
-
for(let i = 0; i < map.length; i += 2)result = result.replace(new RegExp(map[i], "g"), map[i + 1]);
|
|
3029
|
-
return result;
|
|
3030
|
-
};
|
|
3031
|
-
const finalData = {
|
|
3032
|
-
...parsedData,
|
|
3033
|
-
publish_list: parsedData.publish_list.map((item)=>{
|
|
3034
|
-
const decoded = decodeEntities(item.publish_info, true);
|
|
3035
|
-
const parsedInfo = JSON.parse(decoded);
|
|
3036
|
-
return {
|
|
3037
|
-
publish_type: item.publish_type,
|
|
3038
|
-
publish_info: parsedInfo
|
|
3039
|
-
};
|
|
3040
|
-
})
|
|
3041
|
-
};
|
|
3042
|
-
return finalData;
|
|
3043
|
-
};
|
|
3044
|
-
async function fetchArticles(begin, pageSize, token) {
|
|
3045
|
-
return http.api({
|
|
3046
|
-
method: "get",
|
|
3047
|
-
url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish',
|
|
3048
|
-
params: {
|
|
3049
|
-
sub: "list",
|
|
3050
|
-
begin: begin,
|
|
3051
|
-
count: pageSize,
|
|
3052
|
-
token: token,
|
|
3053
|
-
lang: "zh_CN"
|
|
3054
|
-
}
|
|
3055
|
-
});
|
|
3056
|
-
}
|
|
3057
|
-
let size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
|
|
3058
|
-
let begin = (lastPage ?? pageNum) - 1;
|
|
3059
|
-
let rawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
3060
|
-
let articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
3061
|
-
let articleCell = [];
|
|
3062
|
-
if (!onlySuccess && pageSize > 20) {
|
|
3063
|
-
let totalFetched = articlesInfo.publish_list.length;
|
|
3064
|
-
let nextPage = pageNum + 1;
|
|
3065
|
-
while(totalFetched < pageSize){
|
|
3066
|
-
const remaining = pageSize - totalFetched;
|
|
3067
|
-
const currentPageSize = remaining > 20 ? 20 : remaining;
|
|
3068
|
-
let _rawArticlesInfo = await fetchArticles((nextPage - 1) * 20, currentPageSize, token);
|
|
3069
|
-
let parsed = ParsePublishPage(_rawArticlesInfo);
|
|
3070
|
-
articlesInfo.publish_list = articlesInfo.publish_list.concat(parsed.publish_list);
|
|
3071
|
-
totalFetched = articlesInfo.publish_list.length;
|
|
3072
|
-
if (parsed.publish_list.length < currentPageSize) break;
|
|
3073
|
-
nextPage++;
|
|
3074
|
-
}
|
|
3075
|
-
articleCell = articlesInfo.publish_list.map((item)=>({
|
|
3076
|
-
title: item.publish_info.appmsg_info[0].title,
|
|
3077
|
-
imageUrl: item.publish_info.appmsg_info[0].cover,
|
|
3078
|
-
createTime: item.publish_info.appmsg_info[0].line_info.send_time,
|
|
3079
|
-
redirectUrl: item.publish_info.appmsg_info[0].content_url,
|
|
3080
|
-
readNum: item.publish_info.appmsg_info[0].read_num,
|
|
3081
|
-
likeNum: item.publish_info.appmsg_info[0].old_like_num,
|
|
3082
|
-
shareNum: item.publish_info.appmsg_info[0].share_num,
|
|
3083
|
-
recommendNum: item.publish_info.appmsg_info[0].like_num,
|
|
3084
|
-
...showOriginalData ? {
|
|
3085
|
-
originalData: item
|
|
3086
|
-
} : {}
|
|
3087
|
-
}));
|
|
3088
|
-
}
|
|
3089
|
-
let nextPage = false;
|
|
3090
|
-
if (onlySuccess) {
|
|
3091
|
-
let filteredList = articlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
|
|
3092
|
-
if (cursor) {
|
|
3093
|
-
const cursorIndex = filteredList.findIndex((item)=>item.msgid === cursor);
|
|
3094
|
-
if (-1 !== cursorIndex) filteredList = filteredList.slice(cursorIndex + 1);
|
|
3095
|
-
}
|
|
3096
|
-
let totalFetched = filteredList.length;
|
|
3097
|
-
while(totalFetched < pageSize && begin * size < articlesInfo.total_count){
|
|
3098
|
-
begin += 1;
|
|
3099
|
-
let nextRawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
3100
|
-
let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
|
|
3101
|
-
const newFiltered = nextArticlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
|
|
3102
|
-
filteredList = filteredList.concat(newFiltered);
|
|
3103
|
-
totalFetched = filteredList.length;
|
|
3104
|
-
}
|
|
3105
|
-
filteredList = filteredList.slice(0, pageSize);
|
|
3106
|
-
totalFetched = filteredList.length;
|
|
3107
|
-
if (totalFetched >= pageSize && begin * size < articlesInfo.total_count) {
|
|
3108
|
-
let nextRawArticlesInfo = await fetchArticles((begin + 1) * size, size, token);
|
|
3109
|
-
let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
|
|
3110
|
-
nextPage = nextArticlesInfo.publish_list.length > 0 && nextArticlesInfo.publish_list.some((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey"));
|
|
3111
|
-
}
|
|
3112
|
-
const lastMsgId = filteredList.length > 0 ? filteredList[filteredList.length - 1].msgid : void 0;
|
|
3113
|
-
articleCell = filteredList.map((item)=>({
|
|
3114
|
-
title: item.appmsg_info[0].title,
|
|
3115
|
-
imageUrl: item.appmsg_info[0].cover,
|
|
3116
|
-
createTime: item.appmsg_info[0].line_info.send_time,
|
|
3117
|
-
redirectUrl: item.appmsg_info[0].content_url,
|
|
3118
|
-
readNum: item.appmsg_info[0].read_num,
|
|
3119
|
-
likeNum: item.appmsg_info[0].old_like_num,
|
|
3120
|
-
shareNum: item.appmsg_info[0].share_num,
|
|
3121
|
-
recommendNum: item.appmsg_info[0].like_num,
|
|
3122
|
-
...showOriginalData ? {
|
|
3123
|
-
originalData: item
|
|
3124
|
-
} : {}
|
|
3125
|
-
}));
|
|
3126
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
3127
|
-
articleCell,
|
|
3128
|
-
pagination: {
|
|
3129
|
-
nextPage,
|
|
3130
|
-
pageNum,
|
|
3131
|
-
pageSize,
|
|
3132
|
-
lastPage: begin + 1,
|
|
3133
|
-
cursor: lastMsgId
|
|
3134
|
-
}
|
|
3135
|
-
}, "微信文章文章获取成功");
|
|
3136
|
-
}
|
|
3137
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
3138
|
-
articleCell
|
|
3139
|
-
}, "微信文章文章获取成功");
|
|
3140
|
-
} catch (error) {
|
|
3141
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
|
|
3142
|
-
}
|
|
3143
|
-
}
|
|
3144
|
-
async function handleBaijiahaoData(params) {
|
|
3145
|
-
try {
|
|
3146
|
-
const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3147
|
-
if (!token) return {
|
|
3148
|
-
code: 200,
|
|
3149
|
-
message: "缺少token",
|
|
3150
|
-
data: null
|
|
3151
|
-
};
|
|
3152
|
-
const http = new Http({
|
|
3153
|
-
headers: {
|
|
3154
|
-
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3155
|
-
token: token
|
|
3156
|
-
}
|
|
3157
|
-
});
|
|
3158
|
-
async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
|
|
3159
|
-
return await http.api({
|
|
3160
|
-
method: "get",
|
|
3161
|
-
url: "https://baijiahao.baidu.com/pcui/article/lists",
|
|
3162
|
-
params: {
|
|
3163
|
-
currentPage: pageNum,
|
|
3164
|
-
pageSize: pageSize,
|
|
3165
|
-
search: "",
|
|
3166
|
-
type: "",
|
|
3167
|
-
collection: onlySuccess ? "publish" : "",
|
|
3168
|
-
clearBeforeFetch: false,
|
|
3169
|
-
dynamic: 1
|
|
3170
|
-
}
|
|
3171
|
-
});
|
|
3172
|
-
}
|
|
3173
|
-
const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
|
|
3174
|
-
let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
|
|
3175
|
-
const totalPage = articleInfo.data.page?.totalPage || 1;
|
|
3176
|
-
let currentPage = pageNum + 1;
|
|
3177
|
-
const usedPages = new Set();
|
|
3178
|
-
while(filtered.length < pageSize && currentPage <= totalPage){
|
|
3179
|
-
if (usedPages.has(currentPage)) {
|
|
3180
|
-
currentPage++;
|
|
3181
|
-
continue;
|
|
3182
|
-
}
|
|
3183
|
-
const res = await fetchArticles(currentPage, pageSize, onlySuccess);
|
|
3184
|
-
usedPages.add(currentPage);
|
|
3185
|
-
const validItems = res.data.list.filter((item)=>"draft" !== item.status);
|
|
3186
|
-
filtered.push(...validItems);
|
|
3187
|
-
currentPage++;
|
|
3188
|
-
}
|
|
3189
|
-
const final = filtered.slice(0, pageSize);
|
|
3190
|
-
const articleCell = final.map((item)=>({
|
|
3191
|
-
title: item.title,
|
|
3192
|
-
imageUrl: JSON.parse(item.cover_images)[0].src,
|
|
3193
|
-
createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
|
|
3194
|
-
redirectUrl: item.url,
|
|
3195
|
-
recommendNum: item.rec_amount | item.forward_num,
|
|
3196
|
-
collectNum: item.collection_amount,
|
|
3197
|
-
readNum: item.read_amount | item.read_num,
|
|
3198
|
-
likeNum: item.like_amount | item.praise_num,
|
|
3199
|
-
commentNum: item.comment_amount | item.comment_num,
|
|
3200
|
-
shareNum: item.share_amount,
|
|
3201
|
-
...showOriginalData ? {
|
|
3202
|
-
originalData: item
|
|
3203
|
-
} : {}
|
|
3204
|
-
}));
|
|
3205
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
3206
|
-
articleCell,
|
|
3207
|
-
...onlySuccess ? {
|
|
3208
|
-
pagination: {
|
|
3209
|
-
total: articleInfo.data.page?.totalCount,
|
|
3210
|
-
pageNum,
|
|
3211
|
-
pageSize
|
|
3212
|
-
}
|
|
3213
|
-
} : null
|
|
3214
|
-
}, "百家号文章数据获取成功");
|
|
3215
|
-
} catch (error) {
|
|
3216
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
|
|
3217
|
-
}
|
|
3218
|
-
}
|
|
3219
|
-
async function handleXiaohongshuData(params) {
|
|
3220
|
-
try {
|
|
3221
|
-
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3222
|
-
const xsEncrypt = new XsEncrypt();
|
|
3223
|
-
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
3224
|
-
if (!a1Cookie) return {
|
|
3225
|
-
code: 200,
|
|
3226
|
-
message: "账号数据异常",
|
|
3227
|
-
data: null
|
|
3228
|
-
};
|
|
3229
|
-
if (onlySuccess && 10 != pageSize) return {
|
|
3230
|
-
code: 200,
|
|
3231
|
-
message: "小红书pageSize不可修改",
|
|
3232
|
-
data: null
|
|
3233
|
-
};
|
|
3234
|
-
const http = new Http({
|
|
3235
|
-
headers: {
|
|
3236
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3237
|
-
referer: "https://creator.xiaohongshu.com",
|
|
3238
|
-
origin: "https://creator.xiaohongshu.com"
|
|
3239
|
-
}
|
|
3240
|
-
});
|
|
3241
|
-
async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
|
|
3242
|
-
const xt = Date.now().toString();
|
|
3243
|
-
const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
|
|
3244
|
-
const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
|
|
3245
|
-
return await http.api({
|
|
3246
|
-
method: "get",
|
|
3247
|
-
baseURL: "https://edith.xiaohongshu.com",
|
|
3248
|
-
url: serveUrl,
|
|
3249
|
-
headers: {
|
|
3250
|
-
"x-s": xs,
|
|
3251
|
-
"x-t": xt
|
|
3252
|
-
}
|
|
3253
|
-
});
|
|
3254
|
-
}
|
|
3255
|
-
const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
|
|
3256
|
-
let hasNextpage = -1 != articleInfo.data.page;
|
|
3257
|
-
let filtered = articleInfo.data.notes;
|
|
3258
|
-
let currentPage = pageNum + 1;
|
|
3259
|
-
const usedPages = new Set();
|
|
3260
|
-
while(filtered.length < pageSize && hasNextpage){
|
|
3261
|
-
if (usedPages.has(currentPage)) {
|
|
3262
|
-
currentPage++;
|
|
3263
|
-
continue;
|
|
3264
|
-
}
|
|
3265
|
-
const res = await fetchArticles(currentPage, a1Cookie, onlySuccess);
|
|
3266
|
-
usedPages.add(currentPage);
|
|
3267
|
-
const validItems = res.data.notes;
|
|
3268
|
-
filtered.push(...validItems);
|
|
3269
|
-
currentPage++;
|
|
3270
|
-
hasNextpage = -1 != res.data.page;
|
|
3271
|
-
}
|
|
3272
|
-
const final = filtered.slice(0, pageSize);
|
|
3273
|
-
const articleCell = final.map((item)=>({
|
|
3274
|
-
title: item.display_title,
|
|
3275
|
-
imageUrl: item.images_list[0].url,
|
|
3276
|
-
createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
|
|
3277
|
-
redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
|
|
3278
|
-
readNum: item.view_count,
|
|
3279
|
-
likeNum: item.likes,
|
|
3280
|
-
commentNum: item.comments_count,
|
|
3281
|
-
collectNum: item.collected_count,
|
|
3282
|
-
shareNum: item.shared_count,
|
|
3283
|
-
...showOriginalData ? {
|
|
3284
|
-
originalData: item
|
|
3285
|
-
} : {}
|
|
3286
|
-
}));
|
|
3287
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
3288
|
-
articleCell,
|
|
3289
|
-
...onlySuccess ? {
|
|
3290
|
-
pagination: {
|
|
3291
|
-
nextPage: hasNextpage,
|
|
3292
|
-
pageNum,
|
|
3293
|
-
pageSize
|
|
3294
|
-
}
|
|
3295
|
-
} : null
|
|
3296
|
-
}, "小红书文章数据获取成功");
|
|
3297
|
-
} catch (error) {
|
|
3298
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "小红书文章数据获取失败");
|
|
3299
|
-
}
|
|
3300
|
-
}
|
|
3301
|
-
const FetchArticles = async (_task, params)=>{
|
|
3302
|
-
const { platform } = params;
|
|
3303
|
-
switch(platform){
|
|
3304
|
-
case "toutiao":
|
|
3305
|
-
return handleToutiaoData(params);
|
|
3306
|
-
case "weixin":
|
|
3307
|
-
return handleWeixinData(params);
|
|
3308
|
-
case "baijiahao":
|
|
3309
|
-
return handleBaijiahaoData(params);
|
|
3310
|
-
case "xiaohongshu":
|
|
3311
|
-
return handleXiaohongshuData(params);
|
|
3312
|
-
default:
|
|
3313
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(null, "暂不支持该平台");
|
|
3314
|
-
}
|
|
3315
|
-
};
|
|
3316
|
-
const getWeixinConfig = async (_task, params)=>{
|
|
3317
|
-
const http = new Http({
|
|
3318
|
-
headers: {
|
|
3319
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
3320
|
-
}
|
|
3321
|
-
});
|
|
3322
|
-
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
3323
|
-
const res = await http.api({
|
|
3324
|
-
method: "get",
|
|
3325
|
-
url: "https://mp.weixin.qq.com/cgi-bin/masssendpage",
|
|
3326
|
-
params: {
|
|
3327
|
-
f: 'json',
|
|
3328
|
-
token: params.token,
|
|
3329
|
-
lang: 'zh_CN',
|
|
3330
|
-
ajax: 1,
|
|
3331
|
-
fingerprint: fingerprint,
|
|
3332
|
-
random: Math.random().toString()
|
|
3333
|
-
}
|
|
3334
|
-
});
|
|
3335
|
-
const filtered = {
|
|
3336
|
-
publishQuota: 0 === res.base_resp.ret ? res.quota_detail_list.filter((item)=>"kQuotaTypeMassSendNormal" === item.quota_type).map((item)=>item.quota_item_list) : []
|
|
3337
|
-
};
|
|
3338
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(filtered, 0 === res.base_resp.ret ? "微信配置信息获取成功!" : "微信配置信息获取失败!");
|
|
3339
|
-
};
|
|
3340
2566
|
const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
3341
2567
|
const tmpCachePath = task.getTmpPath();
|
|
3342
2568
|
const http = new Http({
|
|
@@ -4907,33 +4133,40 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
4907
4133
|
}
|
|
4908
4134
|
});
|
|
4909
4135
|
let uploadInfos = [];
|
|
4910
|
-
coverIdInfo.data.uploadTempPermits.
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4136
|
+
coverIdInfo.data.uploadTempPermits.forEach((item)=>{
|
|
4137
|
+
item.fileIds.forEach((fileId)=>{
|
|
4138
|
+
uploadInfos.push({
|
|
4139
|
+
bucket: item.bucket || "",
|
|
4140
|
+
uploadAddr: item.uploadAddr || "",
|
|
4141
|
+
fileIds: fileId,
|
|
4142
|
+
token: item.token || ""
|
|
4143
|
+
});
|
|
4916
4144
|
});
|
|
4917
4145
|
});
|
|
4146
|
+
if (uploadInfos.length < params.banners.length) return {
|
|
4147
|
+
code: 200,
|
|
4148
|
+
message: "可用 OSS bucket 数量不足,无法上传所有图片!",
|
|
4149
|
+
data: ""
|
|
4150
|
+
};
|
|
4918
4151
|
if (0 === uploadInfos.length) return {
|
|
4919
4152
|
code: 200,
|
|
4920
4153
|
message: "图片上传失败,请稍后重试!",
|
|
4921
4154
|
data: ""
|
|
4922
4155
|
};
|
|
4923
|
-
const
|
|
4156
|
+
const availableBuckets = Array.from({
|
|
4157
|
+
length: uploadInfos.length
|
|
4158
|
+
}, (_, i)=>i);
|
|
4159
|
+
const uploadFile = async (url, index)=>{
|
|
4924
4160
|
const fileName = (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.getFilenameFromUrl)(url);
|
|
4925
4161
|
const localUrl = await (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
|
|
4926
4162
|
const fileBuffer = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(localUrl);
|
|
4927
|
-
const
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
}
|
|
4935
|
-
const currentInfo = uploadInfos[uploadIndex];
|
|
4936
|
-
const ossFileId = currentInfo.fileIds[0];
|
|
4163
|
+
const MAX_RETRIES = uploadInfos.length;
|
|
4164
|
+
let attempt = 0;
|
|
4165
|
+
while(attempt < MAX_RETRIES){
|
|
4166
|
+
const ossBucketIndex = availableBuckets.shift();
|
|
4167
|
+
if (void 0 === ossBucketIndex) break;
|
|
4168
|
+
const currentInfo = uploadInfos[ossBucketIndex];
|
|
4169
|
+
const ossFileId = currentInfo.fileIds;
|
|
4937
4170
|
const ossToken = currentInfo.token;
|
|
4938
4171
|
const ossDomain = currentInfo.uploadAddr;
|
|
4939
4172
|
try {
|
|
@@ -4951,10 +4184,13 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
4951
4184
|
ossToken
|
|
4952
4185
|
};
|
|
4953
4186
|
} catch (error) {
|
|
4954
|
-
|
|
4187
|
+
attempt++;
|
|
4955
4188
|
}
|
|
4189
|
+
}
|
|
4190
|
+
return {
|
|
4191
|
+
ossFileId: "",
|
|
4192
|
+
ossToken: ""
|
|
4956
4193
|
};
|
|
4957
|
-
return tryUpload(infoIndex);
|
|
4958
4194
|
};
|
|
4959
4195
|
const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
|
|
4960
4196
|
const invalidUpload = coverInfos.find((it)=>"" === it.ossToken || "" == it.ossFileId);
|
|
@@ -5299,7 +4535,9 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
5299
4535
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
5300
4536
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
5301
4537
|
};
|
|
5302
|
-
var package_namespaceObject =
|
|
4538
|
+
var package_namespaceObject = {
|
|
4539
|
+
i8: "1.2.15"
|
|
4540
|
+
};
|
|
5303
4541
|
class Action {
|
|
5304
4542
|
constructor(task){
|
|
5305
4543
|
this.task = task;
|
|
@@ -5320,24 +4558,6 @@ class Action {
|
|
|
5320
4558
|
} else this.task.logger.info(`${func.name} action success`);
|
|
5321
4559
|
return responseData;
|
|
5322
4560
|
}
|
|
5323
|
-
FetchArticles(params) {
|
|
5324
|
-
return this.bindTask(FetchArticles, params);
|
|
5325
|
-
}
|
|
5326
|
-
SearchAccountInfo(params) {
|
|
5327
|
-
return this.bindTask(SearchAccountInfo, params);
|
|
5328
|
-
}
|
|
5329
|
-
TTSessionCheck(params) {
|
|
5330
|
-
return this.bindTask(TTSessionCheck, params);
|
|
5331
|
-
}
|
|
5332
|
-
WxSessionCheck(params) {
|
|
5333
|
-
return this.bindTask(WxSessionCheck, params);
|
|
5334
|
-
}
|
|
5335
|
-
XhsSessionCheck(params) {
|
|
5336
|
-
return this.bindTask(XhsSessionCheck, params);
|
|
5337
|
-
}
|
|
5338
|
-
BjhSessionCheck(params) {
|
|
5339
|
-
return this.bindTask(BjhSessionCheck, params);
|
|
5340
|
-
}
|
|
5341
4561
|
searchToutiaoTopicList(params) {
|
|
5342
4562
|
return this.bindTask(searchToutiaoTopicList, params);
|
|
5343
4563
|
}
|
|
@@ -5362,9 +4582,6 @@ class Action {
|
|
|
5362
4582
|
getToutiaoConfig(params) {
|
|
5363
4583
|
return this.bindTask(getToutiaoConfig, params);
|
|
5364
4584
|
}
|
|
5365
|
-
getWeixinConfig(params) {
|
|
5366
|
-
return this.bindTask(getWeixinConfig, params);
|
|
5367
|
-
}
|
|
5368
4585
|
getBaijiahaoConfig(params) {
|
|
5369
4586
|
return this.bindTask(getBaijiahaoConfig, params);
|
|
5370
4587
|
}
|