@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.mjs
CHANGED
|
@@ -20,6 +20,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_fetch_7c57b483__ from "node-fetch";
|
|
|
20
20
|
import * as __WEBPACK_EXTERNAL_MODULE_form_data_cf000082__ from "form-data";
|
|
21
21
|
import * as __WEBPACK_EXTERNAL_MODULE_node_https_626f33a7__ from "node:https";
|
|
22
22
|
import * as __WEBPACK_EXTERNAL_MODULE_vm__ from "vm";
|
|
23
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__ from "node:vm";
|
|
23
24
|
var __webpack_modules__ = {
|
|
24
25
|
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
25
26
|
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
@@ -4353,6 +4354,7 @@ class Http {
|
|
|
4353
4354
|
return response;
|
|
4354
4355
|
}, (error)=>{
|
|
4355
4356
|
const foundError = findError(error.response);
|
|
4357
|
+
console.log(error);
|
|
4356
4358
|
const errorResponse = {
|
|
4357
4359
|
code: error.response?.status || 500,
|
|
4358
4360
|
message: error.message || "",
|
|
@@ -4373,44 +4375,49 @@ class Http {
|
|
|
4373
4375
|
errorResponse.data = serverError;
|
|
4374
4376
|
}
|
|
4375
4377
|
}
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
errorResponse.
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4378
|
+
let _message = error.message || "";
|
|
4379
|
+
if (error.code) {
|
|
4380
|
+
errorResponse.code = 401 === errorResponse.code ? 414 : errorResponse.code;
|
|
4381
|
+
switch(error.code){
|
|
4382
|
+
case "ECONNABORTED":
|
|
4383
|
+
_message = "请求超时,请检查网络连接!";
|
|
4384
|
+
break;
|
|
4385
|
+
case "ECONNRESET":
|
|
4386
|
+
_message = "连接被重置,请检查网络或稍后重试!";
|
|
4387
|
+
break;
|
|
4388
|
+
case "ENOTFOUND":
|
|
4389
|
+
_message = "域名解析失败,请检查 URL 是否正确!";
|
|
4390
|
+
break;
|
|
4391
|
+
case "ETIMEDOUT":
|
|
4392
|
+
_message = "网络请求超时,请检查网络连接!";
|
|
4393
|
+
break;
|
|
4394
|
+
case "ECONNREFUSED":
|
|
4395
|
+
_message = "服务器拒绝连接,请稍后重试!";
|
|
4396
|
+
break;
|
|
4397
|
+
case "EAI_AGAIN":
|
|
4398
|
+
_message = "DNS 查询超时,请稍后重试!";
|
|
4399
|
+
break;
|
|
4400
|
+
case "ERR_BAD_REQUEST":
|
|
4401
|
+
_message = "请求出现错误,请检查请求参数!";
|
|
4402
|
+
break;
|
|
4403
|
+
case "ERR_CANCELED":
|
|
4404
|
+
errorResponse.code = 414;
|
|
4405
|
+
_message = "请求连接超时,请稍候重试!";
|
|
4406
|
+
if (errorResponse.extra?.isProxyRequest) {
|
|
4407
|
+
_message = "代理连接建立超时,请更换区域或稍后重试!";
|
|
4408
|
+
errorResponse.code = 599;
|
|
4409
|
+
errorResponse.data = this.proxyInfo ? (0, __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__.createHash)("md5").update(this.proxyInfo.split(":")[0]).digest("hex") + this.proxyInfo.split(":")[1] : {};
|
|
4410
|
+
}
|
|
4411
|
+
break;
|
|
4412
|
+
default:
|
|
4413
|
+
this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
|
|
4414
|
+
errorString: stringifyError(error)
|
|
4415
|
+
});
|
|
4416
|
+
_message = `未知网络错误: ${error.message}`;
|
|
4417
|
+
break;
|
|
4418
|
+
}
|
|
4413
4419
|
}
|
|
4420
|
+
errorResponse.message = errorResponse.message ? errorResponse.message : _message;
|
|
4414
4421
|
if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
|
|
4415
4422
|
throw errorResponse;
|
|
4416
4423
|
});
|
|
@@ -4507,6 +4514,28 @@ const extractImgTag = (html)=>{
|
|
|
4507
4514
|
parser.end();
|
|
4508
4515
|
return srcList;
|
|
4509
4516
|
};
|
|
4517
|
+
const formatSectionHtml = (html)=>{
|
|
4518
|
+
const handler = new __WEBPACK_EXTERNAL_MODULE_domhandler__.DomHandler();
|
|
4519
|
+
const parser = new __WEBPACK_EXTERNAL_MODULE_htmlparser2__.Parser(handler, {
|
|
4520
|
+
decodeEntities: false
|
|
4521
|
+
});
|
|
4522
|
+
parser.write(html);
|
|
4523
|
+
parser.end();
|
|
4524
|
+
const dom = handler.dom;
|
|
4525
|
+
const sections = __WEBPACK_EXTERNAL_MODULE_htmlparser2__.DomUtils.findAll((node)=>"tag" === node.type && "section" === node.name, dom);
|
|
4526
|
+
sections.forEach((section)=>{
|
|
4527
|
+
const imgs = __WEBPACK_EXTERNAL_MODULE_htmlparser2__.DomUtils.findAll((node)=>"tag" === node.type && "img" === node.name, section.children || []);
|
|
4528
|
+
if (0 === imgs.length) return;
|
|
4529
|
+
const hasValidImg = imgs.some((img)=>{
|
|
4530
|
+
const src = img.attribs?.src?.trim();
|
|
4531
|
+
return Boolean(src);
|
|
4532
|
+
});
|
|
4533
|
+
if (!hasValidImg) __WEBPACK_EXTERNAL_MODULE_htmlparser2__.DomUtils.removeElement(section);
|
|
4534
|
+
});
|
|
4535
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_dom_serializer_aa70940b__["default"])(dom, {
|
|
4536
|
+
encodeEntities: false
|
|
4537
|
+
});
|
|
4538
|
+
};
|
|
4510
4539
|
(function(TimeFormatter) {
|
|
4511
4540
|
function format(timestamp, formatStr = "yyyy-MM-dd hh:mm") {
|
|
4512
4541
|
if (10 === timestamp.toString().length) timestamp *= 1000;
|
|
@@ -7642,7 +7671,7 @@ const classic_parse_parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
|
7642
7671
|
const parse_safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
7643
7672
|
const parse_safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
7644
7673
|
const parse_encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
7645
|
-
const
|
|
7674
|
+
const parse_decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
7646
7675
|
const parse_encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
7647
7676
|
const parse_decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
7648
7677
|
const parse_safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
@@ -7686,7 +7715,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def)=>{
|
|
|
7686
7715
|
inst.safeParseAsync = async (data, params)=>parse_safeParseAsync(inst, data, params);
|
|
7687
7716
|
inst.spa = inst.safeParseAsync;
|
|
7688
7717
|
inst.encode = (data, params)=>parse_encode(inst, data, params);
|
|
7689
|
-
inst.decode = (data, params)=>
|
|
7718
|
+
inst.decode = (data, params)=>parse_decode(inst, data, params);
|
|
7690
7719
|
inst.encodeAsync = async (data, params)=>parse_encodeAsync(inst, data, params);
|
|
7691
7720
|
inst.decodeAsync = async (data, params)=>parse_decodeAsync(inst, data, params);
|
|
7692
7721
|
inst.safeEncode = (data, params)=>parse_safeEncode(inst, data, params);
|
|
@@ -8908,6 +8937,7 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
8908
8937
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(articleId, articleId ? "发布成功" : message);
|
|
8909
8938
|
};
|
|
8910
8939
|
const baijiahaoPublish = async (task, params)=>{
|
|
8940
|
+
params.content = formatSectionHtml(params.content);
|
|
8911
8941
|
if ("rpa" === params.actionType) return rpa_rpaAction(task, params);
|
|
8912
8942
|
if ("mockApi" === params.actionType) return mockAction(task, params);
|
|
8913
8943
|
return executeAction(mockAction, rpa_rpaAction)(task, params);
|
|
@@ -10625,57 +10655,54 @@ const types_errorResponse = (message, code = 500)=>({
|
|
|
10625
10655
|
data: null
|
|
10626
10656
|
});
|
|
10627
10657
|
async function getBaijiahaoData(_task, params) {
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10658
|
+
const { token } = params;
|
|
10659
|
+
if (!token) return types_errorResponse("缺少token", 414);
|
|
10660
|
+
const http = new Http({
|
|
10661
|
+
headers: {
|
|
10662
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
10663
|
+
token: String(token),
|
|
10664
|
+
Referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
10665
|
+
}
|
|
10666
|
+
});
|
|
10667
|
+
const yesterday = utils_TimeFormatter.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
|
|
10668
|
+
const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
|
|
10669
|
+
http.api({
|
|
10670
|
+
method: "get",
|
|
10671
|
+
url: "https://baijiahao.baidu.com/pcui/home/index"
|
|
10672
|
+
}),
|
|
10673
|
+
http.api({
|
|
10674
|
+
method: "get",
|
|
10675
|
+
url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
|
|
10676
|
+
}),
|
|
10677
|
+
http.api({
|
|
10678
|
+
method: "get",
|
|
10679
|
+
url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
|
|
10680
|
+
}),
|
|
10681
|
+
http.api({
|
|
10682
|
+
method: "get",
|
|
10683
|
+
url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
|
|
10684
|
+
params: {
|
|
10685
|
+
type: "all",
|
|
10686
|
+
is_yesterday: false,
|
|
10687
|
+
start_day: yesterday,
|
|
10688
|
+
end_day: yesterday,
|
|
10689
|
+
stat: 0
|
|
10636
10690
|
}
|
|
10637
|
-
})
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
http.api({
|
|
10653
|
-
method: "get",
|
|
10654
|
-
url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
|
|
10655
|
-
params: {
|
|
10656
|
-
type: "all",
|
|
10657
|
-
is_yesterday: false,
|
|
10658
|
-
start_day: yesterday,
|
|
10659
|
-
end_day: yesterday,
|
|
10660
|
-
stat: 0
|
|
10661
|
-
}
|
|
10662
|
-
})
|
|
10663
|
-
]);
|
|
10664
|
-
const bjhData = {
|
|
10665
|
-
fansNum: fansData.data.coreData.fansCount,
|
|
10666
|
-
fansNumYesterday: -1 === yesterdayData.data.data.fans_increase ? null : yesterdayData.data.data.fans_increase,
|
|
10667
|
-
readNum: readData.data.total.view_count,
|
|
10668
|
-
incomeNum: incomeData.data.all_income.total_income,
|
|
10669
|
-
incomeNumYesterday: -1 === incomeData.data.all_income.yesterday_income ? null : incomeData.data.all_income.yesterday_income,
|
|
10670
|
-
recommendNumYesterday: -1 === yesterdayData.data.data.recommend_count ? null : yesterdayData.data.data.recommend_count,
|
|
10671
|
-
readNumYesterday: -1 === yesterdayData.data.data.view_count ? null : yesterdayData.data.data.view_count,
|
|
10672
|
-
likeNumYesterday: -1 === yesterdayData.data.data.likes_count ? null : yesterdayData.data.data.likes_count,
|
|
10673
|
-
commentNumYesterday: -1 === yesterdayData.data.data.comment_count ? null : yesterdayData.data.data.comment_count
|
|
10674
|
-
};
|
|
10675
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(bjhData, "百家号平台数据获取成功!");
|
|
10676
|
-
} catch (error) {
|
|
10677
|
-
return types_errorResponse(error instanceof Error ? error.message : "百家号平台数据获取失败");
|
|
10678
|
-
}
|
|
10691
|
+
})
|
|
10692
|
+
]);
|
|
10693
|
+
if (0 !== fansData.errno || 0 !== readData.errno || 0 !== incomeData.errno || 0 !== yesterdayData.errno) return types_errorResponse("百家号数据获取失败,请检查账号状态", 414);
|
|
10694
|
+
const bjhData = {
|
|
10695
|
+
fansNum: fansData.data.coreData.fansCount,
|
|
10696
|
+
fansNumYesterday: -1 === yesterdayData.data.data.fans_increase ? null : yesterdayData.data.data.fans_increase,
|
|
10697
|
+
readNum: readData.data.total.view_count,
|
|
10698
|
+
incomeNum: incomeData.data.all_income.total_income,
|
|
10699
|
+
incomeNumYesterday: -1 === incomeData.data.all_income.yesterday_income ? null : incomeData.data.all_income.yesterday_income,
|
|
10700
|
+
recommendNumYesterday: -1 === yesterdayData.data.data.recommend_count ? null : yesterdayData.data.data.recommend_count,
|
|
10701
|
+
readNumYesterday: -1 === yesterdayData.data.data.view_count ? null : yesterdayData.data.data.view_count,
|
|
10702
|
+
likeNumYesterday: -1 === yesterdayData.data.data.likes_count ? null : yesterdayData.data.data.likes_count,
|
|
10703
|
+
commentNumYesterday: -1 === yesterdayData.data.data.comment_count ? null : yesterdayData.data.data.comment_count
|
|
10704
|
+
};
|
|
10705
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(bjhData, "百家号平台数据获取成功!");
|
|
10679
10706
|
}
|
|
10680
10707
|
async function getToutiaoData(_task, params) {
|
|
10681
10708
|
const http = new Http({
|
|
@@ -10744,112 +10771,102 @@ async function getWeixinData(_task, params) {
|
|
|
10744
10771
|
message: "缺少token",
|
|
10745
10772
|
data: null
|
|
10746
10773
|
};
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
shareNumYesterday: userSummaryJson.share_summary.filter((it)=>1 === it.data_range_type)[0]?.data_value || 0
|
|
10787
|
-
};
|
|
10788
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(wxData, "微信平台数据获取成功!");
|
|
10789
|
-
} catch (error) {
|
|
10790
|
-
return types_errorResponse(error instanceof Error ? error.message : "微信平台数据获取失败");
|
|
10791
|
-
}
|
|
10774
|
+
const http = new Http({
|
|
10775
|
+
headers: {
|
|
10776
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
10777
|
+
}
|
|
10778
|
+
});
|
|
10779
|
+
const userInfoHtmlPromise = http.api({
|
|
10780
|
+
method: "get",
|
|
10781
|
+
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
10782
|
+
params: {
|
|
10783
|
+
t: "home/index",
|
|
10784
|
+
token,
|
|
10785
|
+
lang: "zh_CN"
|
|
10786
|
+
}
|
|
10787
|
+
});
|
|
10788
|
+
const userSummaryHtmlPromise = http.api({
|
|
10789
|
+
method: "get",
|
|
10790
|
+
url: "https://mp.weixin.qq.com/misc/appmsganalysis",
|
|
10791
|
+
params: {
|
|
10792
|
+
token,
|
|
10793
|
+
lang: "zh_CN",
|
|
10794
|
+
type: "daily_v2",
|
|
10795
|
+
action: "report",
|
|
10796
|
+
indicatorSelect: "read"
|
|
10797
|
+
}
|
|
10798
|
+
});
|
|
10799
|
+
const [userInfoHtml, userSummaryHtml] = await Promise.all([
|
|
10800
|
+
userInfoHtmlPromise,
|
|
10801
|
+
userSummaryHtmlPromise
|
|
10802
|
+
]);
|
|
10803
|
+
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("Token已失效,请重新获取", 414);
|
|
10804
|
+
const userInfoJson = exportWxCgiData(userInfoHtml);
|
|
10805
|
+
const userSummaryJson = exportWxCgiData(userSummaryHtml);
|
|
10806
|
+
const wxData = {
|
|
10807
|
+
fansNum: userInfoJson.total_friend_cnt,
|
|
10808
|
+
fansNumYesterday: userInfoJson.new_friend_cnt,
|
|
10809
|
+
readNumYesterday: userSummaryJson.read_summary.filter((it)=>1 === it.data_range_type)[0]?.data_value || 0,
|
|
10810
|
+
shareNumYesterday: userSummaryJson.share_summary.filter((it)=>1 === it.data_range_type)[0]?.data_value || 0
|
|
10811
|
+
};
|
|
10812
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(wxData, "微信平台数据获取成功!");
|
|
10792
10813
|
}
|
|
10793
10814
|
async function getXiaohongshuData(_task, params) {
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(xhsData, "小红书平台数据获取成功!");
|
|
10850
|
-
} catch (error) {
|
|
10851
|
-
return types_errorResponse(error instanceof Error ? error.message : "小红书平台数据获取失败");
|
|
10852
|
-
}
|
|
10815
|
+
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
10816
|
+
if (!a1Cookie) return types_errorResponse("账号数据异常,请重新绑定账号后重试。", 414);
|
|
10817
|
+
const headers = {
|
|
10818
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
10819
|
+
referer: "https://creator.xiaohongshu.com",
|
|
10820
|
+
origin: "https://creator.xiaohongshu.com"
|
|
10821
|
+
};
|
|
10822
|
+
const args = [
|
|
10823
|
+
{
|
|
10824
|
+
headers
|
|
10825
|
+
},
|
|
10826
|
+
_task.logger,
|
|
10827
|
+
params.proxyLoc,
|
|
10828
|
+
params.localIP,
|
|
10829
|
+
params.accountId
|
|
10830
|
+
];
|
|
10831
|
+
const http = new Http(...args);
|
|
10832
|
+
const xsEncrypt = new Xhshow();
|
|
10833
|
+
const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
|
|
10834
|
+
const recordCookie = params.cookies.reduce((acc, cookie)=>{
|
|
10835
|
+
if (cookie.name && cookie.value) acc[cookie.name] = cookie.value;
|
|
10836
|
+
return acc;
|
|
10837
|
+
}, {});
|
|
10838
|
+
const sevenDataXsHeader = xsEncrypt.signHeadersGet(sevenDataUrl, recordCookie, "xhs-pc-web", null);
|
|
10839
|
+
const [overAllData, sevenData] = await Promise.all([
|
|
10840
|
+
http.api({
|
|
10841
|
+
method: "get",
|
|
10842
|
+
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
10843
|
+
}, {
|
|
10844
|
+
retries: 3,
|
|
10845
|
+
retryDelay: 20,
|
|
10846
|
+
timeout: 3000
|
|
10847
|
+
}),
|
|
10848
|
+
http.api({
|
|
10849
|
+
method: "get",
|
|
10850
|
+
baseURL: "https://creator.xiaohongshu.com",
|
|
10851
|
+
url: sevenDataUrl,
|
|
10852
|
+
headers: sevenDataXsHeader
|
|
10853
|
+
}, {
|
|
10854
|
+
retries: 3,
|
|
10855
|
+
retryDelay: 20,
|
|
10856
|
+
timeout: 3000
|
|
10857
|
+
})
|
|
10858
|
+
]);
|
|
10859
|
+
const xhsData = {
|
|
10860
|
+
fansNum: overAllData.data.fans_count,
|
|
10861
|
+
favedNum: overAllData.data.faved_count,
|
|
10862
|
+
watchNumLastWeek: sevenData.data.seven.view_count,
|
|
10863
|
+
likeNumLastWeek: sevenData.data.seven.like_count,
|
|
10864
|
+
collectNumLastWeek: sevenData.data.seven.collect_count,
|
|
10865
|
+
commentNumLastWeek: sevenData.data.seven.comment_count,
|
|
10866
|
+
fansNumLastWeek: sevenData.data.seven.rise_fans_count,
|
|
10867
|
+
fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
|
|
10868
|
+
};
|
|
10869
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(xhsData, "小红书平台数据获取成功!");
|
|
10853
10870
|
}
|
|
10854
10871
|
const SearchAccountInfoParamsSchema = ActionCommonParamsSchema.extend({
|
|
10855
10872
|
token: union([
|
|
@@ -10975,6 +10992,12 @@ const FetchArticlesDataSchema = schemas_object({
|
|
|
10975
10992
|
BaijiahaoArticleSchema,
|
|
10976
10993
|
XiaohongshuArticleSchema
|
|
10977
10994
|
])).optional(),
|
|
10995
|
+
timerPublish: schemas_array(union([
|
|
10996
|
+
ToutiaoArticleSchema,
|
|
10997
|
+
WeixinArticleSchema,
|
|
10998
|
+
BaijiahaoArticleSchema,
|
|
10999
|
+
XiaohongshuArticleSchema
|
|
11000
|
+
])).optional(),
|
|
10978
11001
|
pagination: schemas_object({
|
|
10979
11002
|
total: schemas_number().optional(),
|
|
10980
11003
|
nextPage: schemas_boolean().optional(),
|
|
@@ -11019,6 +11042,7 @@ async function handleBaijiahaoData(_task, params) {
|
|
|
11019
11042
|
});
|
|
11020
11043
|
}
|
|
11021
11044
|
const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
|
|
11045
|
+
if (0 !== articleInfo.errno) return searchPublishInfo_types_errorResponse("百家号数据获取失败,请检查账号状态", 414);
|
|
11022
11046
|
const filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
|
|
11023
11047
|
const totalPage = articleInfo.data.page?.totalPage || 1;
|
|
11024
11048
|
let currentPage = pageNum + 1;
|
|
@@ -11119,6 +11143,7 @@ async function handleToutiaoData(_task, params) {
|
|
|
11119
11143
|
app_id: 1231
|
|
11120
11144
|
}
|
|
11121
11145
|
});
|
|
11146
|
+
if (0 !== visitedUid.code) return searchPublishInfo_types_errorResponse("头条号账号信息获取失败,请检查账号状态", 414);
|
|
11122
11147
|
const articleInfo = await http.api({
|
|
11123
11148
|
method: "get",
|
|
11124
11149
|
url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
|
|
@@ -11172,188 +11197,159 @@ async function handleToutiaoData(_task, params) {
|
|
|
11172
11197
|
}
|
|
11173
11198
|
}
|
|
11174
11199
|
async function handleWeixinData(_task, params) {
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
const
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
const decodeEntities = (str, decode = false)=>{
|
|
11192
|
-
const encodeMap = [
|
|
11193
|
-
"&",
|
|
11194
|
-
"&",
|
|
11195
|
-
"<",
|
|
11196
|
-
"<",
|
|
11197
|
-
">",
|
|
11198
|
-
">",
|
|
11199
|
-
" ",
|
|
11200
|
-
" ",
|
|
11201
|
-
'"',
|
|
11202
|
-
""",
|
|
11203
|
-
"'",
|
|
11204
|
-
"'"
|
|
11205
|
-
];
|
|
11206
|
-
const decodeMap = [
|
|
11207
|
-
"'",
|
|
11208
|
-
"'",
|
|
11209
|
-
""",
|
|
11210
|
-
'"',
|
|
11211
|
-
" ",
|
|
11212
|
-
" ",
|
|
11213
|
-
">",
|
|
11214
|
-
">",
|
|
11215
|
-
"<",
|
|
11216
|
-
"<",
|
|
11217
|
-
"&",
|
|
11218
|
-
"&",
|
|
11219
|
-
"<",
|
|
11220
|
-
"<",
|
|
11221
|
-
">",
|
|
11222
|
-
">"
|
|
11223
|
-
];
|
|
11224
|
-
const map = decode ? decodeMap : encodeMap;
|
|
11225
|
-
let result = str;
|
|
11226
|
-
for(let i = 0; i < map.length; i += 2)result = result.replace(new RegExp(map[i], "g"), map[i + 1]);
|
|
11227
|
-
return result;
|
|
11228
|
-
};
|
|
11229
|
-
const finalData = {
|
|
11230
|
-
...parsedData,
|
|
11231
|
-
publish_list: parsedData.publish_list.map((item)=>{
|
|
11232
|
-
const decoded = decodeEntities(item.publish_info, true);
|
|
11233
|
-
const parsedInfo = JSON.parse(decoded);
|
|
11234
|
-
return {
|
|
11235
|
-
publish_type: item.publish_type,
|
|
11236
|
-
publish_info: parsedInfo
|
|
11237
|
-
};
|
|
11238
|
-
})
|
|
11239
|
-
};
|
|
11240
|
-
return finalData;
|
|
11200
|
+
const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, cursor, lastPage, containsArticle = false } = params;
|
|
11201
|
+
if (!token) return {
|
|
11202
|
+
code: 414,
|
|
11203
|
+
message: "缺少token",
|
|
11204
|
+
data: {}
|
|
11205
|
+
};
|
|
11206
|
+
const http = new Http({
|
|
11207
|
+
headers: {
|
|
11208
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
11209
|
+
}
|
|
11210
|
+
});
|
|
11211
|
+
const ParsePublishPage = (html)=>{
|
|
11212
|
+
const document1 = (0, __WEBPACK_EXTERNAL_MODULE_htmlparser2__.parseDocument)(html);
|
|
11213
|
+
const scripts = __WEBPACK_EXTERNAL_MODULE_htmlparser2__.DomUtils.findAll((el)=>"script" === el.type, document1.children);
|
|
11214
|
+
const sandbox = {
|
|
11215
|
+
window: {}
|
|
11241
11216
|
};
|
|
11242
|
-
|
|
11243
|
-
|
|
11244
|
-
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11251
|
-
|
|
11217
|
+
__WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__["default"].createContext(sandbox);
|
|
11218
|
+
for (const script of scripts){
|
|
11219
|
+
const code = __WEBPACK_EXTERNAL_MODULE_htmlparser2__.DomUtils.textContent(script);
|
|
11220
|
+
if (!!code) {
|
|
11221
|
+
if (code.includes("publish_page")) {
|
|
11222
|
+
const replaceCode = code.replace("publish_page =", "window.publish_page =");
|
|
11223
|
+
try {
|
|
11224
|
+
__WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__["default"].runInContext(replaceCode, sandbox, {
|
|
11225
|
+
timeout: 1000
|
|
11226
|
+
});
|
|
11227
|
+
} catch (e) {}
|
|
11252
11228
|
}
|
|
11253
|
-
});
|
|
11254
|
-
}
|
|
11255
|
-
const size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
|
|
11256
|
-
let begin = (lastPage ?? pageNum) - 1;
|
|
11257
|
-
const rawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
11258
|
-
const articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
11259
|
-
let articleCell = [];
|
|
11260
|
-
if (!onlySuccess && pageSize > 20) {
|
|
11261
|
-
let totalFetched = articlesInfo.publish_list.length;
|
|
11262
|
-
let nextPage = pageNum + 1;
|
|
11263
|
-
while(totalFetched < pageSize){
|
|
11264
|
-
const remaining = pageSize - totalFetched;
|
|
11265
|
-
const currentPageSize = remaining > 20 ? 20 : remaining;
|
|
11266
|
-
const _rawArticlesInfo = await fetchArticles((nextPage - 1) * 20, currentPageSize, token);
|
|
11267
|
-
const parsed = ParsePublishPage(_rawArticlesInfo);
|
|
11268
|
-
articlesInfo.publish_list = articlesInfo.publish_list.concat(parsed.publish_list);
|
|
11269
|
-
totalFetched = articlesInfo.publish_list.length;
|
|
11270
|
-
if (parsed.publish_list.length < currentPageSize) break;
|
|
11271
|
-
nextPage++;
|
|
11272
11229
|
}
|
|
11273
11230
|
}
|
|
11274
|
-
|
|
11275
|
-
|
|
11276
|
-
|
|
11277
|
-
|
|
11278
|
-
|
|
11279
|
-
|
|
11280
|
-
|
|
11281
|
-
|
|
11282
|
-
|
|
11283
|
-
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
|
|
11287
|
-
|
|
11288
|
-
|
|
11231
|
+
const decodeHtmlEntities = (encodedStr)=>encodedStr.replace(/"/g, '"').replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'");
|
|
11232
|
+
sandbox.window.publish_page.publish_list.forEach((it)=>{
|
|
11233
|
+
it.publish_info = JSON.parse(decodeHtmlEntities(it.publish_info));
|
|
11234
|
+
});
|
|
11235
|
+
return sandbox.window.publish_page;
|
|
11236
|
+
};
|
|
11237
|
+
async function fetchArticles(begin, pageSize, token) {
|
|
11238
|
+
return http.api({
|
|
11239
|
+
method: "get",
|
|
11240
|
+
url: "https://mp.weixin.qq.com/cgi-bin/appmsgpublish",
|
|
11241
|
+
params: {
|
|
11242
|
+
sub: "list",
|
|
11243
|
+
begin: begin,
|
|
11244
|
+
count: pageSize,
|
|
11245
|
+
token: token,
|
|
11246
|
+
lang: "zh_CN"
|
|
11289
11247
|
}
|
|
11290
|
-
|
|
11248
|
+
});
|
|
11249
|
+
}
|
|
11250
|
+
const size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
|
|
11251
|
+
let begin = (lastPage ?? pageNum) - 1;
|
|
11252
|
+
const rawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
11253
|
+
if (rawArticlesInfo.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return searchPublishInfo_types_errorResponse("登陆已失效,请重新登陆!", 414);
|
|
11254
|
+
const articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
11255
|
+
let articleCell = [];
|
|
11256
|
+
if (!onlySuccess && pageSize > 20) {
|
|
11257
|
+
let totalFetched = articlesInfo.publish_list.length;
|
|
11258
|
+
let nextPage = pageNum + 1;
|
|
11259
|
+
while(totalFetched < pageSize){
|
|
11260
|
+
const remaining = pageSize - totalFetched;
|
|
11261
|
+
const currentPageSize = remaining > 20 ? 20 : remaining;
|
|
11262
|
+
const _rawArticlesInfo = await fetchArticles((nextPage - 1) * 20, currentPageSize, token);
|
|
11263
|
+
const parsed = ParsePublishPage(_rawArticlesInfo);
|
|
11264
|
+
articlesInfo.publish_list = articlesInfo.publish_list.concat(parsed.publish_list);
|
|
11265
|
+
totalFetched = articlesInfo.publish_list.length;
|
|
11266
|
+
if (parsed.publish_list.length < currentPageSize) break;
|
|
11267
|
+
nextPage++;
|
|
11268
|
+
}
|
|
11269
|
+
}
|
|
11270
|
+
let nextPage = false;
|
|
11271
|
+
if (onlySuccess) {
|
|
11272
|
+
let filteredList = articlesInfo.publish_list.filter((item)=>-1 === item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
|
|
11273
|
+
if (cursor) {
|
|
11274
|
+
const cursorIndex = filteredList.findIndex((item)=>item.msgid === cursor);
|
|
11275
|
+
if (-1 !== cursorIndex) filteredList = filteredList.slice(cursorIndex + 1);
|
|
11276
|
+
}
|
|
11277
|
+
let totalFetched = filteredList.length;
|
|
11278
|
+
while(totalFetched < pageSize && begin * size < articlesInfo.total_count){
|
|
11279
|
+
begin += 1;
|
|
11280
|
+
const nextRawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
11281
|
+
const nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
|
|
11282
|
+
const newFiltered = nextArticlesInfo.publish_list.filter((item)=>-1 === item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
|
|
11283
|
+
filteredList = filteredList.concat(newFiltered);
|
|
11291
11284
|
totalFetched = filteredList.length;
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
const
|
|
11298
|
-
|
|
11299
|
-
|
|
11300
|
-
|
|
11301
|
-
|
|
11302
|
-
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11316
|
-
if (!text) {
|
|
11317
|
-
const isCheckPass = detailInfo.indexOf("环境异常");
|
|
11318
|
-
if (isCheckPass > -1) return "当前环境异常,无法获取文章内容";
|
|
11319
|
-
return null;
|
|
11285
|
+
}
|
|
11286
|
+
filteredList = filteredList.slice(0, pageSize);
|
|
11287
|
+
totalFetched = filteredList.length;
|
|
11288
|
+
if (totalFetched >= pageSize && begin * size < articlesInfo.total_count) {
|
|
11289
|
+
const nextRawArticlesInfo = await fetchArticles((begin + 1) * size, size, token);
|
|
11290
|
+
const nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
|
|
11291
|
+
nextPage = nextArticlesInfo.publish_list.length > 0 && nextArticlesInfo.publish_list.some((item)=>-1 === item.publish_info.appmsg_info[0].content_url.indexOf("tempkey"));
|
|
11292
|
+
}
|
|
11293
|
+
const getDetailContent = async (id)=>{
|
|
11294
|
+
try {
|
|
11295
|
+
const detailInfo = await http.api({
|
|
11296
|
+
method: "get",
|
|
11297
|
+
url: "https://mp.weixin.qq.com/cgi-bin/appmsg",
|
|
11298
|
+
params: {
|
|
11299
|
+
token,
|
|
11300
|
+
t: "media/appmsg_edit",
|
|
11301
|
+
action: "edit",
|
|
11302
|
+
type: 77,
|
|
11303
|
+
appmsgid: id,
|
|
11304
|
+
isMul: 1,
|
|
11305
|
+
get_delete: 1,
|
|
11306
|
+
re_edit: 1,
|
|
11307
|
+
lang: "zh_CN",
|
|
11308
|
+
timestamp: Date.now()
|
|
11320
11309
|
}
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11310
|
+
});
|
|
11311
|
+
const text = detailInfo.match(/var\s+infos\s*=\s*({[\s\S]*?})\s*,\s*item\s*=/);
|
|
11312
|
+
if (!text) {
|
|
11313
|
+
const isCheckPass = detailInfo.indexOf("环境异常");
|
|
11314
|
+
if (isCheckPass > -1) return "当前环境异常,无法获取文章内容";
|
|
11325
11315
|
return null;
|
|
11326
11316
|
}
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11317
|
+
const deatil = JSON.parse(text[1].trim());
|
|
11318
|
+
return deatil.item[0].content;
|
|
11319
|
+
} catch (err) {
|
|
11320
|
+
console.error("❌ 解析失败:", err);
|
|
11321
|
+
return null;
|
|
11322
|
+
}
|
|
11323
|
+
};
|
|
11324
|
+
const lastMsgId = filteredList.length > 0 ? filteredList[filteredList.length - 1].msgid : void 0;
|
|
11325
|
+
articleCell = await Promise.all(filteredList.map(async (item)=>({
|
|
11326
|
+
title: item.appmsg_info[0].title,
|
|
11327
|
+
imageUrl: item.appmsg_info[0].cover,
|
|
11328
|
+
createTime: item.appmsg_info[0].line_info.send_time,
|
|
11329
|
+
redirectUrl: item.appmsg_info[0].content_url,
|
|
11330
|
+
readNum: item.appmsg_info[0].read_num,
|
|
11331
|
+
likeNum: item.appmsg_info[0].old_like_num,
|
|
11332
|
+
shareNum: item.appmsg_info[0].share_num,
|
|
11333
|
+
recommendNum: item.appmsg_info[0].like_num,
|
|
11334
|
+
...showOriginalData ? {
|
|
11335
|
+
originalData: item
|
|
11336
|
+
} : {},
|
|
11337
|
+
...containsArticle ? {
|
|
11338
|
+
article: await getDetailContent(item.msgid)
|
|
11339
|
+
} : {}
|
|
11340
|
+
})));
|
|
11341
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
11342
|
+
articleCell,
|
|
11343
|
+
pagination: {
|
|
11344
|
+
nextPage,
|
|
11345
|
+
pageNum,
|
|
11346
|
+
pageSize,
|
|
11347
|
+
lastPage: begin + 1,
|
|
11348
|
+
cursor: lastMsgId
|
|
11349
|
+
}
|
|
11350
|
+
}, "微信文章文章获取成功");
|
|
11351
|
+
}
|
|
11352
|
+
const BasePublishBUilder = (publishInfo)=>publishInfo.map((item)=>({
|
|
11357
11353
|
title: item.publish_info.appmsg_info[0].title,
|
|
11358
11354
|
imageUrl: item.publish_info.appmsg_info[0].cover,
|
|
11359
11355
|
createTime: item.publish_info.appmsg_info[0].line_info.send_time,
|
|
@@ -11366,140 +11362,173 @@ async function handleWeixinData(_task, params) {
|
|
|
11366
11362
|
originalData: item
|
|
11367
11363
|
} : {}
|
|
11368
11364
|
}));
|
|
11369
|
-
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11365
|
+
articleCell = BasePublishBUilder(articlesInfo.publish_list);
|
|
11366
|
+
const timerPublishData = await http.api({
|
|
11367
|
+
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
11368
|
+
method: "get",
|
|
11369
|
+
params: {
|
|
11370
|
+
t: "home/index",
|
|
11371
|
+
token,
|
|
11372
|
+
lang: "zh_CN"
|
|
11373
|
+
}
|
|
11374
|
+
});
|
|
11375
|
+
const decodeTimerPublishData = (html)=>{
|
|
11376
|
+
const document1 = (0, __WEBPACK_EXTERNAL_MODULE_htmlparser2__.parseDocument)(html);
|
|
11377
|
+
const scripts = __WEBPACK_EXTERNAL_MODULE_htmlparser2__.DomUtils.findAll((el)=>"script" === el.type, document1.children);
|
|
11378
|
+
const sandbox = {
|
|
11379
|
+
window: {}
|
|
11380
|
+
};
|
|
11381
|
+
__WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__["default"].createContext(sandbox);
|
|
11382
|
+
for (const script of scripts){
|
|
11383
|
+
let code = __WEBPACK_EXTERNAL_MODULE_htmlparser2__.DomUtils.textContent(script);
|
|
11384
|
+
if (!!code) {
|
|
11385
|
+
if (code.includes("wx.cgiData")) {
|
|
11386
|
+
code = code.replace("wx.cgiData", "window.wx.cgiData");
|
|
11387
|
+
try {
|
|
11388
|
+
__WEBPACK_EXTERNAL_MODULE_node_vm_bd3d9cea__["default"].runInContext(code, sandbox, {
|
|
11389
|
+
timeout: 1000
|
|
11390
|
+
});
|
|
11391
|
+
} catch (e) {}
|
|
11392
|
+
}
|
|
11393
|
+
}
|
|
11394
|
+
}
|
|
11395
|
+
if (!sandbox.window.wx || !sandbox.window.wx.cgiData || !sandbox.window.wx.cgiData.timesend_msg) return [];
|
|
11396
|
+
const timesend_msg = JSON.parse(sandbox.window.wx.cgiData.timesend_msg);
|
|
11397
|
+
return timesend_msg.sent_list.map((it)=>({
|
|
11398
|
+
publish_info: it
|
|
11399
|
+
}));
|
|
11400
|
+
};
|
|
11401
|
+
const timmerPublish = decodeTimerPublishData(timerPublishData);
|
|
11402
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
11403
|
+
...0 === timmerPublish.length ? {} : {
|
|
11404
|
+
timmerPublish: BasePublishBUilder(timmerPublish)
|
|
11405
|
+
},
|
|
11406
|
+
articleCell
|
|
11407
|
+
}, "微信文章文章获取成功");
|
|
11375
11408
|
}
|
|
11376
11409
|
async function handleXiaohongshuData(_task, params) {
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11394
|
-
|
|
11410
|
+
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, containsArticle = false } = params;
|
|
11411
|
+
const xsEncrypt = new Xhshow();
|
|
11412
|
+
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
11413
|
+
if (!a1Cookie) return {
|
|
11414
|
+
code: 414,
|
|
11415
|
+
message: "账号数据异常",
|
|
11416
|
+
data: {}
|
|
11417
|
+
};
|
|
11418
|
+
if (onlySuccess && 10 !== pageSize) return {
|
|
11419
|
+
code: 414,
|
|
11420
|
+
message: "小红书pageSize不可修改",
|
|
11421
|
+
data: {}
|
|
11422
|
+
};
|
|
11423
|
+
const headers = {
|
|
11424
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11425
|
+
referer: "https://creator.xiaohongshu.com",
|
|
11426
|
+
origin: "https://creator.xiaohongshu.com"
|
|
11427
|
+
};
|
|
11428
|
+
const args = [
|
|
11429
|
+
{
|
|
11430
|
+
headers
|
|
11431
|
+
},
|
|
11432
|
+
_task.logger,
|
|
11433
|
+
params.proxyLoc,
|
|
11434
|
+
params.localIP,
|
|
11435
|
+
params.accountId
|
|
11436
|
+
];
|
|
11437
|
+
const http = new Http(...args);
|
|
11438
|
+
const recordCookie = params.cookies.reduce((acc, cookie)=>{
|
|
11439
|
+
if (cookie.name && cookie.value) acc[cookie.name] = cookie.value;
|
|
11440
|
+
return acc;
|
|
11441
|
+
}, {});
|
|
11442
|
+
async function fetchArticles(pageNum, onlySuccess = false) {
|
|
11443
|
+
const serveUrl = "/web_api/sns/v5/creator/note/user/posted";
|
|
11444
|
+
const serveParams = {
|
|
11445
|
+
tab: onlySuccess ? 1 : 0,
|
|
11446
|
+
page: pageNum - 1
|
|
11395
11447
|
};
|
|
11396
|
-
const
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
params
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11448
|
+
const serveXsHeader = xsEncrypt.signHeadersGet(serveUrl, recordCookie, "xhs-pc-web", serveParams);
|
|
11449
|
+
return await http.api({
|
|
11450
|
+
method: "get",
|
|
11451
|
+
baseURL: "https://edith.xiaohongshu.com",
|
|
11452
|
+
url: serveUrl,
|
|
11453
|
+
headers: serveXsHeader,
|
|
11454
|
+
params: serveParams
|
|
11455
|
+
}, {
|
|
11456
|
+
retries: 3,
|
|
11457
|
+
retryDelay: 20,
|
|
11458
|
+
timeout: 3000
|
|
11459
|
+
});
|
|
11460
|
+
}
|
|
11461
|
+
const articleInfo = await fetchArticles(pageNum, onlySuccess);
|
|
11462
|
+
let hasNextpage = -1 !== articleInfo.data.page;
|
|
11463
|
+
const filtered = articleInfo.data.notes;
|
|
11464
|
+
let currentPage = pageNum + 1;
|
|
11465
|
+
const usedPages = new Set();
|
|
11466
|
+
while(filtered.length < pageSize && hasNextpage){
|
|
11467
|
+
if (usedPages.has(currentPage)) {
|
|
11468
|
+
currentPage++;
|
|
11469
|
+
continue;
|
|
11470
|
+
}
|
|
11471
|
+
const res = await fetchArticles(currentPage, onlySuccess);
|
|
11472
|
+
usedPages.add(currentPage);
|
|
11473
|
+
const validItems = res.data.notes;
|
|
11474
|
+
filtered.push(...validItems);
|
|
11475
|
+
currentPage++;
|
|
11476
|
+
hasNextpage = -1 !== res.data.page;
|
|
11477
|
+
}
|
|
11478
|
+
const getDetailContent = async (id)=>{
|
|
11479
|
+
try {
|
|
11480
|
+
const detailUrl = "/web_api/sns/capa/postgw/note/detail";
|
|
11481
|
+
const detailParams = {
|
|
11482
|
+
note_id: id,
|
|
11483
|
+
source: "official",
|
|
11484
|
+
edit_mode: 1
|
|
11415
11485
|
};
|
|
11416
|
-
const
|
|
11417
|
-
|
|
11486
|
+
const detailxsHeader = xsEncrypt.signHeadersGet(detailUrl, recordCookie, "xhs-pc-web", detailParams);
|
|
11487
|
+
const detailInfo = await http.api({
|
|
11418
11488
|
method: "get",
|
|
11419
11489
|
baseURL: "https://edith.xiaohongshu.com",
|
|
11420
|
-
url:
|
|
11421
|
-
headers:
|
|
11422
|
-
params:
|
|
11490
|
+
url: detailUrl,
|
|
11491
|
+
headers: detailxsHeader,
|
|
11492
|
+
params: detailParams
|
|
11423
11493
|
}, {
|
|
11424
11494
|
retries: 3,
|
|
11425
11495
|
retryDelay: 20,
|
|
11426
11496
|
timeout: 3000
|
|
11427
11497
|
});
|
|
11498
|
+
return detailInfo.data.desc;
|
|
11499
|
+
} catch (err) {
|
|
11500
|
+
console.error("❌ JSON 解析失败:", err);
|
|
11501
|
+
return null;
|
|
11428
11502
|
}
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
const detailInfo = await http.api({
|
|
11456
|
-
method: "get",
|
|
11457
|
-
baseURL: "https://edith.xiaohongshu.com",
|
|
11458
|
-
url: detailUrl,
|
|
11459
|
-
headers: detailxsHeader,
|
|
11460
|
-
params: detailParams
|
|
11461
|
-
}, {
|
|
11462
|
-
retries: 3,
|
|
11463
|
-
retryDelay: 20,
|
|
11464
|
-
timeout: 3000
|
|
11465
|
-
});
|
|
11466
|
-
return detailInfo.data.desc;
|
|
11467
|
-
} catch (err) {
|
|
11468
|
-
console.error("❌ JSON 解析失败:", err);
|
|
11469
|
-
return null;
|
|
11503
|
+
};
|
|
11504
|
+
const final = filtered.slice(0, pageSize);
|
|
11505
|
+
const articleCell = await Promise.all(final.map(async (item)=>({
|
|
11506
|
+
title: item.display_title,
|
|
11507
|
+
imageUrl: item.images_list[0].url,
|
|
11508
|
+
createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
|
|
11509
|
+
redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
|
|
11510
|
+
readNum: item.view_count,
|
|
11511
|
+
likeNum: item.likes,
|
|
11512
|
+
commentNum: item.comments_count,
|
|
11513
|
+
collectNum: item.collected_count,
|
|
11514
|
+
shareNum: item.shared_count,
|
|
11515
|
+
...showOriginalData ? {
|
|
11516
|
+
originalData: item
|
|
11517
|
+
} : {},
|
|
11518
|
+
...containsArticle ? {
|
|
11519
|
+
article: await getDetailContent(item.id)
|
|
11520
|
+
} : {}
|
|
11521
|
+
})));
|
|
11522
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
11523
|
+
articleCell,
|
|
11524
|
+
...onlySuccess ? {
|
|
11525
|
+
pagination: {
|
|
11526
|
+
nextPage: hasNextpage,
|
|
11527
|
+
pageNum,
|
|
11528
|
+
pageSize
|
|
11470
11529
|
}
|
|
11471
|
-
}
|
|
11472
|
-
|
|
11473
|
-
const articleCell = await Promise.all(final.map(async (item)=>({
|
|
11474
|
-
title: item.display_title,
|
|
11475
|
-
imageUrl: item.images_list[0].url,
|
|
11476
|
-
createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
|
|
11477
|
-
redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
|
|
11478
|
-
readNum: item.view_count,
|
|
11479
|
-
likeNum: item.likes,
|
|
11480
|
-
commentNum: item.comments_count,
|
|
11481
|
-
collectNum: item.collected_count,
|
|
11482
|
-
shareNum: item.shared_count,
|
|
11483
|
-
...showOriginalData ? {
|
|
11484
|
-
originalData: item
|
|
11485
|
-
} : {},
|
|
11486
|
-
...containsArticle ? {
|
|
11487
|
-
article: await getDetailContent(item.id)
|
|
11488
|
-
} : {}
|
|
11489
|
-
})));
|
|
11490
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
11491
|
-
articleCell,
|
|
11492
|
-
...onlySuccess ? {
|
|
11493
|
-
pagination: {
|
|
11494
|
-
nextPage: hasNextpage,
|
|
11495
|
-
pageNum,
|
|
11496
|
-
pageSize
|
|
11497
|
-
}
|
|
11498
|
-
} : null
|
|
11499
|
-
}, "小红书文章数据获取成功");
|
|
11500
|
-
} catch (error) {
|
|
11501
|
-
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "小红书文章数据获取失败");
|
|
11502
|
-
}
|
|
11530
|
+
} : null
|
|
11531
|
+
}, "小红书文章数据获取成功");
|
|
11503
11532
|
}
|
|
11504
11533
|
const FetchArticlesParamsSchema = ActionCommonParamsSchema.extend({
|
|
11505
11534
|
platform: schemas_string().describe("社交平台:weixin, toutiao, baijiahao, xiaohongshu"),
|
|
@@ -12768,6 +12797,7 @@ const COVER_TYPE = {
|
|
|
12768
12797
|
};
|
|
12769
12798
|
const getAddTypeValue = (toutiaoAd)=>"yes" === toutiaoAd ? 3 : 2;
|
|
12770
12799
|
const toutiaoPublish = async (task, params)=>{
|
|
12800
|
+
params.content = formatSectionHtml(params.content);
|
|
12771
12801
|
if ("rpa" === params.actionType) return toutiaoPublish_rpa_rpaAction(task, params);
|
|
12772
12802
|
if ("mockApi" === params.actionType) return mock_mockAction(task, params);
|
|
12773
12803
|
return executeAction(mock_mockAction, toutiaoPublish_rpa_rpaAction)(task, params);
|
|
@@ -14687,6 +14717,7 @@ const weixinPublish = async (task, _params)=>{
|
|
|
14687
14717
|
const params = defaultParams(_params, {
|
|
14688
14718
|
masssend: true
|
|
14689
14719
|
});
|
|
14720
|
+
params.content = formatSectionHtml(params.content);
|
|
14690
14721
|
if ("rpa" === params.actionType) return weixinPublish_rpa_rpaAction(task, params);
|
|
14691
14722
|
if ("mockApi" === params.actionType) return weixinPublish_mock_mockAction(task, params);
|
|
14692
14723
|
return executeAction(weixinPublish_mock_mockAction, weixinPublish_rpa_rpaAction)(task, params);
|
|
@@ -16824,6 +16855,20 @@ const xiaohongshuWebRelationAction = async (_task, params)=>{
|
|
|
16824
16855
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
|
|
16825
16856
|
};
|
|
16826
16857
|
const xiaohongshuWebSearch_xsEncrypt = new Xhshow();
|
|
16858
|
+
const XhsWebSearchParamsSchema = ActionCommonParamsSchema.extend({
|
|
16859
|
+
keyword: schemas_string(),
|
|
16860
|
+
page: schemas_number(),
|
|
16861
|
+
page_size: schemas_number(),
|
|
16862
|
+
sort_type: schemas_enum([
|
|
16863
|
+
"general",
|
|
16864
|
+
"time_descending",
|
|
16865
|
+
"popular_descending"
|
|
16866
|
+
]),
|
|
16867
|
+
time_filter: schemas_enum([
|
|
16868
|
+
"不限",
|
|
16869
|
+
"一周内"
|
|
16870
|
+
])
|
|
16871
|
+
});
|
|
16827
16872
|
const createSearchId = ()=>{
|
|
16828
16873
|
let r = BigInt(Date.now());
|
|
16829
16874
|
const o = BigInt(Math.ceil(0x7ffffffe * Math.random()));
|
|
@@ -16938,7 +16983,7 @@ const xiaohongshuWebSearch = async (_task, params)=>{
|
|
|
16938
16983
|
const data = isSuccess ? res.data : {};
|
|
16939
16984
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
|
|
16940
16985
|
};
|
|
16941
|
-
var package_namespaceObject = JSON.parse('{"i8":"1.2.30-beta.
|
|
16986
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.30-beta.2"}');
|
|
16942
16987
|
const BetaFlag = "HuiwenCanary";
|
|
16943
16988
|
class Action {
|
|
16944
16989
|
constructor(task){
|
|
@@ -17124,6 +17169,6 @@ class Action {
|
|
|
17124
17169
|
}
|
|
17125
17170
|
}
|
|
17126
17171
|
var __webpack_exports__version = package_namespaceObject.i8;
|
|
17127
|
-
export { Action, ActionCommonParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, UnreadCountSchema, WxBjhSessionParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, getFileState, rpaAction_Server_Mock, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
|
|
17172
|
+
export { Action, ActionCommonParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, UnreadCountSchema, WxBjhSessionParamsSchema, XhsWebSearchParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, getFileState, rpaAction_Server_Mock, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
|
|
17128
17173
|
|
|
17129
17174
|
//# sourceMappingURL=index.mjs.map
|