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