@iflyrpa/actions 1.2.30-beta.1 → 1.2.30-beta.3
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/searchPublishInfo/types.d.ts +44 -0
- package/dist/actions/xiaohongshuWebSearch/index.d.ts +37 -8
- package/dist/bundle.js +549 -490
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +45 -0
- package/dist/index.js +535 -488
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +534 -489
- package/dist/index.mjs.map +1 -1
- package/dist/utils/index.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4319,6 +4319,7 @@ var __webpack_exports__ = {};
|
|
|
4319
4319
|
SearchAccountInfoParamsSchema: ()=>SearchAccountInfoParamsSchema,
|
|
4320
4320
|
rpaAction_Server_Mock: ()=>rpaAction_Server_Mock,
|
|
4321
4321
|
ConfigDataSchema: ()=>ConfigDataSchema,
|
|
4322
|
+
XhsWebSearchParamsSchema: ()=>XhsWebSearchParamsSchema,
|
|
4322
4323
|
ttConfigDataSchema: ()=>ttConfigDataSchema,
|
|
4323
4324
|
getFileState: ()=>getFileState,
|
|
4324
4325
|
xhsConfigDataSchema: ()=>xhsConfigDataSchema,
|
|
@@ -4424,6 +4425,7 @@ var __webpack_exports__ = {};
|
|
|
4424
4425
|
return response;
|
|
4425
4426
|
}, (error)=>{
|
|
4426
4427
|
const foundError = findError(error.response);
|
|
4428
|
+
console.log(error);
|
|
4427
4429
|
const errorResponse = {
|
|
4428
4430
|
code: error.response?.status || 500,
|
|
4429
4431
|
message: error.message || "",
|
|
@@ -4444,44 +4446,49 @@ var __webpack_exports__ = {};
|
|
|
4444
4446
|
errorResponse.data = serverError;
|
|
4445
4447
|
}
|
|
4446
4448
|
}
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
errorResponse.
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4449
|
+
let _message = error.message || "";
|
|
4450
|
+
if (error.code) {
|
|
4451
|
+
errorResponse.code = 401 === errorResponse.code ? 414 : errorResponse.code;
|
|
4452
|
+
switch(error.code){
|
|
4453
|
+
case "ECONNABORTED":
|
|
4454
|
+
_message = "请求超时,请检查网络连接!";
|
|
4455
|
+
break;
|
|
4456
|
+
case "ECONNRESET":
|
|
4457
|
+
_message = "连接被重置,请检查网络或稍后重试!";
|
|
4458
|
+
break;
|
|
4459
|
+
case "ENOTFOUND":
|
|
4460
|
+
_message = "域名解析失败,请检查 URL 是否正确!";
|
|
4461
|
+
break;
|
|
4462
|
+
case "ETIMEDOUT":
|
|
4463
|
+
_message = "网络请求超时,请检查网络连接!";
|
|
4464
|
+
break;
|
|
4465
|
+
case "ECONNREFUSED":
|
|
4466
|
+
_message = "服务器拒绝连接,请稍后重试!";
|
|
4467
|
+
break;
|
|
4468
|
+
case "EAI_AGAIN":
|
|
4469
|
+
_message = "DNS 查询超时,请稍后重试!";
|
|
4470
|
+
break;
|
|
4471
|
+
case "ERR_BAD_REQUEST":
|
|
4472
|
+
_message = "请求出现错误,请检查请求参数!";
|
|
4473
|
+
break;
|
|
4474
|
+
case "ERR_CANCELED":
|
|
4475
|
+
errorResponse.code = 414;
|
|
4476
|
+
_message = "请求连接超时,请稍候重试!";
|
|
4477
|
+
if (errorResponse.extra?.isProxyRequest) {
|
|
4478
|
+
_message = "代理连接建立超时,请更换区域或稍后重试!";
|
|
4479
|
+
errorResponse.code = 599;
|
|
4480
|
+
errorResponse.data = this.proxyInfo ? (0, external_node_crypto_namespaceObject.createHash)("md5").update(this.proxyInfo.split(":")[0]).digest("hex") + this.proxyInfo.split(":")[1] : {};
|
|
4481
|
+
}
|
|
4482
|
+
break;
|
|
4483
|
+
default:
|
|
4484
|
+
this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
|
|
4485
|
+
errorString: stringifyError(error)
|
|
4486
|
+
});
|
|
4487
|
+
_message = `未知网络错误: ${error.message}`;
|
|
4488
|
+
break;
|
|
4489
|
+
}
|
|
4484
4490
|
}
|
|
4491
|
+
errorResponse.message = errorResponse.message ? errorResponse.message : _message;
|
|
4485
4492
|
if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
|
|
4486
4493
|
throw errorResponse;
|
|
4487
4494
|
});
|
|
@@ -4578,6 +4585,28 @@ var __webpack_exports__ = {};
|
|
|
4578
4585
|
parser.end();
|
|
4579
4586
|
return srcList;
|
|
4580
4587
|
};
|
|
4588
|
+
const formatSectionHtml = (html)=>{
|
|
4589
|
+
const handler = new external_domhandler_namespaceObject.DomHandler();
|
|
4590
|
+
const parser = new external_htmlparser2_namespaceObject.Parser(handler, {
|
|
4591
|
+
decodeEntities: false
|
|
4592
|
+
});
|
|
4593
|
+
parser.write(html);
|
|
4594
|
+
parser.end();
|
|
4595
|
+
const dom = handler.dom;
|
|
4596
|
+
const sections = external_htmlparser2_namespaceObject.DomUtils.findAll((node)=>"tag" === node.type && "section" === node.name, dom);
|
|
4597
|
+
sections.forEach((section)=>{
|
|
4598
|
+
const imgs = external_htmlparser2_namespaceObject.DomUtils.findAll((node)=>"tag" === node.type && "img" === node.name, section.children || []);
|
|
4599
|
+
if (0 === imgs.length) return;
|
|
4600
|
+
const hasValidImg = imgs.some((img)=>{
|
|
4601
|
+
const src = img.attribs?.src?.trim();
|
|
4602
|
+
return Boolean(src);
|
|
4603
|
+
});
|
|
4604
|
+
if (!hasValidImg) external_htmlparser2_namespaceObject.DomUtils.removeElement(section);
|
|
4605
|
+
});
|
|
4606
|
+
return external_dom_serializer_default()(dom, {
|
|
4607
|
+
encodeEntities: false
|
|
4608
|
+
});
|
|
4609
|
+
};
|
|
4581
4610
|
(function(TimeFormatter) {
|
|
4582
4611
|
function format(timestamp, formatStr = "yyyy-MM-dd hh:mm") {
|
|
4583
4612
|
if (10 === timestamp.toString().length) timestamp *= 1000;
|
|
@@ -7715,7 +7744,7 @@ var __webpack_exports__ = {};
|
|
|
7715
7744
|
const parse_safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
7716
7745
|
const parse_safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
7717
7746
|
const parse_encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
7718
|
-
const
|
|
7747
|
+
const parse_decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
7719
7748
|
const parse_encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
7720
7749
|
const parse_decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
7721
7750
|
const parse_safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
@@ -7759,7 +7788,7 @@ var __webpack_exports__ = {};
|
|
|
7759
7788
|
inst.safeParseAsync = async (data, params)=>parse_safeParseAsync(inst, data, params);
|
|
7760
7789
|
inst.spa = inst.safeParseAsync;
|
|
7761
7790
|
inst.encode = (data, params)=>parse_encode(inst, data, params);
|
|
7762
|
-
inst.decode = (data, params)=>
|
|
7791
|
+
inst.decode = (data, params)=>parse_decode(inst, data, params);
|
|
7763
7792
|
inst.encodeAsync = async (data, params)=>parse_encodeAsync(inst, data, params);
|
|
7764
7793
|
inst.decodeAsync = async (data, params)=>parse_decodeAsync(inst, data, params);
|
|
7765
7794
|
inst.safeEncode = (data, params)=>parse_safeEncode(inst, data, params);
|
|
@@ -8983,6 +9012,7 @@ var __webpack_exports__ = {};
|
|
|
8983
9012
|
return (0, share_namespaceObject.success)(articleId, articleId ? "发布成功" : message);
|
|
8984
9013
|
};
|
|
8985
9014
|
const baijiahaoPublish = async (task, params)=>{
|
|
9015
|
+
params.content = formatSectionHtml(params.content);
|
|
8986
9016
|
if ("rpa" === params.actionType) return rpa_rpaAction(task, params);
|
|
8987
9017
|
if ("mockApi" === params.actionType) return mockAction(task, params);
|
|
8988
9018
|
return executeAction(mockAction, rpa_rpaAction)(task, params);
|
|
@@ -10702,57 +10732,54 @@ var __webpack_exports__ = {};
|
|
|
10702
10732
|
data: null
|
|
10703
10733
|
});
|
|
10704
10734
|
async function getBaijiahaoData(_task, params) {
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10735
|
+
const { token } = params;
|
|
10736
|
+
if (!token) return types_errorResponse("缺少token", 414);
|
|
10737
|
+
const http = new Http({
|
|
10738
|
+
headers: {
|
|
10739
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
10740
|
+
token: String(token),
|
|
10741
|
+
Referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
10742
|
+
}
|
|
10743
|
+
});
|
|
10744
|
+
const yesterday = utils_TimeFormatter.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
|
|
10745
|
+
const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
|
|
10746
|
+
http.api({
|
|
10747
|
+
method: "get",
|
|
10748
|
+
url: "https://baijiahao.baidu.com/pcui/home/index"
|
|
10749
|
+
}),
|
|
10750
|
+
http.api({
|
|
10751
|
+
method: "get",
|
|
10752
|
+
url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
|
|
10753
|
+
}),
|
|
10754
|
+
http.api({
|
|
10755
|
+
method: "get",
|
|
10756
|
+
url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
|
|
10757
|
+
}),
|
|
10758
|
+
http.api({
|
|
10759
|
+
method: "get",
|
|
10760
|
+
url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
|
|
10761
|
+
params: {
|
|
10762
|
+
type: "all",
|
|
10763
|
+
is_yesterday: false,
|
|
10764
|
+
start_day: yesterday,
|
|
10765
|
+
end_day: yesterday,
|
|
10766
|
+
stat: 0
|
|
10713
10767
|
}
|
|
10714
|
-
})
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
http.api({
|
|
10730
|
-
method: "get",
|
|
10731
|
-
url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
|
|
10732
|
-
params: {
|
|
10733
|
-
type: "all",
|
|
10734
|
-
is_yesterday: false,
|
|
10735
|
-
start_day: yesterday,
|
|
10736
|
-
end_day: yesterday,
|
|
10737
|
-
stat: 0
|
|
10738
|
-
}
|
|
10739
|
-
})
|
|
10740
|
-
]);
|
|
10741
|
-
const bjhData = {
|
|
10742
|
-
fansNum: fansData.data.coreData.fansCount,
|
|
10743
|
-
fansNumYesterday: -1 === yesterdayData.data.data.fans_increase ? null : yesterdayData.data.data.fans_increase,
|
|
10744
|
-
readNum: readData.data.total.view_count,
|
|
10745
|
-
incomeNum: incomeData.data.all_income.total_income,
|
|
10746
|
-
incomeNumYesterday: -1 === incomeData.data.all_income.yesterday_income ? null : incomeData.data.all_income.yesterday_income,
|
|
10747
|
-
recommendNumYesterday: -1 === yesterdayData.data.data.recommend_count ? null : yesterdayData.data.data.recommend_count,
|
|
10748
|
-
readNumYesterday: -1 === yesterdayData.data.data.view_count ? null : yesterdayData.data.data.view_count,
|
|
10749
|
-
likeNumYesterday: -1 === yesterdayData.data.data.likes_count ? null : yesterdayData.data.data.likes_count,
|
|
10750
|
-
commentNumYesterday: -1 === yesterdayData.data.data.comment_count ? null : yesterdayData.data.data.comment_count
|
|
10751
|
-
};
|
|
10752
|
-
return (0, share_namespaceObject.success)(bjhData, "百家号平台数据获取成功!");
|
|
10753
|
-
} catch (error) {
|
|
10754
|
-
return types_errorResponse(error instanceof Error ? error.message : "百家号平台数据获取失败");
|
|
10755
|
-
}
|
|
10768
|
+
})
|
|
10769
|
+
]);
|
|
10770
|
+
if (0 !== fansData.errno || 0 !== readData.errno || 0 !== incomeData.errno || 0 !== yesterdayData.errno) return types_errorResponse("百家号数据获取失败,请检查账号状态", 414);
|
|
10771
|
+
const bjhData = {
|
|
10772
|
+
fansNum: fansData.data.coreData.fansCount,
|
|
10773
|
+
fansNumYesterday: -1 === yesterdayData.data.data.fans_increase ? null : yesterdayData.data.data.fans_increase,
|
|
10774
|
+
readNum: readData.data.total.view_count,
|
|
10775
|
+
incomeNum: incomeData.data.all_income.total_income,
|
|
10776
|
+
incomeNumYesterday: -1 === incomeData.data.all_income.yesterday_income ? null : incomeData.data.all_income.yesterday_income,
|
|
10777
|
+
recommendNumYesterday: -1 === yesterdayData.data.data.recommend_count ? null : yesterdayData.data.data.recommend_count,
|
|
10778
|
+
readNumYesterday: -1 === yesterdayData.data.data.view_count ? null : yesterdayData.data.data.view_count,
|
|
10779
|
+
likeNumYesterday: -1 === yesterdayData.data.data.likes_count ? null : yesterdayData.data.data.likes_count,
|
|
10780
|
+
commentNumYesterday: -1 === yesterdayData.data.data.comment_count ? null : yesterdayData.data.data.comment_count
|
|
10781
|
+
};
|
|
10782
|
+
return (0, share_namespaceObject.success)(bjhData, "百家号平台数据获取成功!");
|
|
10756
10783
|
}
|
|
10757
10784
|
async function getToutiaoData(_task, params) {
|
|
10758
10785
|
const http = new Http({
|
|
@@ -10823,112 +10850,102 @@ var __webpack_exports__ = {};
|
|
|
10823
10850
|
message: "缺少token",
|
|
10824
10851
|
data: null
|
|
10825
10852
|
};
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
shareNumYesterday: userSummaryJson.share_summary.filter((it)=>1 === it.data_range_type)[0]?.data_value || 0
|
|
10866
|
-
};
|
|
10867
|
-
return (0, share_namespaceObject.success)(wxData, "微信平台数据获取成功!");
|
|
10868
|
-
} catch (error) {
|
|
10869
|
-
return types_errorResponse(error instanceof Error ? error.message : "微信平台数据获取失败");
|
|
10870
|
-
}
|
|
10853
|
+
const http = new Http({
|
|
10854
|
+
headers: {
|
|
10855
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
10856
|
+
}
|
|
10857
|
+
});
|
|
10858
|
+
const userInfoHtmlPromise = http.api({
|
|
10859
|
+
method: "get",
|
|
10860
|
+
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
10861
|
+
params: {
|
|
10862
|
+
t: "home/index",
|
|
10863
|
+
token,
|
|
10864
|
+
lang: "zh_CN"
|
|
10865
|
+
}
|
|
10866
|
+
});
|
|
10867
|
+
const userSummaryHtmlPromise = http.api({
|
|
10868
|
+
method: "get",
|
|
10869
|
+
url: "https://mp.weixin.qq.com/misc/appmsganalysis",
|
|
10870
|
+
params: {
|
|
10871
|
+
token,
|
|
10872
|
+
lang: "zh_CN",
|
|
10873
|
+
type: "daily_v2",
|
|
10874
|
+
action: "report",
|
|
10875
|
+
indicatorSelect: "read"
|
|
10876
|
+
}
|
|
10877
|
+
});
|
|
10878
|
+
const [userInfoHtml, userSummaryHtml] = await Promise.all([
|
|
10879
|
+
userInfoHtmlPromise,
|
|
10880
|
+
userSummaryHtmlPromise
|
|
10881
|
+
]);
|
|
10882
|
+
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("Token已失效,请重新获取", 414);
|
|
10883
|
+
const userInfoJson = exportWxCgiData(userInfoHtml);
|
|
10884
|
+
const userSummaryJson = exportWxCgiData(userSummaryHtml);
|
|
10885
|
+
const wxData = {
|
|
10886
|
+
fansNum: userInfoJson.total_friend_cnt,
|
|
10887
|
+
fansNumYesterday: userInfoJson.new_friend_cnt,
|
|
10888
|
+
readNumYesterday: userSummaryJson.read_summary.filter((it)=>1 === it.data_range_type)[0]?.data_value || 0,
|
|
10889
|
+
shareNumYesterday: userSummaryJson.share_summary.filter((it)=>1 === it.data_range_type)[0]?.data_value || 0
|
|
10890
|
+
};
|
|
10891
|
+
return (0, share_namespaceObject.success)(wxData, "微信平台数据获取成功!");
|
|
10871
10892
|
}
|
|
10872
10893
|
async function getXiaohongshuData(_task, params) {
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
return (0, share_namespaceObject.success)(xhsData, "小红书平台数据获取成功!");
|
|
10929
|
-
} catch (error) {
|
|
10930
|
-
return types_errorResponse(error instanceof Error ? error.message : "小红书平台数据获取失败");
|
|
10931
|
-
}
|
|
10894
|
+
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
10895
|
+
if (!a1Cookie) return types_errorResponse("账号数据异常,请重新绑定账号后重试。", 414);
|
|
10896
|
+
const headers = {
|
|
10897
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
10898
|
+
referer: "https://creator.xiaohongshu.com",
|
|
10899
|
+
origin: "https://creator.xiaohongshu.com"
|
|
10900
|
+
};
|
|
10901
|
+
const args = [
|
|
10902
|
+
{
|
|
10903
|
+
headers
|
|
10904
|
+
},
|
|
10905
|
+
_task.logger,
|
|
10906
|
+
params.proxyLoc,
|
|
10907
|
+
params.localIP,
|
|
10908
|
+
params.accountId
|
|
10909
|
+
];
|
|
10910
|
+
const http = new Http(...args);
|
|
10911
|
+
const xsEncrypt = new Xhshow();
|
|
10912
|
+
const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
|
|
10913
|
+
const recordCookie = params.cookies.reduce((acc, cookie)=>{
|
|
10914
|
+
if (cookie.name && cookie.value) acc[cookie.name] = cookie.value;
|
|
10915
|
+
return acc;
|
|
10916
|
+
}, {});
|
|
10917
|
+
const sevenDataXsHeader = xsEncrypt.signHeadersGet(sevenDataUrl, recordCookie, "xhs-pc-web", null);
|
|
10918
|
+
const [overAllData, sevenData] = await Promise.all([
|
|
10919
|
+
http.api({
|
|
10920
|
+
method: "get",
|
|
10921
|
+
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
10922
|
+
}, {
|
|
10923
|
+
retries: 3,
|
|
10924
|
+
retryDelay: 20,
|
|
10925
|
+
timeout: 3000
|
|
10926
|
+
}),
|
|
10927
|
+
http.api({
|
|
10928
|
+
method: "get",
|
|
10929
|
+
baseURL: "https://creator.xiaohongshu.com",
|
|
10930
|
+
url: sevenDataUrl,
|
|
10931
|
+
headers: sevenDataXsHeader
|
|
10932
|
+
}, {
|
|
10933
|
+
retries: 3,
|
|
10934
|
+
retryDelay: 20,
|
|
10935
|
+
timeout: 3000
|
|
10936
|
+
})
|
|
10937
|
+
]);
|
|
10938
|
+
const xhsData = {
|
|
10939
|
+
fansNum: overAllData.data.fans_count,
|
|
10940
|
+
favedNum: overAllData.data.faved_count,
|
|
10941
|
+
watchNumLastWeek: sevenData.data.seven.view_count,
|
|
10942
|
+
likeNumLastWeek: sevenData.data.seven.like_count,
|
|
10943
|
+
collectNumLastWeek: sevenData.data.seven.collect_count,
|
|
10944
|
+
commentNumLastWeek: sevenData.data.seven.comment_count,
|
|
10945
|
+
fansNumLastWeek: sevenData.data.seven.rise_fans_count,
|
|
10946
|
+
fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
|
|
10947
|
+
};
|
|
10948
|
+
return (0, share_namespaceObject.success)(xhsData, "小红书平台数据获取成功!");
|
|
10932
10949
|
}
|
|
10933
10950
|
const SearchAccountInfoParamsSchema = ActionCommonParamsSchema.extend({
|
|
10934
10951
|
token: union([
|
|
@@ -11054,6 +11071,12 @@ var __webpack_exports__ = {};
|
|
|
11054
11071
|
BaijiahaoArticleSchema,
|
|
11055
11072
|
XiaohongshuArticleSchema
|
|
11056
11073
|
])).optional(),
|
|
11074
|
+
timerPublish: schemas_array(union([
|
|
11075
|
+
ToutiaoArticleSchema,
|
|
11076
|
+
WeixinArticleSchema,
|
|
11077
|
+
BaijiahaoArticleSchema,
|
|
11078
|
+
XiaohongshuArticleSchema
|
|
11079
|
+
])).optional(),
|
|
11057
11080
|
pagination: schemas_object({
|
|
11058
11081
|
total: schemas_number().optional(),
|
|
11059
11082
|
nextPage: schemas_boolean().optional(),
|
|
@@ -11098,6 +11121,7 @@ var __webpack_exports__ = {};
|
|
|
11098
11121
|
});
|
|
11099
11122
|
}
|
|
11100
11123
|
const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
|
|
11124
|
+
if (0 !== articleInfo.errno) return searchPublishInfo_types_errorResponse("百家号数据获取失败,请检查账号状态", 414);
|
|
11101
11125
|
const filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
|
|
11102
11126
|
const totalPage = articleInfo.data.page?.totalPage || 1;
|
|
11103
11127
|
let currentPage = pageNum + 1;
|
|
@@ -11198,6 +11222,7 @@ var __webpack_exports__ = {};
|
|
|
11198
11222
|
app_id: 1231
|
|
11199
11223
|
}
|
|
11200
11224
|
});
|
|
11225
|
+
if (0 !== visitedUid.code) return searchPublishInfo_types_errorResponse("头条号账号信息获取失败,请检查账号状态", 414);
|
|
11201
11226
|
const articleInfo = await http.api({
|
|
11202
11227
|
method: "get",
|
|
11203
11228
|
url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
|
|
@@ -11250,189 +11275,162 @@ var __webpack_exports__ = {};
|
|
|
11250
11275
|
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
|
|
11251
11276
|
}
|
|
11252
11277
|
}
|
|
11278
|
+
const external_node_vm_namespaceObject = require("node:vm");
|
|
11279
|
+
var external_node_vm_default = /*#__PURE__*/ __webpack_require__.n(external_node_vm_namespaceObject);
|
|
11253
11280
|
async function handleWeixinData(_task, params) {
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
|
|
11257
|
-
|
|
11258
|
-
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
const
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
const decodeEntities = (str, decode = false)=>{
|
|
11271
|
-
const encodeMap = [
|
|
11272
|
-
"&",
|
|
11273
|
-
"&",
|
|
11274
|
-
"<",
|
|
11275
|
-
"<",
|
|
11276
|
-
">",
|
|
11277
|
-
">",
|
|
11278
|
-
" ",
|
|
11279
|
-
" ",
|
|
11280
|
-
'"',
|
|
11281
|
-
""",
|
|
11282
|
-
"'",
|
|
11283
|
-
"'"
|
|
11284
|
-
];
|
|
11285
|
-
const decodeMap = [
|
|
11286
|
-
"'",
|
|
11287
|
-
"'",
|
|
11288
|
-
""",
|
|
11289
|
-
'"',
|
|
11290
|
-
" ",
|
|
11291
|
-
" ",
|
|
11292
|
-
">",
|
|
11293
|
-
">",
|
|
11294
|
-
"<",
|
|
11295
|
-
"<",
|
|
11296
|
-
"&",
|
|
11297
|
-
"&",
|
|
11298
|
-
"<",
|
|
11299
|
-
"<",
|
|
11300
|
-
">",
|
|
11301
|
-
">"
|
|
11302
|
-
];
|
|
11303
|
-
const map = decode ? decodeMap : encodeMap;
|
|
11304
|
-
let result = str;
|
|
11305
|
-
for(let i = 0; i < map.length; i += 2)result = result.replace(new RegExp(map[i], "g"), map[i + 1]);
|
|
11306
|
-
return result;
|
|
11307
|
-
};
|
|
11308
|
-
const finalData = {
|
|
11309
|
-
...parsedData,
|
|
11310
|
-
publish_list: parsedData.publish_list.map((item)=>{
|
|
11311
|
-
const decoded = decodeEntities(item.publish_info, true);
|
|
11312
|
-
const parsedInfo = JSON.parse(decoded);
|
|
11313
|
-
return {
|
|
11314
|
-
publish_type: item.publish_type,
|
|
11315
|
-
publish_info: parsedInfo
|
|
11316
|
-
};
|
|
11317
|
-
})
|
|
11318
|
-
};
|
|
11319
|
-
return finalData;
|
|
11281
|
+
const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, cursor, lastPage, containsArticle = false } = params;
|
|
11282
|
+
if (!token) return {
|
|
11283
|
+
code: 414,
|
|
11284
|
+
message: "缺少token",
|
|
11285
|
+
data: {}
|
|
11286
|
+
};
|
|
11287
|
+
const http = new Http({
|
|
11288
|
+
headers: {
|
|
11289
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
11290
|
+
}
|
|
11291
|
+
});
|
|
11292
|
+
const ParsePublishPage = (html)=>{
|
|
11293
|
+
const document1 = (0, external_htmlparser2_namespaceObject.parseDocument)(html);
|
|
11294
|
+
const scripts = external_htmlparser2_namespaceObject.DomUtils.findAll((el)=>"script" === el.type, document1.children);
|
|
11295
|
+
const sandbox = {
|
|
11296
|
+
window: {}
|
|
11320
11297
|
};
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11298
|
+
external_node_vm_default().createContext(sandbox);
|
|
11299
|
+
for (const script of scripts){
|
|
11300
|
+
const code = external_htmlparser2_namespaceObject.DomUtils.textContent(script);
|
|
11301
|
+
if (!!code) {
|
|
11302
|
+
if (code.includes("publish_page")) {
|
|
11303
|
+
const replaceCode = code.replace("publish_page =", "window.publish_page =");
|
|
11304
|
+
try {
|
|
11305
|
+
external_node_vm_default().runInContext(replaceCode, sandbox, {
|
|
11306
|
+
timeout: 1000
|
|
11307
|
+
});
|
|
11308
|
+
} catch (e) {}
|
|
11331
11309
|
}
|
|
11332
|
-
});
|
|
11333
|
-
}
|
|
11334
|
-
const size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
|
|
11335
|
-
let begin = (lastPage ?? pageNum) - 1;
|
|
11336
|
-
const rawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
11337
|
-
const articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
11338
|
-
let articleCell = [];
|
|
11339
|
-
if (!onlySuccess && pageSize > 20) {
|
|
11340
|
-
let totalFetched = articlesInfo.publish_list.length;
|
|
11341
|
-
let nextPage = pageNum + 1;
|
|
11342
|
-
while(totalFetched < pageSize){
|
|
11343
|
-
const remaining = pageSize - totalFetched;
|
|
11344
|
-
const currentPageSize = remaining > 20 ? 20 : remaining;
|
|
11345
|
-
const _rawArticlesInfo = await fetchArticles((nextPage - 1) * 20, currentPageSize, token);
|
|
11346
|
-
const parsed = ParsePublishPage(_rawArticlesInfo);
|
|
11347
|
-
articlesInfo.publish_list = articlesInfo.publish_list.concat(parsed.publish_list);
|
|
11348
|
-
totalFetched = articlesInfo.publish_list.length;
|
|
11349
|
-
if (parsed.publish_list.length < currentPageSize) break;
|
|
11350
|
-
nextPage++;
|
|
11351
11310
|
}
|
|
11352
11311
|
}
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
|
|
11312
|
+
const decodeHtmlEntities = (encodedStr)=>encodedStr.replace(/"/g, '"').replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'");
|
|
11313
|
+
sandbox.window.publish_page.publish_list.forEach((it)=>{
|
|
11314
|
+
it.publish_info = JSON.parse(decodeHtmlEntities(it.publish_info));
|
|
11315
|
+
});
|
|
11316
|
+
return sandbox.window.publish_page;
|
|
11317
|
+
};
|
|
11318
|
+
async function fetchArticles(begin, pageSize, token) {
|
|
11319
|
+
return http.api({
|
|
11320
|
+
method: "get",
|
|
11321
|
+
url: "https://mp.weixin.qq.com/cgi-bin/appmsgpublish",
|
|
11322
|
+
params: {
|
|
11323
|
+
sub: "list",
|
|
11324
|
+
begin: begin,
|
|
11325
|
+
count: pageSize,
|
|
11326
|
+
token: token,
|
|
11327
|
+
lang: "zh_CN"
|
|
11368
11328
|
}
|
|
11369
|
-
|
|
11329
|
+
});
|
|
11330
|
+
}
|
|
11331
|
+
const size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
|
|
11332
|
+
let begin = (lastPage ?? pageNum) - 1;
|
|
11333
|
+
const rawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
11334
|
+
if (rawArticlesInfo.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return searchPublishInfo_types_errorResponse("登陆已失效,请重新登陆!", 414);
|
|
11335
|
+
const articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
11336
|
+
let articleCell = [];
|
|
11337
|
+
if (!onlySuccess && pageSize > 20) {
|
|
11338
|
+
let totalFetched = articlesInfo.publish_list.length;
|
|
11339
|
+
let nextPage = pageNum + 1;
|
|
11340
|
+
while(totalFetched < pageSize){
|
|
11341
|
+
const remaining = pageSize - totalFetched;
|
|
11342
|
+
const currentPageSize = remaining > 20 ? 20 : remaining;
|
|
11343
|
+
const _rawArticlesInfo = await fetchArticles((nextPage - 1) * 20, currentPageSize, token);
|
|
11344
|
+
const parsed = ParsePublishPage(_rawArticlesInfo);
|
|
11345
|
+
articlesInfo.publish_list = articlesInfo.publish_list.concat(parsed.publish_list);
|
|
11346
|
+
totalFetched = articlesInfo.publish_list.length;
|
|
11347
|
+
if (parsed.publish_list.length < currentPageSize) break;
|
|
11348
|
+
nextPage++;
|
|
11349
|
+
}
|
|
11350
|
+
}
|
|
11351
|
+
let nextPage = false;
|
|
11352
|
+
if (onlySuccess) {
|
|
11353
|
+
let filteredList = articlesInfo.publish_list.filter((item)=>-1 === item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
|
|
11354
|
+
if (cursor) {
|
|
11355
|
+
const cursorIndex = filteredList.findIndex((item)=>item.msgid === cursor);
|
|
11356
|
+
if (-1 !== cursorIndex) filteredList = filteredList.slice(cursorIndex + 1);
|
|
11357
|
+
}
|
|
11358
|
+
let totalFetched = filteredList.length;
|
|
11359
|
+
while(totalFetched < pageSize && begin * size < articlesInfo.total_count){
|
|
11360
|
+
begin += 1;
|
|
11361
|
+
const nextRawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
11362
|
+
const nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
|
|
11363
|
+
const newFiltered = nextArticlesInfo.publish_list.filter((item)=>-1 === item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
|
|
11364
|
+
filteredList = filteredList.concat(newFiltered);
|
|
11370
11365
|
totalFetched = filteredList.length;
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
const
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11394
|
-
|
|
11395
|
-
if (!text) {
|
|
11396
|
-
const isCheckPass = detailInfo.indexOf("环境异常");
|
|
11397
|
-
if (isCheckPass > -1) return "当前环境异常,无法获取文章内容";
|
|
11398
|
-
return null;
|
|
11366
|
+
}
|
|
11367
|
+
filteredList = filteredList.slice(0, pageSize);
|
|
11368
|
+
totalFetched = filteredList.length;
|
|
11369
|
+
if (totalFetched >= pageSize && begin * size < articlesInfo.total_count) {
|
|
11370
|
+
const nextRawArticlesInfo = await fetchArticles((begin + 1) * size, size, token);
|
|
11371
|
+
const nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
|
|
11372
|
+
nextPage = nextArticlesInfo.publish_list.length > 0 && nextArticlesInfo.publish_list.some((item)=>-1 === item.publish_info.appmsg_info[0].content_url.indexOf("tempkey"));
|
|
11373
|
+
}
|
|
11374
|
+
const getDetailContent = async (id)=>{
|
|
11375
|
+
try {
|
|
11376
|
+
const detailInfo = await http.api({
|
|
11377
|
+
method: "get",
|
|
11378
|
+
url: "https://mp.weixin.qq.com/cgi-bin/appmsg",
|
|
11379
|
+
params: {
|
|
11380
|
+
token,
|
|
11381
|
+
t: "media/appmsg_edit",
|
|
11382
|
+
action: "edit",
|
|
11383
|
+
type: 77,
|
|
11384
|
+
appmsgid: id,
|
|
11385
|
+
isMul: 1,
|
|
11386
|
+
get_delete: 1,
|
|
11387
|
+
re_edit: 1,
|
|
11388
|
+
lang: "zh_CN",
|
|
11389
|
+
timestamp: Date.now()
|
|
11399
11390
|
}
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11391
|
+
});
|
|
11392
|
+
const text = detailInfo.match(/var\s+infos\s*=\s*({[\s\S]*?})\s*,\s*item\s*=/);
|
|
11393
|
+
if (!text) {
|
|
11394
|
+
const isCheckPass = detailInfo.indexOf("环境异常");
|
|
11395
|
+
if (isCheckPass > -1) return "当前环境异常,无法获取文章内容";
|
|
11404
11396
|
return null;
|
|
11405
11397
|
}
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11398
|
+
const deatil = JSON.parse(text[1].trim());
|
|
11399
|
+
return deatil.item[0].content;
|
|
11400
|
+
} catch (err) {
|
|
11401
|
+
console.error("❌ 解析失败:", err);
|
|
11402
|
+
return null;
|
|
11403
|
+
}
|
|
11404
|
+
};
|
|
11405
|
+
const lastMsgId = filteredList.length > 0 ? filteredList[filteredList.length - 1].msgid : void 0;
|
|
11406
|
+
articleCell = await Promise.all(filteredList.map(async (item)=>({
|
|
11407
|
+
title: item.appmsg_info[0].title,
|
|
11408
|
+
imageUrl: item.appmsg_info[0].cover,
|
|
11409
|
+
createTime: item.appmsg_info[0].line_info.send_time,
|
|
11410
|
+
redirectUrl: item.appmsg_info[0].content_url,
|
|
11411
|
+
readNum: item.appmsg_info[0].read_num,
|
|
11412
|
+
likeNum: item.appmsg_info[0].old_like_num,
|
|
11413
|
+
shareNum: item.appmsg_info[0].share_num,
|
|
11414
|
+
recommendNum: item.appmsg_info[0].like_num,
|
|
11415
|
+
...showOriginalData ? {
|
|
11416
|
+
originalData: item
|
|
11417
|
+
} : {},
|
|
11418
|
+
...containsArticle ? {
|
|
11419
|
+
article: await getDetailContent(item.msgid)
|
|
11420
|
+
} : {}
|
|
11421
|
+
})));
|
|
11422
|
+
return (0, share_namespaceObject.success)({
|
|
11423
|
+
articleCell,
|
|
11424
|
+
pagination: {
|
|
11425
|
+
nextPage,
|
|
11426
|
+
pageNum,
|
|
11427
|
+
pageSize,
|
|
11428
|
+
lastPage: begin + 1,
|
|
11429
|
+
cursor: lastMsgId
|
|
11430
|
+
}
|
|
11431
|
+
}, "微信文章文章获取成功");
|
|
11432
|
+
}
|
|
11433
|
+
const BasePublishBUilder = (publishInfo)=>publishInfo.map((item)=>({
|
|
11436
11434
|
title: item.publish_info.appmsg_info[0].title,
|
|
11437
11435
|
imageUrl: item.publish_info.appmsg_info[0].cover,
|
|
11438
11436
|
createTime: item.publish_info.appmsg_info[0].line_info.send_time,
|
|
@@ -11445,140 +11443,173 @@ var __webpack_exports__ = {};
|
|
|
11445
11443
|
originalData: item
|
|
11446
11444
|
} : {}
|
|
11447
11445
|
}));
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11446
|
+
articleCell = BasePublishBUilder(articlesInfo.publish_list);
|
|
11447
|
+
const timerPublishData = await http.api({
|
|
11448
|
+
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
11449
|
+
method: "get",
|
|
11450
|
+
params: {
|
|
11451
|
+
t: "home/index",
|
|
11452
|
+
token,
|
|
11453
|
+
lang: "zh_CN"
|
|
11454
|
+
}
|
|
11455
|
+
});
|
|
11456
|
+
const decodeTimerPublishData = (html)=>{
|
|
11457
|
+
const document1 = (0, external_htmlparser2_namespaceObject.parseDocument)(html);
|
|
11458
|
+
const scripts = external_htmlparser2_namespaceObject.DomUtils.findAll((el)=>"script" === el.type, document1.children);
|
|
11459
|
+
const sandbox = {
|
|
11460
|
+
window: {}
|
|
11461
|
+
};
|
|
11462
|
+
external_node_vm_default().createContext(sandbox);
|
|
11463
|
+
for (const script of scripts){
|
|
11464
|
+
let code = external_htmlparser2_namespaceObject.DomUtils.textContent(script);
|
|
11465
|
+
if (!!code) {
|
|
11466
|
+
if (code.includes("wx.cgiData")) {
|
|
11467
|
+
code = code.replace("wx.cgiData", "window.wx.cgiData");
|
|
11468
|
+
try {
|
|
11469
|
+
external_node_vm_default().runInContext(code, sandbox, {
|
|
11470
|
+
timeout: 1000
|
|
11471
|
+
});
|
|
11472
|
+
} catch (e) {}
|
|
11473
|
+
}
|
|
11474
|
+
}
|
|
11475
|
+
}
|
|
11476
|
+
if (!sandbox.window.wx || !sandbox.window.wx.cgiData || !sandbox.window.wx.cgiData.timesend_msg) return [];
|
|
11477
|
+
const timesend_msg = JSON.parse(sandbox.window.wx.cgiData.timesend_msg);
|
|
11478
|
+
return timesend_msg.sent_list.map((it)=>({
|
|
11479
|
+
publish_info: it
|
|
11480
|
+
}));
|
|
11481
|
+
};
|
|
11482
|
+
const timmerPublish = decodeTimerPublishData(timerPublishData);
|
|
11483
|
+
return (0, share_namespaceObject.success)({
|
|
11484
|
+
...0 === timmerPublish.length ? {} : {
|
|
11485
|
+
timmerPublish: BasePublishBUilder(timmerPublish)
|
|
11486
|
+
},
|
|
11487
|
+
articleCell
|
|
11488
|
+
}, "微信文章文章获取成功");
|
|
11454
11489
|
}
|
|
11455
11490
|
async function handleXiaohongshuData(_task, params) {
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11491
|
+
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, containsArticle = false } = params;
|
|
11492
|
+
const xsEncrypt = new Xhshow();
|
|
11493
|
+
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
11494
|
+
if (!a1Cookie) return {
|
|
11495
|
+
code: 414,
|
|
11496
|
+
message: "账号数据异常",
|
|
11497
|
+
data: {}
|
|
11498
|
+
};
|
|
11499
|
+
if (onlySuccess && 10 !== pageSize) return {
|
|
11500
|
+
code: 414,
|
|
11501
|
+
message: "小红书pageSize不可修改",
|
|
11502
|
+
data: {}
|
|
11503
|
+
};
|
|
11504
|
+
const headers = {
|
|
11505
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11506
|
+
referer: "https://creator.xiaohongshu.com",
|
|
11507
|
+
origin: "https://creator.xiaohongshu.com"
|
|
11508
|
+
};
|
|
11509
|
+
const args = [
|
|
11510
|
+
{
|
|
11511
|
+
headers
|
|
11512
|
+
},
|
|
11513
|
+
_task.logger,
|
|
11514
|
+
params.proxyLoc,
|
|
11515
|
+
params.localIP,
|
|
11516
|
+
params.accountId
|
|
11517
|
+
];
|
|
11518
|
+
const http = new Http(...args);
|
|
11519
|
+
const recordCookie = params.cookies.reduce((acc, cookie)=>{
|
|
11520
|
+
if (cookie.name && cookie.value) acc[cookie.name] = cookie.value;
|
|
11521
|
+
return acc;
|
|
11522
|
+
}, {});
|
|
11523
|
+
async function fetchArticles(pageNum, onlySuccess = false) {
|
|
11524
|
+
const serveUrl = "/web_api/sns/v5/creator/note/user/posted";
|
|
11525
|
+
const serveParams = {
|
|
11526
|
+
tab: onlySuccess ? 1 : 0,
|
|
11527
|
+
page: pageNum - 1
|
|
11474
11528
|
};
|
|
11475
|
-
const
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
params
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11529
|
+
const serveXsHeader = xsEncrypt.signHeadersGet(serveUrl, recordCookie, "xhs-pc-web", serveParams);
|
|
11530
|
+
return await http.api({
|
|
11531
|
+
method: "get",
|
|
11532
|
+
baseURL: "https://edith.xiaohongshu.com",
|
|
11533
|
+
url: serveUrl,
|
|
11534
|
+
headers: serveXsHeader,
|
|
11535
|
+
params: serveParams
|
|
11536
|
+
}, {
|
|
11537
|
+
retries: 3,
|
|
11538
|
+
retryDelay: 20,
|
|
11539
|
+
timeout: 3000
|
|
11540
|
+
});
|
|
11541
|
+
}
|
|
11542
|
+
const articleInfo = await fetchArticles(pageNum, onlySuccess);
|
|
11543
|
+
let hasNextpage = -1 !== articleInfo.data.page;
|
|
11544
|
+
const filtered = articleInfo.data.notes;
|
|
11545
|
+
let currentPage = pageNum + 1;
|
|
11546
|
+
const usedPages = new Set();
|
|
11547
|
+
while(filtered.length < pageSize && hasNextpage){
|
|
11548
|
+
if (usedPages.has(currentPage)) {
|
|
11549
|
+
currentPage++;
|
|
11550
|
+
continue;
|
|
11551
|
+
}
|
|
11552
|
+
const res = await fetchArticles(currentPage, onlySuccess);
|
|
11553
|
+
usedPages.add(currentPage);
|
|
11554
|
+
const validItems = res.data.notes;
|
|
11555
|
+
filtered.push(...validItems);
|
|
11556
|
+
currentPage++;
|
|
11557
|
+
hasNextpage = -1 !== res.data.page;
|
|
11558
|
+
}
|
|
11559
|
+
const getDetailContent = async (id)=>{
|
|
11560
|
+
try {
|
|
11561
|
+
const detailUrl = "/web_api/sns/capa/postgw/note/detail";
|
|
11562
|
+
const detailParams = {
|
|
11563
|
+
note_id: id,
|
|
11564
|
+
source: "official",
|
|
11565
|
+
edit_mode: 1
|
|
11494
11566
|
};
|
|
11495
|
-
const
|
|
11496
|
-
|
|
11567
|
+
const detailxsHeader = xsEncrypt.signHeadersGet(detailUrl, recordCookie, "xhs-pc-web", detailParams);
|
|
11568
|
+
const detailInfo = await http.api({
|
|
11497
11569
|
method: "get",
|
|
11498
11570
|
baseURL: "https://edith.xiaohongshu.com",
|
|
11499
|
-
url:
|
|
11500
|
-
headers:
|
|
11501
|
-
params:
|
|
11571
|
+
url: detailUrl,
|
|
11572
|
+
headers: detailxsHeader,
|
|
11573
|
+
params: detailParams
|
|
11502
11574
|
}, {
|
|
11503
11575
|
retries: 3,
|
|
11504
11576
|
retryDelay: 20,
|
|
11505
11577
|
timeout: 3000
|
|
11506
11578
|
});
|
|
11579
|
+
return detailInfo.data.desc;
|
|
11580
|
+
} catch (err) {
|
|
11581
|
+
console.error("❌ JSON 解析失败:", err);
|
|
11582
|
+
return null;
|
|
11507
11583
|
}
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
const detailInfo = await http.api({
|
|
11535
|
-
method: "get",
|
|
11536
|
-
baseURL: "https://edith.xiaohongshu.com",
|
|
11537
|
-
url: detailUrl,
|
|
11538
|
-
headers: detailxsHeader,
|
|
11539
|
-
params: detailParams
|
|
11540
|
-
}, {
|
|
11541
|
-
retries: 3,
|
|
11542
|
-
retryDelay: 20,
|
|
11543
|
-
timeout: 3000
|
|
11544
|
-
});
|
|
11545
|
-
return detailInfo.data.desc;
|
|
11546
|
-
} catch (err) {
|
|
11547
|
-
console.error("❌ JSON 解析失败:", err);
|
|
11548
|
-
return null;
|
|
11584
|
+
};
|
|
11585
|
+
const final = filtered.slice(0, pageSize);
|
|
11586
|
+
const articleCell = await Promise.all(final.map(async (item)=>({
|
|
11587
|
+
title: item.display_title,
|
|
11588
|
+
imageUrl: item.images_list[0].url,
|
|
11589
|
+
createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
|
|
11590
|
+
redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
|
|
11591
|
+
readNum: item.view_count,
|
|
11592
|
+
likeNum: item.likes,
|
|
11593
|
+
commentNum: item.comments_count,
|
|
11594
|
+
collectNum: item.collected_count,
|
|
11595
|
+
shareNum: item.shared_count,
|
|
11596
|
+
...showOriginalData ? {
|
|
11597
|
+
originalData: item
|
|
11598
|
+
} : {},
|
|
11599
|
+
...containsArticle ? {
|
|
11600
|
+
article: await getDetailContent(item.id)
|
|
11601
|
+
} : {}
|
|
11602
|
+
})));
|
|
11603
|
+
return (0, share_namespaceObject.success)({
|
|
11604
|
+
articleCell,
|
|
11605
|
+
...onlySuccess ? {
|
|
11606
|
+
pagination: {
|
|
11607
|
+
nextPage: hasNextpage,
|
|
11608
|
+
pageNum,
|
|
11609
|
+
pageSize
|
|
11549
11610
|
}
|
|
11550
|
-
}
|
|
11551
|
-
|
|
11552
|
-
const articleCell = await Promise.all(final.map(async (item)=>({
|
|
11553
|
-
title: item.display_title,
|
|
11554
|
-
imageUrl: item.images_list[0].url,
|
|
11555
|
-
createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
|
|
11556
|
-
redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
|
|
11557
|
-
readNum: item.view_count,
|
|
11558
|
-
likeNum: item.likes,
|
|
11559
|
-
commentNum: item.comments_count,
|
|
11560
|
-
collectNum: item.collected_count,
|
|
11561
|
-
shareNum: item.shared_count,
|
|
11562
|
-
...showOriginalData ? {
|
|
11563
|
-
originalData: item
|
|
11564
|
-
} : {},
|
|
11565
|
-
...containsArticle ? {
|
|
11566
|
-
article: await getDetailContent(item.id)
|
|
11567
|
-
} : {}
|
|
11568
|
-
})));
|
|
11569
|
-
return (0, share_namespaceObject.success)({
|
|
11570
|
-
articleCell,
|
|
11571
|
-
...onlySuccess ? {
|
|
11572
|
-
pagination: {
|
|
11573
|
-
nextPage: hasNextpage,
|
|
11574
|
-
pageNum,
|
|
11575
|
-
pageSize
|
|
11576
|
-
}
|
|
11577
|
-
} : null
|
|
11578
|
-
}, "小红书文章数据获取成功");
|
|
11579
|
-
} catch (error) {
|
|
11580
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "小红书文章数据获取失败");
|
|
11581
|
-
}
|
|
11611
|
+
} : null
|
|
11612
|
+
}, "小红书文章数据获取成功");
|
|
11582
11613
|
}
|
|
11583
11614
|
const FetchArticlesParamsSchema = ActionCommonParamsSchema.extend({
|
|
11584
11615
|
platform: schemas_string().describe("社交平台:weixin, toutiao, baijiahao, xiaohongshu"),
|
|
@@ -12847,6 +12878,7 @@ var __webpack_exports__ = {};
|
|
|
12847
12878
|
};
|
|
12848
12879
|
const getAddTypeValue = (toutiaoAd)=>"yes" === toutiaoAd ? 3 : 2;
|
|
12849
12880
|
const toutiaoPublish = async (task, params)=>{
|
|
12881
|
+
params.content = formatSectionHtml(params.content);
|
|
12850
12882
|
if ("rpa" === params.actionType) return toutiaoPublish_rpa_rpaAction(task, params);
|
|
12851
12883
|
if ("mockApi" === params.actionType) return mock_mockAction(task, params);
|
|
12852
12884
|
return executeAction(mock_mockAction, toutiaoPublish_rpa_rpaAction)(task, params);
|
|
@@ -14766,6 +14798,7 @@ var __webpack_exports__ = {};
|
|
|
14766
14798
|
const params = defaultParams(_params, {
|
|
14767
14799
|
masssend: true
|
|
14768
14800
|
});
|
|
14801
|
+
params.content = formatSectionHtml(params.content);
|
|
14769
14802
|
if ("rpa" === params.actionType) return weixinPublish_rpa_rpaAction(task, params);
|
|
14770
14803
|
if ("mockApi" === params.actionType) return weixinPublish_mock_mockAction(task, params);
|
|
14771
14804
|
return executeAction(weixinPublish_mock_mockAction, weixinPublish_rpa_rpaAction)(task, params);
|
|
@@ -16903,6 +16936,20 @@ var __webpack_exports__ = {};
|
|
|
16903
16936
|
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
16904
16937
|
};
|
|
16905
16938
|
const xiaohongshuWebSearch_xsEncrypt = new Xhshow();
|
|
16939
|
+
const XhsWebSearchParamsSchema = ActionCommonParamsSchema.extend({
|
|
16940
|
+
keyword: schemas_string(),
|
|
16941
|
+
page: schemas_number(),
|
|
16942
|
+
page_size: schemas_number(),
|
|
16943
|
+
sort_type: schemas_enum([
|
|
16944
|
+
"general",
|
|
16945
|
+
"time_descending",
|
|
16946
|
+
"popular_descending"
|
|
16947
|
+
]),
|
|
16948
|
+
time_filter: schemas_enum([
|
|
16949
|
+
"不限",
|
|
16950
|
+
"一周内"
|
|
16951
|
+
])
|
|
16952
|
+
});
|
|
16906
16953
|
const createSearchId = ()=>{
|
|
16907
16954
|
let r = BigInt(Date.now());
|
|
16908
16955
|
const o = BigInt(Math.ceil(0x7ffffffe * Math.random()));
|
|
@@ -17017,7 +17064,7 @@ var __webpack_exports__ = {};
|
|
|
17017
17064
|
const data = isSuccess ? res.data : {};
|
|
17018
17065
|
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
17019
17066
|
};
|
|
17020
|
-
var package_namespaceObject = JSON.parse('{"i8":"1.2.30-beta.
|
|
17067
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.30-beta.2"}');
|
|
17021
17068
|
const BetaFlag = "HuiwenCanary";
|
|
17022
17069
|
class Action {
|
|
17023
17070
|
constructor(task){
|