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