@iflyrpa/actions 1.2.14-beta.6 → 1.2.15
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/actions/xiaohongshuPublish/mock.d.ts +1 -1
- package/dist/bundle.js +135 -842
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +6 -15
- package/dist/index.js +133 -840
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +130 -837
- 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 -13
- package/dist/actions/searchPublishInfo/types.d.ts +0 -50
package/dist/index.mjs
CHANGED
|
@@ -1811,20 +1811,12 @@ const getBaijiahaoConfig = async (_task, params)=>{
|
|
|
1811
1811
|
type: "news"
|
|
1812
1812
|
}
|
|
1813
1813
|
});
|
|
1814
|
-
|
|
1814
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(res?.data?.article.activity_list.map((_item)=>({
|
|
1815
1815
|
id: _item.id,
|
|
1816
1816
|
name: _item.name,
|
|
1817
1817
|
detail: _item.detail,
|
|
1818
1818
|
is_enable: _item.is_enable
|
|
1819
|
-
})) ?? [];
|
|
1820
|
-
data.push({
|
|
1821
|
-
id: "bjh_publish_num_left",
|
|
1822
|
-
name: "账号剩余发文数",
|
|
1823
|
-
detail: "",
|
|
1824
|
-
is_enable: 1,
|
|
1825
|
-
publish_num_left: res.data.ability.publish_num_left
|
|
1826
|
-
});
|
|
1827
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(data, "获取百家号配置项成功!");
|
|
1819
|
+
})) ?? [], "获取头条发布配置项成功");
|
|
1828
1820
|
};
|
|
1829
1821
|
const searchToutiaoTopicList = async (_task, params)=>{
|
|
1830
1822
|
const http = new Http({
|
|
@@ -1941,6 +1933,57 @@ const searchXiaohongshuLocation = async (_task, params)=>{
|
|
|
1941
1933
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
|
|
1942
1934
|
}
|
|
1943
1935
|
};
|
|
1936
|
+
class XsEncrypt {
|
|
1937
|
+
async encryptMD5(url) {
|
|
1938
|
+
return __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createHash("md5").update(url, "utf8").digest("hex");
|
|
1939
|
+
}
|
|
1940
|
+
async encryptText(text) {
|
|
1941
|
+
const textEncoded = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(text).toString("base64");
|
|
1942
|
+
const cipher = __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
|
|
1943
|
+
const ciphertext = cipher.update(textEncoded, "utf8", "base64");
|
|
1944
|
+
return ciphertext + cipher.final("base64");
|
|
1945
|
+
}
|
|
1946
|
+
async base64ToHex(encodedData) {
|
|
1947
|
+
const decodedData = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(encodedData, "base64");
|
|
1948
|
+
return decodedData.toString("hex");
|
|
1949
|
+
}
|
|
1950
|
+
async encryptPayload(payload, platform) {
|
|
1951
|
+
const hexPayload = await this.base64ToHex(payload);
|
|
1952
|
+
const obj = {
|
|
1953
|
+
signSvn: "56",
|
|
1954
|
+
signType: "x2",
|
|
1955
|
+
appID: platform,
|
|
1956
|
+
signVersion: "1",
|
|
1957
|
+
payload: hexPayload
|
|
1958
|
+
};
|
|
1959
|
+
const jsonString = JSON.stringify(obj, null, 0);
|
|
1960
|
+
return __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(jsonString).toString("base64");
|
|
1961
|
+
}
|
|
1962
|
+
async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
|
|
1963
|
+
const text = `x1=${await this.encryptMD5(`url=${url}`)};x2=0|0|0|1|0|0|1|0|0|0|1|0|0|0|0|1|0|0|0;x3=${a1};x4=${ts};`;
|
|
1964
|
+
return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
|
|
1965
|
+
}
|
|
1966
|
+
dumps(...rest) {
|
|
1967
|
+
const [data, replacer = null, space = 0] = rest;
|
|
1968
|
+
return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
|
|
1969
|
+
}
|
|
1970
|
+
constructor(){
|
|
1971
|
+
this.words = [
|
|
1972
|
+
929260340,
|
|
1973
|
+
1633971297,
|
|
1974
|
+
895580464,
|
|
1975
|
+
925905270
|
|
1976
|
+
];
|
|
1977
|
+
this.keyBytes = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.concat(this.words.map((word)=>new Uint8Array(__WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from([
|
|
1978
|
+
word >> 24 & 0xff,
|
|
1979
|
+
word >> 16 & 0xff,
|
|
1980
|
+
word >> 8 & 0xff,
|
|
1981
|
+
0xff & word
|
|
1982
|
+
]))));
|
|
1983
|
+
this.iv = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from("4uzjr7mbsibcaldp", "utf8");
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
const xsEncrypt = new XsEncrypt();
|
|
1944
1987
|
const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
1945
1988
|
const http = new Http({
|
|
1946
1989
|
headers: {
|
|
@@ -1949,20 +1992,35 @@ const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
|
1949
1992
|
origin: "https://creator.xiaohongshu.com"
|
|
1950
1993
|
}
|
|
1951
1994
|
});
|
|
1995
|
+
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
1996
|
+
if (!a1Cookie) return {
|
|
1997
|
+
code: 200,
|
|
1998
|
+
message: "账号数据异常,请重新绑定账号后重试。",
|
|
1999
|
+
data: []
|
|
2000
|
+
};
|
|
1952
2001
|
try {
|
|
2002
|
+
const xt = Date.now().toString();
|
|
2003
|
+
const topicData = {
|
|
2004
|
+
keyword: params.searchValue,
|
|
2005
|
+
suggest_topic_request: {
|
|
2006
|
+
title: "",
|
|
2007
|
+
desc: `#${params.searchValue}`
|
|
2008
|
+
},
|
|
2009
|
+
page: {
|
|
2010
|
+
page_size: 20,
|
|
2011
|
+
page: 1
|
|
2012
|
+
}
|
|
2013
|
+
};
|
|
2014
|
+
const topicDataStr = xsEncrypt.dumps(topicData);
|
|
2015
|
+
const fatchTopic = `/web_api/sns/v1/search/topic${topicDataStr}`;
|
|
2016
|
+
const xs = await xsEncrypt.encryptXs(fatchTopic, a1Cookie, xt);
|
|
1953
2017
|
const result = await http.api({
|
|
1954
2018
|
method: "post",
|
|
1955
2019
|
url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
|
|
1956
|
-
data:
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
desc: `#${params.searchValue}`
|
|
1961
|
-
},
|
|
1962
|
-
page: {
|
|
1963
|
-
page_size: 20,
|
|
1964
|
-
page: 1
|
|
1965
|
-
}
|
|
2020
|
+
data: topicData,
|
|
2021
|
+
headers: {
|
|
2022
|
+
"x-s": xs,
|
|
2023
|
+
"x-t": xt
|
|
1966
2024
|
},
|
|
1967
2025
|
defaultErrorMsg: "话题搜索异常,请稍后重试。"
|
|
1968
2026
|
});
|
|
@@ -2505,783 +2563,6 @@ const BjhFansExport = async (_task, params)=>{
|
|
|
2505
2563
|
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2506
2564
|
}
|
|
2507
2565
|
};
|
|
2508
|
-
const TTSessionCheck = async (_task, params)=>{
|
|
2509
|
-
const http = new Http({
|
|
2510
|
-
headers: {
|
|
2511
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2512
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2513
|
-
}
|
|
2514
|
-
});
|
|
2515
|
-
try {
|
|
2516
|
-
const res = await http.api({
|
|
2517
|
-
method: "get",
|
|
2518
|
-
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info",
|
|
2519
|
-
defaultErrorMsg: `头条号登录状态失效。`
|
|
2520
|
-
});
|
|
2521
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.code ? {
|
|
2522
|
-
isValidSession: true
|
|
2523
|
-
} : {
|
|
2524
|
-
isValidSession: false
|
|
2525
|
-
}, "头条账号有效性检测完成!");
|
|
2526
|
-
} catch (error) {
|
|
2527
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2528
|
-
isValidSession: false
|
|
2529
|
-
}, "头条账号有效性检测失败!");
|
|
2530
|
-
}
|
|
2531
|
-
};
|
|
2532
|
-
const WxSessionCheck = async (_task, params)=>{
|
|
2533
|
-
const http = new Http({
|
|
2534
|
-
headers: {
|
|
2535
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2536
|
-
}
|
|
2537
|
-
});
|
|
2538
|
-
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
2539
|
-
try {
|
|
2540
|
-
const res = await http.api({
|
|
2541
|
-
method: "get",
|
|
2542
|
-
url: "https://mp.weixin.qq.com/cgi-bin/appmsgpublish",
|
|
2543
|
-
params: {
|
|
2544
|
-
fingerprint,
|
|
2545
|
-
sub: "list",
|
|
2546
|
-
begin: 0,
|
|
2547
|
-
count: 10,
|
|
2548
|
-
query: "",
|
|
2549
|
-
type: 1011102103,
|
|
2550
|
-
show_type: "",
|
|
2551
|
-
free_publish_type: 1102103,
|
|
2552
|
-
sub_action: "list_ex",
|
|
2553
|
-
search_card: 0,
|
|
2554
|
-
token: params.token,
|
|
2555
|
-
lang: "zh_CN",
|
|
2556
|
-
f: "json",
|
|
2557
|
-
ajax: 1
|
|
2558
|
-
}
|
|
2559
|
-
});
|
|
2560
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.base_resp.ret ? {
|
|
2561
|
-
isValidSession: true
|
|
2562
|
-
} : {
|
|
2563
|
-
isValidSession: false
|
|
2564
|
-
}, "微信账号有效性检测完成!");
|
|
2565
|
-
} catch (error) {
|
|
2566
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2567
|
-
isValidSession: false
|
|
2568
|
-
}, "微信账号有效性检测失败!");
|
|
2569
|
-
}
|
|
2570
|
-
};
|
|
2571
|
-
const XhsSessionCheck = async (_task, params)=>{
|
|
2572
|
-
const http = new Http({
|
|
2573
|
-
headers: {
|
|
2574
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2575
|
-
referer: "https://creator.xiaohongshu.com/new/home?source=official"
|
|
2576
|
-
}
|
|
2577
|
-
});
|
|
2578
|
-
try {
|
|
2579
|
-
const res = await http.api({
|
|
2580
|
-
method: "get",
|
|
2581
|
-
url: "https://creator.xiaohongshu.com/api/galaxy/user/info"
|
|
2582
|
-
});
|
|
2583
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.result ? {
|
|
2584
|
-
isValidSession: true
|
|
2585
|
-
} : {
|
|
2586
|
-
isValidSession: false
|
|
2587
|
-
}, "小红书账号有效性检测完成!");
|
|
2588
|
-
} catch (error) {
|
|
2589
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2590
|
-
isValidSession: false
|
|
2591
|
-
}, "小红书账号有效性检测完成!");
|
|
2592
|
-
}
|
|
2593
|
-
};
|
|
2594
|
-
const BjhSessionCheck = async (_task, params)=>{
|
|
2595
|
-
const http = new Http({
|
|
2596
|
-
headers: {
|
|
2597
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2598
|
-
referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
2599
|
-
}
|
|
2600
|
-
});
|
|
2601
|
-
try {
|
|
2602
|
-
const res = await http.api({
|
|
2603
|
-
method: "get",
|
|
2604
|
-
url: "https://baijiahao.baidu.com/pcui/home/index",
|
|
2605
|
-
defaultErrorMsg: `百家号登录状态失效。`
|
|
2606
|
-
});
|
|
2607
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.errno ? {
|
|
2608
|
-
isValidSession: true
|
|
2609
|
-
} : {
|
|
2610
|
-
isValidSession: false
|
|
2611
|
-
}, "百家号账号有效性检测完成!");
|
|
2612
|
-
} catch (error) {
|
|
2613
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2614
|
-
isValidSession: false
|
|
2615
|
-
}, "百家号账号有效性检测失败!");
|
|
2616
|
-
}
|
|
2617
|
-
};
|
|
2618
|
-
const types_errorResponse = (message, code = 500)=>({
|
|
2619
|
-
code,
|
|
2620
|
-
message,
|
|
2621
|
-
data: null
|
|
2622
|
-
});
|
|
2623
|
-
async function getBaijiahaoData(params) {
|
|
2624
|
-
try {
|
|
2625
|
-
const { token } = params;
|
|
2626
|
-
if (!token) return types_errorResponse("缺少token", 200);
|
|
2627
|
-
const http = new Http({
|
|
2628
|
-
headers: {
|
|
2629
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2630
|
-
token: String(token),
|
|
2631
|
-
Referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
2632
|
-
}
|
|
2633
|
-
});
|
|
2634
|
-
const yesterday = TimeFormatter.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
|
|
2635
|
-
const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
|
|
2636
|
-
http.api({
|
|
2637
|
-
method: "get",
|
|
2638
|
-
url: "https://baijiahao.baidu.com/pcui/home/index"
|
|
2639
|
-
}),
|
|
2640
|
-
http.api({
|
|
2641
|
-
method: "get",
|
|
2642
|
-
url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
|
|
2643
|
-
}),
|
|
2644
|
-
http.api({
|
|
2645
|
-
method: "get",
|
|
2646
|
-
url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
|
|
2647
|
-
}),
|
|
2648
|
-
http.api({
|
|
2649
|
-
method: "get",
|
|
2650
|
-
url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
|
|
2651
|
-
params: {
|
|
2652
|
-
type: "all",
|
|
2653
|
-
is_yesterday: false,
|
|
2654
|
-
start_day: yesterday,
|
|
2655
|
-
end_day: yesterday,
|
|
2656
|
-
stat: 0
|
|
2657
|
-
}
|
|
2658
|
-
})
|
|
2659
|
-
]);
|
|
2660
|
-
const bjhData = {
|
|
2661
|
-
fansNum: fansData.data.coreData.fansCount,
|
|
2662
|
-
fansNumYesterday: -1 == yesterdayData.data.data.fans_increase ? null : yesterdayData.data.data.fans_increase,
|
|
2663
|
-
readNum: readData.data.total.view_count,
|
|
2664
|
-
incomeNum: incomeData.data.all_income.total_income,
|
|
2665
|
-
incomeNumYesterday: -1 == incomeData.data.all_income.yesterday_income ? null : incomeData.data.all_income.yesterday_income,
|
|
2666
|
-
recommendNumYesterday: -1 == yesterdayData.data.data.recommend_count ? null : yesterdayData.data.data.recommend_count,
|
|
2667
|
-
readNumYesterday: -1 == yesterdayData.data.data.view_count ? null : yesterdayData.data.data.view_count,
|
|
2668
|
-
likeNumYesterday: -1 == yesterdayData.data.data.likes_count ? null : yesterdayData.data.data.likes_count,
|
|
2669
|
-
commentNumYesterday: -1 == yesterdayData.data.data.comment_count ? null : yesterdayData.data.data.comment_count
|
|
2670
|
-
};
|
|
2671
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(bjhData, "百家号平台数据获取成功!");
|
|
2672
|
-
} catch (error) {
|
|
2673
|
-
return types_errorResponse(error instanceof Error ? error.message : "百家号平台数据获取失败");
|
|
2674
|
-
}
|
|
2675
|
-
}
|
|
2676
|
-
async function getToutiaoData(params) {
|
|
2677
|
-
const { cookies } = params;
|
|
2678
|
-
try {
|
|
2679
|
-
const http = new Http({
|
|
2680
|
-
headers: {
|
|
2681
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2682
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2683
|
-
}
|
|
2684
|
-
});
|
|
2685
|
-
const [totalData, fansDataYesterday, contentDataYesterday] = await Promise.all([
|
|
2686
|
-
http.api({
|
|
2687
|
-
method: "get",
|
|
2688
|
-
url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
|
|
2689
|
-
params: {
|
|
2690
|
-
app_id: 1231
|
|
2691
|
-
}
|
|
2692
|
-
}),
|
|
2693
|
-
http.api({
|
|
2694
|
-
method: "get",
|
|
2695
|
-
url: "https://mp.toutiao.com/mp/agw/statistic/v2/fans/latest_stat",
|
|
2696
|
-
params: {
|
|
2697
|
-
app_id: 1231
|
|
2698
|
-
}
|
|
2699
|
-
}),
|
|
2700
|
-
http.api({
|
|
2701
|
-
method: "get",
|
|
2702
|
-
url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
|
|
2703
|
-
params: {
|
|
2704
|
-
type: 0,
|
|
2705
|
-
app_id: 1231
|
|
2706
|
-
}
|
|
2707
|
-
})
|
|
2708
|
-
]);
|
|
2709
|
-
const ttData = {
|
|
2710
|
-
fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
|
|
2711
|
-
fansNumYesterday: fansDataYesterday.fans_stat.change_count,
|
|
2712
|
-
readNum: Number(totalData.data.statistic.data.total_read_play_count),
|
|
2713
|
-
incomeNum: totalData.data.statistic.data.total_income,
|
|
2714
|
-
incomeNumYesterday: totalData.data.statistic.data.yesterday_income,
|
|
2715
|
-
showNumYesterday: contentDataYesterday.author_stat.consume_data.impression_count,
|
|
2716
|
-
readNumYesterday: contentDataYesterday.author_stat.consume_data.go_detail_count,
|
|
2717
|
-
likeNumYesterday: contentDataYesterday.author_stat.interaction_data.digg_count,
|
|
2718
|
-
commentNumYesterday: contentDataYesterday.author_stat.interaction_data.comment_count
|
|
2719
|
-
};
|
|
2720
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(ttData, "头条号粉丝数据获取成功!");
|
|
2721
|
-
} catch (error) {
|
|
2722
|
-
return types_errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
|
|
2723
|
-
}
|
|
2724
|
-
}
|
|
2725
|
-
async function getWeixinData(params) {
|
|
2726
|
-
const { token } = params;
|
|
2727
|
-
if (!token) return {
|
|
2728
|
-
code: 200,
|
|
2729
|
-
message: "缺少token",
|
|
2730
|
-
data: null
|
|
2731
|
-
};
|
|
2732
|
-
try {
|
|
2733
|
-
const { token } = params;
|
|
2734
|
-
if (!token) return types_errorResponse("缺少token", 200);
|
|
2735
|
-
const http = new Http({
|
|
2736
|
-
headers: {
|
|
2737
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2738
|
-
}
|
|
2739
|
-
});
|
|
2740
|
-
const userInfo = {
|
|
2741
|
-
originalCount: 0,
|
|
2742
|
-
totalUsers: 0,
|
|
2743
|
-
userIncrease: 0,
|
|
2744
|
-
yesterday: {
|
|
2745
|
-
read: 0,
|
|
2746
|
-
share: 0,
|
|
2747
|
-
subscribe: 0
|
|
2748
|
-
}
|
|
2749
|
-
};
|
|
2750
|
-
const userInfoHtml = await http.api({
|
|
2751
|
-
method: "get",
|
|
2752
|
-
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
2753
|
-
params: {
|
|
2754
|
-
t: "home/index",
|
|
2755
|
-
token,
|
|
2756
|
-
lang: "zh_CN"
|
|
2757
|
-
}
|
|
2758
|
-
});
|
|
2759
|
-
const originalMatch = userInfoHtml.trim().match(/原创内容[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2760
|
-
if (originalMatch) userInfo.originalCount = parseInt(originalMatch[1].replace(/,/g, ''), 10);
|
|
2761
|
-
const totalUsersMatch = userInfoHtml.match(/总用户数[\s\S]*?<div[^>]*class=["']weui-desktop-user_sum["'][^>]*>[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2762
|
-
if (totalUsersMatch) userInfo.totalUsers = parseInt(totalUsersMatch[1].replace(/,/g, ''), 10);
|
|
2763
|
-
const increaseMatch = userInfoHtml.match(/weui-desktop-user_increase_num[^>]*>\s*([+-]?)\s*<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2764
|
-
if (increaseMatch) {
|
|
2765
|
-
const sign = '-' === increaseMatch[1] ? -1 : 1;
|
|
2766
|
-
userInfo.userIncrease = sign * parseInt(increaseMatch[2].replace(/,/g, ''), 10);
|
|
2767
|
-
}
|
|
2768
|
-
const readMatch = userInfoHtml.match(/昨日阅读[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2769
|
-
if (readMatch) userInfo.yesterday.read = parseInt(readMatch[1].replace(/,/g, ''), 10);
|
|
2770
|
-
const shareMatch = userInfoHtml.match(/昨日分享[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2771
|
-
if (shareMatch) userInfo.yesterday.share = parseInt(shareMatch[1].replace(/,/g, ''), 10);
|
|
2772
|
-
const subscribeMatch = userInfoHtml.match(/昨日新增关注[\s\S]*?<mp-thousandth[^>]*>([\d,]+)<\/mp-thousandth>/i);
|
|
2773
|
-
if (subscribeMatch) userInfo.yesterday.subscribe = parseInt(subscribeMatch[1].replace(/,/g, ''), 10);
|
|
2774
|
-
const wxData = {
|
|
2775
|
-
fansNum: userInfo.totalUsers,
|
|
2776
|
-
fansNumYesterday: userInfo.yesterday.subscribe,
|
|
2777
|
-
readNumYesterday: userInfo.yesterday.read,
|
|
2778
|
-
shareNumYesterday: userInfo.yesterday.share
|
|
2779
|
-
};
|
|
2780
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(wxData, "微信平台数据获取成功!");
|
|
2781
|
-
} catch (error) {
|
|
2782
|
-
return types_errorResponse(error instanceof Error ? error.message : "微信平台数据获取失败");
|
|
2783
|
-
}
|
|
2784
|
-
}
|
|
2785
|
-
class XsEncrypt {
|
|
2786
|
-
async encryptMD5(url) {
|
|
2787
|
-
return __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createHash("md5").update(url, "utf8").digest("hex");
|
|
2788
|
-
}
|
|
2789
|
-
async encryptText(text) {
|
|
2790
|
-
const textEncoded = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(text).toString("base64");
|
|
2791
|
-
const cipher = __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
|
|
2792
|
-
const ciphertext = cipher.update(textEncoded, "utf8", "base64");
|
|
2793
|
-
return ciphertext + cipher.final("base64");
|
|
2794
|
-
}
|
|
2795
|
-
async base64ToHex(encodedData) {
|
|
2796
|
-
const decodedData = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(encodedData, "base64");
|
|
2797
|
-
return decodedData.toString("hex");
|
|
2798
|
-
}
|
|
2799
|
-
async encryptPayload(payload, platform) {
|
|
2800
|
-
const hexPayload = await this.base64ToHex(payload);
|
|
2801
|
-
const obj = {
|
|
2802
|
-
signSvn: "56",
|
|
2803
|
-
signType: "x2",
|
|
2804
|
-
appID: platform,
|
|
2805
|
-
signVersion: "1",
|
|
2806
|
-
payload: hexPayload
|
|
2807
|
-
};
|
|
2808
|
-
const jsonString = JSON.stringify(obj, null, 0);
|
|
2809
|
-
return __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(jsonString).toString("base64");
|
|
2810
|
-
}
|
|
2811
|
-
async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
|
|
2812
|
-
const text = `x1=${await this.encryptMD5(`url=${url}`)};x2=0|0|0|1|0|0|1|0|0|0|1|0|0|0|0|1|0|0|0;x3=${a1};x4=${ts};`;
|
|
2813
|
-
return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
|
|
2814
|
-
}
|
|
2815
|
-
dumps(...rest) {
|
|
2816
|
-
const [data, replacer = null, space = 0] = rest;
|
|
2817
|
-
return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
|
|
2818
|
-
}
|
|
2819
|
-
constructor(){
|
|
2820
|
-
this.words = [
|
|
2821
|
-
929260340,
|
|
2822
|
-
1633971297,
|
|
2823
|
-
895580464,
|
|
2824
|
-
925905270
|
|
2825
|
-
];
|
|
2826
|
-
this.keyBytes = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.concat(this.words.map((word)=>new Uint8Array(__WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from([
|
|
2827
|
-
word >> 24 & 0xff,
|
|
2828
|
-
word >> 16 & 0xff,
|
|
2829
|
-
word >> 8 & 0xff,
|
|
2830
|
-
0xff & word
|
|
2831
|
-
]))));
|
|
2832
|
-
this.iv = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from("4uzjr7mbsibcaldp", "utf8");
|
|
2833
|
-
}
|
|
2834
|
-
}
|
|
2835
|
-
async function getXiaohongshuData(params) {
|
|
2836
|
-
try {
|
|
2837
|
-
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
2838
|
-
if (!a1Cookie) return types_errorResponse("账号数据异常,请重新绑定账号后重试。", 200);
|
|
2839
|
-
const http = new Http({
|
|
2840
|
-
headers: {
|
|
2841
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2842
|
-
referer: "https://creator.xiaohongshu.com",
|
|
2843
|
-
origin: "https://creator.xiaohongshu.com"
|
|
2844
|
-
}
|
|
2845
|
-
});
|
|
2846
|
-
const xsEncrypt = new XsEncrypt();
|
|
2847
|
-
const xt = Date.now().toString();
|
|
2848
|
-
const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
|
|
2849
|
-
const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
|
|
2850
|
-
const [overAllData, sevenData] = await Promise.all([
|
|
2851
|
-
http.api({
|
|
2852
|
-
method: "get",
|
|
2853
|
-
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
2854
|
-
}),
|
|
2855
|
-
http.api({
|
|
2856
|
-
method: "get",
|
|
2857
|
-
baseURL: "https://creator.xiaohongshu.com",
|
|
2858
|
-
url: sevenDataUrl,
|
|
2859
|
-
headers: {
|
|
2860
|
-
"x-s": xs,
|
|
2861
|
-
"x-t": xt
|
|
2862
|
-
}
|
|
2863
|
-
})
|
|
2864
|
-
]);
|
|
2865
|
-
const xhsData = {
|
|
2866
|
-
fansNum: overAllData.data.fans_count,
|
|
2867
|
-
favedNum: overAllData.data.faved_count,
|
|
2868
|
-
watchNumLastWeek: sevenData.data.seven.view_count,
|
|
2869
|
-
likeNumLastWeek: sevenData.data.seven.like_count,
|
|
2870
|
-
collectNumLastWeek: sevenData.data.seven.collect_count,
|
|
2871
|
-
commentNumLastWeek: sevenData.data.seven.comment_count,
|
|
2872
|
-
fansNumLastWeek: sevenData.data.seven.rise_fans_count,
|
|
2873
|
-
fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
|
|
2874
|
-
};
|
|
2875
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(xhsData, "小红书平台数据获取成功!");
|
|
2876
|
-
} catch (error) {
|
|
2877
|
-
return types_errorResponse(error instanceof Error ? error.message : "小红书平台数据获取失败");
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
2880
|
-
const SearchAccountInfo = async (_task, params)=>{
|
|
2881
|
-
const { platform } = params;
|
|
2882
|
-
switch(platform){
|
|
2883
|
-
case "toutiao":
|
|
2884
|
-
return getToutiaoData(params);
|
|
2885
|
-
case "xiaohongshu":
|
|
2886
|
-
return getXiaohongshuData(params);
|
|
2887
|
-
case "weixin":
|
|
2888
|
-
return getWeixinData(params);
|
|
2889
|
-
case "baijiahao":
|
|
2890
|
-
return getBaijiahaoData(params);
|
|
2891
|
-
default:
|
|
2892
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(null, "暂不支持该平台");
|
|
2893
|
-
}
|
|
2894
|
-
};
|
|
2895
|
-
const searchPublishInfo_types_errorResponse = (message, code = 500)=>({
|
|
2896
|
-
code,
|
|
2897
|
-
message,
|
|
2898
|
-
data: null
|
|
2899
|
-
});
|
|
2900
|
-
async function handleToutiaoData(params) {
|
|
2901
|
-
try {
|
|
2902
|
-
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
2903
|
-
const http = new Http({
|
|
2904
|
-
headers: {
|
|
2905
|
-
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2906
|
-
}
|
|
2907
|
-
});
|
|
2908
|
-
const visitedUid = await http.api({
|
|
2909
|
-
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?",
|
|
2910
|
-
method: "get",
|
|
2911
|
-
params: {
|
|
2912
|
-
app_id: 1231
|
|
2913
|
-
}
|
|
2914
|
-
});
|
|
2915
|
-
const articleInfo = await http.api({
|
|
2916
|
-
method: "get",
|
|
2917
|
-
url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
|
|
2918
|
-
params: {
|
|
2919
|
-
provider_type: "mp_provider",
|
|
2920
|
-
aid: "13",
|
|
2921
|
-
app_name: "news_article",
|
|
2922
|
-
category: "mp_all",
|
|
2923
|
-
channel: "",
|
|
2924
|
-
stream_api_version: "88",
|
|
2925
|
-
genre_type_switch: '{"repost":1,"small_video":1,"toutiao_graphic":1,"weitoutiao":1,"xigua_video":1}',
|
|
2926
|
-
device_platform: "pc",
|
|
2927
|
-
platform_id: "0",
|
|
2928
|
-
visited_uid: visitedUid.user_id_str,
|
|
2929
|
-
offset: (pageNum - 1) * pageSize,
|
|
2930
|
-
count: pageSize,
|
|
2931
|
-
keyword: "",
|
|
2932
|
-
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"}`,
|
|
2933
|
-
app_id: "1231"
|
|
2934
|
-
}
|
|
2935
|
-
});
|
|
2936
|
-
const articleCell = articleInfo.data.map((item)=>({
|
|
2937
|
-
title: item.assembleCell.itemCell.articleBase.title,
|
|
2938
|
-
imageUrl: item.assembleCell.itemCell.imageList.staggerFeedCover[0].url,
|
|
2939
|
-
createTime: item.assembleCell.itemCell.articleBase.publishTime,
|
|
2940
|
-
redirectUrl: item.assembleCell.itemCell.articleBase.articleURL,
|
|
2941
|
-
showNum: item.assembleCell.itemCell.itemCounter.showCount,
|
|
2942
|
-
readNum: item.assembleCell.itemCell.itemCounter.readCount,
|
|
2943
|
-
likeNum: item.assembleCell.itemCell.itemCounter.diggCount,
|
|
2944
|
-
commentNum: item.assembleCell.itemCell.itemCounter.commentCount,
|
|
2945
|
-
...showOriginalData ? {
|
|
2946
|
-
originalData: item
|
|
2947
|
-
} : {}
|
|
2948
|
-
}));
|
|
2949
|
-
const api_base_info_json = JSON.parse(articleInfo.api_base_info.app_extra_params);
|
|
2950
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2951
|
-
articleCell,
|
|
2952
|
-
...onlySuccess ? {
|
|
2953
|
-
pagination: {
|
|
2954
|
-
total: api_base_info_json.total_count || -1,
|
|
2955
|
-
pageNum,
|
|
2956
|
-
pageSize
|
|
2957
|
-
}
|
|
2958
|
-
} : null
|
|
2959
|
-
}, "头条号文章文章获取成功");
|
|
2960
|
-
} catch (error) {
|
|
2961
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
|
|
2962
|
-
}
|
|
2963
|
-
}
|
|
2964
|
-
async function handleWeixinData(params) {
|
|
2965
|
-
try {
|
|
2966
|
-
const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
2967
|
-
if (!token) return {
|
|
2968
|
-
code: 200,
|
|
2969
|
-
message: "缺少token",
|
|
2970
|
-
data: null
|
|
2971
|
-
};
|
|
2972
|
-
const http = new Http({
|
|
2973
|
-
headers: {
|
|
2974
|
-
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2975
|
-
}
|
|
2976
|
-
});
|
|
2977
|
-
const ParsePublishPage = (body)=>{
|
|
2978
|
-
const match = body.match(/publish_page\s*=\s*({[\s\S]*?});/);
|
|
2979
|
-
if (!match) throw new Error('无法提取 publish_page 字段');
|
|
2980
|
-
let parsedData = JSON.parse(match[1]);
|
|
2981
|
-
const decodeEntities = function(str, decode = false) {
|
|
2982
|
-
const encodeMap = [
|
|
2983
|
-
"&",
|
|
2984
|
-
"&",
|
|
2985
|
-
"<",
|
|
2986
|
-
"<",
|
|
2987
|
-
">",
|
|
2988
|
-
">",
|
|
2989
|
-
" ",
|
|
2990
|
-
" ",
|
|
2991
|
-
'"',
|
|
2992
|
-
""",
|
|
2993
|
-
"'",
|
|
2994
|
-
"'"
|
|
2995
|
-
];
|
|
2996
|
-
const decodeMap = [
|
|
2997
|
-
"'",
|
|
2998
|
-
"'",
|
|
2999
|
-
""",
|
|
3000
|
-
'"',
|
|
3001
|
-
" ",
|
|
3002
|
-
" ",
|
|
3003
|
-
">",
|
|
3004
|
-
">",
|
|
3005
|
-
"<",
|
|
3006
|
-
"<",
|
|
3007
|
-
"&",
|
|
3008
|
-
"&",
|
|
3009
|
-
"<",
|
|
3010
|
-
"<",
|
|
3011
|
-
">",
|
|
3012
|
-
">"
|
|
3013
|
-
];
|
|
3014
|
-
const map = decode ? decodeMap : encodeMap;
|
|
3015
|
-
let result = str;
|
|
3016
|
-
for(let i = 0; i < map.length; i += 2)result = result.replace(new RegExp(map[i], "g"), map[i + 1]);
|
|
3017
|
-
return result;
|
|
3018
|
-
};
|
|
3019
|
-
const finalData = {
|
|
3020
|
-
...parsedData,
|
|
3021
|
-
publish_list: parsedData.publish_list.map((item)=>{
|
|
3022
|
-
const decoded = decodeEntities(item.publish_info, true);
|
|
3023
|
-
const parsedInfo = JSON.parse(decoded);
|
|
3024
|
-
return {
|
|
3025
|
-
publish_type: item.publish_type,
|
|
3026
|
-
publish_info: parsedInfo
|
|
3027
|
-
};
|
|
3028
|
-
})
|
|
3029
|
-
};
|
|
3030
|
-
return finalData;
|
|
3031
|
-
};
|
|
3032
|
-
async function fetchArticles(begin, pageSize, token) {
|
|
3033
|
-
return http.api({
|
|
3034
|
-
method: "get",
|
|
3035
|
-
url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish',
|
|
3036
|
-
params: {
|
|
3037
|
-
sub: "list",
|
|
3038
|
-
begin: begin,
|
|
3039
|
-
count: pageSize,
|
|
3040
|
-
token: token,
|
|
3041
|
-
lang: "zh_CN"
|
|
3042
|
-
}
|
|
3043
|
-
});
|
|
3044
|
-
}
|
|
3045
|
-
let size = pageSize > 20 ? 20 : pageSize;
|
|
3046
|
-
let rawArticlesInfo = await fetchArticles((pageNum - 1) * size, size, token);
|
|
3047
|
-
let articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
3048
|
-
if (!onlySuccess && pageSize > 20) {
|
|
3049
|
-
let totalFetched = articlesInfo.publish_list.length;
|
|
3050
|
-
let nextPage = pageNum + 1;
|
|
3051
|
-
while(totalFetched < pageSize){
|
|
3052
|
-
const remaining = pageSize - totalFetched;
|
|
3053
|
-
const currentPageSize = remaining > 20 ? 20 : remaining;
|
|
3054
|
-
let _rawArticlesInfo = await fetchArticles((nextPage - 1) * 20, currentPageSize, token);
|
|
3055
|
-
let parsed = ParsePublishPage(_rawArticlesInfo);
|
|
3056
|
-
articlesInfo.publish_list = articlesInfo.publish_list.concat(parsed.publish_list);
|
|
3057
|
-
totalFetched = articlesInfo.publish_list.length;
|
|
3058
|
-
if (parsed.publish_list.length < currentPageSize) break;
|
|
3059
|
-
nextPage++;
|
|
3060
|
-
}
|
|
3061
|
-
}
|
|
3062
|
-
const articleCell = articlesInfo?.publish_list.map((item)=>({
|
|
3063
|
-
title: item.publish_info.appmsg_info[0].title,
|
|
3064
|
-
imageUrl: item.publish_info.appmsg_info[0].cover,
|
|
3065
|
-
createTime: item.publish_info.appmsg_info[0].line_info.send_time,
|
|
3066
|
-
redirectUrl: item.publish_info.appmsg_info[0].content_url,
|
|
3067
|
-
readNum: item.publish_info.appmsg_info[0].read_num,
|
|
3068
|
-
likeNum: item.publish_info.appmsg_info[0].old_like_num,
|
|
3069
|
-
shareNum: item.publish_info.appmsg_info[0].share_num,
|
|
3070
|
-
recommendNum: item.publish_info.appmsg_info[0].like_num,
|
|
3071
|
-
...showOriginalData ? {
|
|
3072
|
-
originalData: item
|
|
3073
|
-
} : {}
|
|
3074
|
-
}));
|
|
3075
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
3076
|
-
articleCell,
|
|
3077
|
-
...onlySuccess ? {
|
|
3078
|
-
pagination: {
|
|
3079
|
-
total: articlesInfo?.total_count,
|
|
3080
|
-
pageNum,
|
|
3081
|
-
pageSize
|
|
3082
|
-
}
|
|
3083
|
-
} : null
|
|
3084
|
-
}, "微信文章文章获取成功");
|
|
3085
|
-
} catch (error) {
|
|
3086
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
|
|
3087
|
-
}
|
|
3088
|
-
}
|
|
3089
|
-
async function handleBaijiahaoData(params) {
|
|
3090
|
-
try {
|
|
3091
|
-
const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3092
|
-
if (!token) return {
|
|
3093
|
-
code: 200,
|
|
3094
|
-
message: "缺少token",
|
|
3095
|
-
data: null
|
|
3096
|
-
};
|
|
3097
|
-
const http = new Http({
|
|
3098
|
-
headers: {
|
|
3099
|
-
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3100
|
-
token: token
|
|
3101
|
-
}
|
|
3102
|
-
});
|
|
3103
|
-
async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
|
|
3104
|
-
return await http.api({
|
|
3105
|
-
method: "get",
|
|
3106
|
-
url: "https://baijiahao.baidu.com/pcui/article/lists",
|
|
3107
|
-
params: {
|
|
3108
|
-
currentPage: pageNum,
|
|
3109
|
-
pageSize: pageSize,
|
|
3110
|
-
search: "",
|
|
3111
|
-
type: "",
|
|
3112
|
-
collection: onlySuccess ? "publish" : "",
|
|
3113
|
-
clearBeforeFetch: false,
|
|
3114
|
-
dynamic: 1
|
|
3115
|
-
}
|
|
3116
|
-
});
|
|
3117
|
-
}
|
|
3118
|
-
const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
|
|
3119
|
-
let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
|
|
3120
|
-
const totalPage = articleInfo.data.page?.totalPage || 1;
|
|
3121
|
-
let currentPage = pageNum + 1;
|
|
3122
|
-
const usedPages = new Set();
|
|
3123
|
-
while(filtered.length < pageSize && currentPage <= totalPage){
|
|
3124
|
-
if (usedPages.has(currentPage)) {
|
|
3125
|
-
currentPage++;
|
|
3126
|
-
continue;
|
|
3127
|
-
}
|
|
3128
|
-
const res = await fetchArticles(currentPage, pageSize, onlySuccess);
|
|
3129
|
-
usedPages.add(currentPage);
|
|
3130
|
-
const validItems = res.data.list.filter((item)=>"draft" !== item.status);
|
|
3131
|
-
filtered.push(...validItems);
|
|
3132
|
-
currentPage++;
|
|
3133
|
-
}
|
|
3134
|
-
const final = filtered.slice(0, pageSize);
|
|
3135
|
-
const articleCell = final.map((item)=>({
|
|
3136
|
-
title: item.title,
|
|
3137
|
-
imageUrl: JSON.parse(item.cover_images)[0].src,
|
|
3138
|
-
createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
|
|
3139
|
-
redirectUrl: item.url,
|
|
3140
|
-
recommendNum: item.rec_amount,
|
|
3141
|
-
collectNum: item.collection_amount,
|
|
3142
|
-
readNum: item.read_amount,
|
|
3143
|
-
likeNum: item.like_amount,
|
|
3144
|
-
commentNum: item.comment_amount,
|
|
3145
|
-
shareNum: item.share_amount,
|
|
3146
|
-
...showOriginalData ? {
|
|
3147
|
-
originalData: item
|
|
3148
|
-
} : {}
|
|
3149
|
-
}));
|
|
3150
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
3151
|
-
articleCell,
|
|
3152
|
-
...onlySuccess ? {
|
|
3153
|
-
pagination: {
|
|
3154
|
-
total: articleInfo.data.page?.totalCount,
|
|
3155
|
-
pageNum,
|
|
3156
|
-
pageSize
|
|
3157
|
-
}
|
|
3158
|
-
} : null
|
|
3159
|
-
}, "百家号文章数据获取成功");
|
|
3160
|
-
} catch (error) {
|
|
3161
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
|
|
3162
|
-
}
|
|
3163
|
-
}
|
|
3164
|
-
async function handleXiaohongshuData(params) {
|
|
3165
|
-
try {
|
|
3166
|
-
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3167
|
-
const xsEncrypt = new XsEncrypt();
|
|
3168
|
-
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
3169
|
-
if (!a1Cookie) return {
|
|
3170
|
-
code: 200,
|
|
3171
|
-
message: "账号数据异常",
|
|
3172
|
-
data: null
|
|
3173
|
-
};
|
|
3174
|
-
if (onlySuccess && 10 != pageSize) return {
|
|
3175
|
-
code: 200,
|
|
3176
|
-
message: "小红书pageSize不可修改",
|
|
3177
|
-
data: null
|
|
3178
|
-
};
|
|
3179
|
-
const http = new Http({
|
|
3180
|
-
headers: {
|
|
3181
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3182
|
-
referer: "https://creator.xiaohongshu.com",
|
|
3183
|
-
origin: "https://creator.xiaohongshu.com"
|
|
3184
|
-
}
|
|
3185
|
-
});
|
|
3186
|
-
async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
|
|
3187
|
-
const xt = Date.now().toString();
|
|
3188
|
-
const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
|
|
3189
|
-
const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
|
|
3190
|
-
return await http.api({
|
|
3191
|
-
method: "get",
|
|
3192
|
-
baseURL: "https://edith.xiaohongshu.com",
|
|
3193
|
-
url: serveUrl,
|
|
3194
|
-
headers: {
|
|
3195
|
-
"x-s": xs,
|
|
3196
|
-
"x-t": xt
|
|
3197
|
-
}
|
|
3198
|
-
});
|
|
3199
|
-
}
|
|
3200
|
-
const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
|
|
3201
|
-
let hasNextpage = -1 != articleInfo.data.page;
|
|
3202
|
-
let filtered = articleInfo.data.notes;
|
|
3203
|
-
let currentPage = pageNum + 1;
|
|
3204
|
-
const usedPages = new Set();
|
|
3205
|
-
while(filtered.length < pageSize && hasNextpage){
|
|
3206
|
-
if (usedPages.has(currentPage)) {
|
|
3207
|
-
currentPage++;
|
|
3208
|
-
continue;
|
|
3209
|
-
}
|
|
3210
|
-
const res = await fetchArticles(currentPage, a1Cookie, onlySuccess);
|
|
3211
|
-
usedPages.add(currentPage);
|
|
3212
|
-
const validItems = res.data.notes;
|
|
3213
|
-
filtered.push(...validItems);
|
|
3214
|
-
currentPage++;
|
|
3215
|
-
hasNextpage = -1 != res.data.page;
|
|
3216
|
-
}
|
|
3217
|
-
const final = filtered.slice(0, pageSize);
|
|
3218
|
-
const articleCell = final.map((item)=>({
|
|
3219
|
-
title: item.display_title,
|
|
3220
|
-
imageUrl: item.images_list[0].url,
|
|
3221
|
-
createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
|
|
3222
|
-
redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
|
|
3223
|
-
readNum: item.view_count,
|
|
3224
|
-
likeNum: item.likes,
|
|
3225
|
-
commentNum: item.comments_count,
|
|
3226
|
-
collectNum: item.collected_count,
|
|
3227
|
-
shareNum: item.shared_count,
|
|
3228
|
-
...showOriginalData ? {
|
|
3229
|
-
originalData: item
|
|
3230
|
-
} : {}
|
|
3231
|
-
}));
|
|
3232
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
3233
|
-
articleCell,
|
|
3234
|
-
...onlySuccess ? {
|
|
3235
|
-
pagination: {
|
|
3236
|
-
nextPage: hasNextpage,
|
|
3237
|
-
pageNum,
|
|
3238
|
-
pageSize
|
|
3239
|
-
}
|
|
3240
|
-
} : null
|
|
3241
|
-
}, "小红书文章数据获取成功");
|
|
3242
|
-
} catch (error) {
|
|
3243
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "小红书文章数据获取失败");
|
|
3244
|
-
}
|
|
3245
|
-
}
|
|
3246
|
-
const FetchArticles = async (_task, params)=>{
|
|
3247
|
-
const { platform } = params;
|
|
3248
|
-
switch(platform){
|
|
3249
|
-
case "toutiao":
|
|
3250
|
-
return handleToutiaoData(params);
|
|
3251
|
-
case "weixin":
|
|
3252
|
-
return handleWeixinData(params);
|
|
3253
|
-
case "baijiahao":
|
|
3254
|
-
return handleBaijiahaoData(params);
|
|
3255
|
-
case "xiaohongshu":
|
|
3256
|
-
return handleXiaohongshuData(params);
|
|
3257
|
-
default:
|
|
3258
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(null, "暂不支持该平台");
|
|
3259
|
-
}
|
|
3260
|
-
};
|
|
3261
|
-
const getWeixinConfig = async (_task, params)=>{
|
|
3262
|
-
const http = new Http({
|
|
3263
|
-
headers: {
|
|
3264
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
3265
|
-
}
|
|
3266
|
-
});
|
|
3267
|
-
const fingerprint = "4695500bc93ab4ce8fb2692da6564e04";
|
|
3268
|
-
const res = await http.api({
|
|
3269
|
-
method: "get",
|
|
3270
|
-
url: "https://mp.weixin.qq.com/cgi-bin/masssendpage",
|
|
3271
|
-
params: {
|
|
3272
|
-
f: 'json',
|
|
3273
|
-
token: params.token,
|
|
3274
|
-
lang: 'zh_CN',
|
|
3275
|
-
ajax: 1,
|
|
3276
|
-
fingerprint: fingerprint,
|
|
3277
|
-
random: Math.random().toString()
|
|
3278
|
-
}
|
|
3279
|
-
});
|
|
3280
|
-
const filtered = {
|
|
3281
|
-
publishQuota: 0 === res.base_resp.ret ? res.quota_detail_list.filter((item)=>"kQuotaTypeMassSendNormal" === item.quota_type).map((item)=>item.quota_item_list) : []
|
|
3282
|
-
};
|
|
3283
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(filtered, 0 === res.base_resp.ret ? "微信配置信息获取成功!" : "微信配置信息获取失败!");
|
|
3284
|
-
};
|
|
3285
2566
|
const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
3286
2567
|
const tmpCachePath = task.getTmpPath();
|
|
3287
2568
|
const http = new Http({
|
|
@@ -4807,7 +4088,8 @@ const xiaohongshuPublish_mock_errnoMap = {
|
|
|
4807
4088
|
915: "所属C端账号手机号被修改,请重新登录",
|
|
4808
4089
|
914: "所属C端账号密码被修改,请重新登录",
|
|
4809
4090
|
903: "账户已登出,需重新登陆重试!",
|
|
4810
|
-
902: "登录已过期,请重新登录!"
|
|
4091
|
+
902: "登录已过期,请重新登录!",
|
|
4092
|
+
906: "账号存在风险,请重新登录"
|
|
4811
4093
|
};
|
|
4812
4094
|
const mock_xsEncrypt = new XsEncrypt();
|
|
4813
4095
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
@@ -4850,33 +4132,63 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
4850
4132
|
"x-t": xt
|
|
4851
4133
|
}
|
|
4852
4134
|
});
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4135
|
+
let uploadInfos = [];
|
|
4136
|
+
coverIdInfo.data.uploadTempPermits.map((item)=>{
|
|
4137
|
+
uploadInfos.push({
|
|
4138
|
+
bucket: "",
|
|
4139
|
+
uploadAddr: item.uploadAddr,
|
|
4140
|
+
fileIds: item.fileIds,
|
|
4141
|
+
token: item.token
|
|
4142
|
+
});
|
|
4143
|
+
});
|
|
4144
|
+
if (0 === uploadInfos.length) return {
|
|
4856
4145
|
code: 200,
|
|
4857
4146
|
message: "图片上传失败,请稍后重试!",
|
|
4858
4147
|
data: ""
|
|
4859
4148
|
};
|
|
4860
|
-
const uploadFile = async (url, index)=>{
|
|
4149
|
+
const uploadFile = async (url, index, infoIndex = 0)=>{
|
|
4861
4150
|
const fileName = (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.getFilenameFromUrl)(url);
|
|
4862
4151
|
const localUrl = await (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
|
|
4863
|
-
const ossFileId = coverIds[index];
|
|
4864
4152
|
const fileBuffer = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(localUrl);
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4153
|
+
const tryUpload = async (uploadIndex)=>{
|
|
4154
|
+
if (uploadIndex >= uploadInfos.length) {
|
|
4155
|
+
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].unlinkSync(localUrl);
|
|
4156
|
+
return {
|
|
4157
|
+
ossFileId: "",
|
|
4158
|
+
ossToken: ""
|
|
4159
|
+
};
|
|
4160
|
+
}
|
|
4161
|
+
const currentInfo = uploadInfos[uploadIndex];
|
|
4162
|
+
const ossFileId = currentInfo.fileIds[0];
|
|
4163
|
+
const ossToken = currentInfo.token;
|
|
4164
|
+
const ossDomain = currentInfo.uploadAddr;
|
|
4165
|
+
try {
|
|
4166
|
+
await http.api({
|
|
4167
|
+
method: "put",
|
|
4168
|
+
url: `https://${ossDomain}/${ossFileId}`,
|
|
4169
|
+
data: fileBuffer,
|
|
4170
|
+
headers: {
|
|
4171
|
+
"x-cos-security-token": ossToken
|
|
4172
|
+
},
|
|
4173
|
+
defaultErrorMsg: "图片上传异常,请稍后重试发布。"
|
|
4174
|
+
});
|
|
4175
|
+
return {
|
|
4176
|
+
ossFileId,
|
|
4177
|
+
ossToken
|
|
4178
|
+
};
|
|
4179
|
+
} catch (error) {
|
|
4180
|
+
return tryUpload(uploadIndex + 1);
|
|
4181
|
+
}
|
|
4877
4182
|
};
|
|
4183
|
+
return tryUpload(infoIndex);
|
|
4878
4184
|
};
|
|
4879
4185
|
const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
|
|
4186
|
+
const invalidUpload = coverInfos.find((it)=>"" === it.ossToken || "" == it.ossFileId);
|
|
4187
|
+
if (invalidUpload) return {
|
|
4188
|
+
code: 200,
|
|
4189
|
+
message: "图片上传异常,请稍后重试发布。",
|
|
4190
|
+
data: ""
|
|
4191
|
+
};
|
|
4880
4192
|
if (params.topic && params.topic.length > 0) await Promise.all(params.topic.map(async (topic)=>{
|
|
4881
4193
|
if (!topic["id"]) {
|
|
4882
4194
|
const topicData = {
|
|
@@ -5213,7 +4525,9 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
5213
4525
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
5214
4526
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
5215
4527
|
};
|
|
5216
|
-
var package_namespaceObject =
|
|
4528
|
+
var package_namespaceObject = {
|
|
4529
|
+
i8: "1.2.14"
|
|
4530
|
+
};
|
|
5217
4531
|
class Action {
|
|
5218
4532
|
constructor(task){
|
|
5219
4533
|
this.task = task;
|
|
@@ -5234,24 +4548,6 @@ class Action {
|
|
|
5234
4548
|
} else this.task.logger.info(`${func.name} action success`);
|
|
5235
4549
|
return responseData;
|
|
5236
4550
|
}
|
|
5237
|
-
FetchArticles(params) {
|
|
5238
|
-
return this.bindTask(FetchArticles, params);
|
|
5239
|
-
}
|
|
5240
|
-
SearchAccountInfo(params) {
|
|
5241
|
-
return this.bindTask(SearchAccountInfo, params);
|
|
5242
|
-
}
|
|
5243
|
-
TTSessionCheck(params) {
|
|
5244
|
-
return this.bindTask(TTSessionCheck, params);
|
|
5245
|
-
}
|
|
5246
|
-
WxSessionCheck(params) {
|
|
5247
|
-
return this.bindTask(WxSessionCheck, params);
|
|
5248
|
-
}
|
|
5249
|
-
XhsSessionCheck(params) {
|
|
5250
|
-
return this.bindTask(XhsSessionCheck, params);
|
|
5251
|
-
}
|
|
5252
|
-
BjhSessionCheck(params) {
|
|
5253
|
-
return this.bindTask(BjhSessionCheck, params);
|
|
5254
|
-
}
|
|
5255
4551
|
searchToutiaoTopicList(params) {
|
|
5256
4552
|
return this.bindTask(searchToutiaoTopicList, params);
|
|
5257
4553
|
}
|
|
@@ -5276,9 +4572,6 @@ class Action {
|
|
|
5276
4572
|
getToutiaoConfig(params) {
|
|
5277
4573
|
return this.bindTask(getToutiaoConfig, params);
|
|
5278
4574
|
}
|
|
5279
|
-
getWeixinConfig(params) {
|
|
5280
|
-
return this.bindTask(getWeixinConfig, params);
|
|
5281
|
-
}
|
|
5282
4575
|
getBaijiahaoConfig(params) {
|
|
5283
4576
|
return this.bindTask(getBaijiahaoConfig, params);
|
|
5284
4577
|
}
|