@iflyrpa/actions 1.2.11-beta.0 → 1.2.11-beta.2
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/baijiahaoPublish/index.d.ts +1 -0
- package/dist/actions/common/FansTool/index.d.ts +19 -0
- package/dist/actions/toutiaoPublish/index.d.ts +1 -0
- package/dist/actions/weixinPublish/index.d.ts +1 -0
- package/dist/bundle.js +357 -60
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +357 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +357 -60
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +21 -5
- package/dist/utils/index.d.ts +9 -0
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -14064,6 +14064,27 @@ var __webpack_exports__ = {};
|
|
|
14064
14064
|
parser.end();
|
|
14065
14065
|
return srcList;
|
|
14066
14066
|
};
|
|
14067
|
+
class TimeFormatter {
|
|
14068
|
+
static format(timestamp, formatStr = 'yyyy-MM-dd hh:mm') {
|
|
14069
|
+
if ('number' == typeof timestamp && 10 === timestamp.toString().length) timestamp *= 1000;
|
|
14070
|
+
const date = new Date(timestamp);
|
|
14071
|
+
const map = {
|
|
14072
|
+
yyyy: String(date.getFullYear()),
|
|
14073
|
+
yy: String(date.getFullYear()).slice(-2),
|
|
14074
|
+
MM: String(date.getMonth() + 1).padStart(2, '0'),
|
|
14075
|
+
dd: String(date.getDate()).padStart(2, '0'),
|
|
14076
|
+
hh: String(date.getHours()).padStart(2, '0'),
|
|
14077
|
+
mm: String(date.getMinutes()).padStart(2, '0'),
|
|
14078
|
+
ss: String(date.getSeconds()).padStart(2, '0'),
|
|
14079
|
+
M: String(date.getMonth() + 1),
|
|
14080
|
+
d: String(date.getDate()),
|
|
14081
|
+
h: String(date.getHours()),
|
|
14082
|
+
m: String(date.getMinutes()),
|
|
14083
|
+
s: String(date.getSeconds())
|
|
14084
|
+
};
|
|
14085
|
+
return formatStr.replace(/yyyy|yy|MM|dd|hh|mm|ss|M|d|h|m|s/g, (key)=>map[key]);
|
|
14086
|
+
}
|
|
14087
|
+
}
|
|
14067
14088
|
const replaceImgSrc = (html, callback)=>{
|
|
14068
14089
|
let lastedHtml = html;
|
|
14069
14090
|
const isImageTag = (node)=>"tag" === node.type && "img" === node.name;
|
|
@@ -14401,6 +14422,7 @@ var __webpack_exports__ = {};
|
|
|
14401
14422
|
cover_source: "upload",
|
|
14402
14423
|
activity_list
|
|
14403
14424
|
};
|
|
14425
|
+
params.settingInfo.timer && (publishData['timer_time'] = params.settingInfo.timer);
|
|
14404
14426
|
const isDraft = "draft" === params.saveType;
|
|
14405
14427
|
const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
|
|
14406
14428
|
const res = await http.api({
|
|
@@ -14522,13 +14544,16 @@ var __webpack_exports__ = {};
|
|
|
14522
14544
|
if (await findActivity.count() > 0) findActivity.first().locator("..").click();
|
|
14523
14545
|
}
|
|
14524
14546
|
}
|
|
14525
|
-
const articleId = await new Promise((resolve)=>{
|
|
14547
|
+
const { articleId, message } = await new Promise(async (resolve)=>{
|
|
14526
14548
|
const handleResponse = async (response)=>{
|
|
14527
14549
|
const url = response.url();
|
|
14528
14550
|
if (url.includes("/pcui/article/save") || url.includes("/pcui/article/publish")) {
|
|
14529
14551
|
const jsonResponse = await response.json();
|
|
14530
14552
|
page.off("response", handleResponse);
|
|
14531
|
-
resolve(
|
|
14553
|
+
resolve({
|
|
14554
|
+
articleId: jsonResponse?.ret?.article_id,
|
|
14555
|
+
message: jsonResponse?.errmsg
|
|
14556
|
+
});
|
|
14532
14557
|
}
|
|
14533
14558
|
};
|
|
14534
14559
|
page.on("response", handleResponse);
|
|
@@ -14536,12 +14561,74 @@ var __webpack_exports__ = {};
|
|
|
14536
14561
|
if ("draft" === params.saveType) operatorContainer.locator(".op-btn-outter-content").filter({
|
|
14537
14562
|
hasText: "存草稿"
|
|
14538
14563
|
}).locator("button").click();
|
|
14539
|
-
else
|
|
14540
|
-
|
|
14564
|
+
else if (params.settingInfo.timer) {
|
|
14565
|
+
await operatorContainer.locator(".op-btn-outter-content").filter({
|
|
14566
|
+
hasText: "定时发布"
|
|
14567
|
+
}).locator("button").click();
|
|
14568
|
+
await page.locator(".timepublish-wrap-select .select-wrap", {
|
|
14569
|
+
hasText: "日"
|
|
14570
|
+
}).click();
|
|
14571
|
+
await page.locator('#select-date_list + * .cheetah-select-item-option', {
|
|
14572
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "M月dd日")
|
|
14573
|
+
}).click();
|
|
14574
|
+
await page.waitForTimeout(200);
|
|
14575
|
+
await page.locator(".timepublish-wrap-select .select-wrap", {
|
|
14576
|
+
hasText: "点"
|
|
14577
|
+
}).click();
|
|
14578
|
+
await page.locator('#select-hour_list +div.rc-virtual-list').hover();
|
|
14579
|
+
const scrollHourInfo = await page.evaluate(()=>{
|
|
14580
|
+
const hourInner = document.querySelector('#select-hour_list + * .rc-virtual-list-holder-inner');
|
|
14581
|
+
const hourElementHeight = hourInner?.children[0].clientHeight || 36;
|
|
14582
|
+
const hourMapsElem = Array.from(document.querySelectorAll('#select-hour_list + * .cheetah-select-item-option .cheetah-select-item-option-content'));
|
|
14583
|
+
const hourMap = hourMapsElem.map((item)=>item.textContent?.trim());
|
|
14584
|
+
return {
|
|
14585
|
+
elementHeight: hourElementHeight,
|
|
14586
|
+
elementItem: hourMap
|
|
14587
|
+
};
|
|
14588
|
+
});
|
|
14589
|
+
const fistHourElem = scrollHourInfo.elementItem[0];
|
|
14590
|
+
let fistHourElemH = Number(fistHourElem?.split("点")[0]);
|
|
14591
|
+
const lastHourElem = scrollHourInfo.elementItem[scrollHourInfo.elementItem.length - 1];
|
|
14592
|
+
let lastHourElemH = Number(lastHourElem?.split("点")[0]);
|
|
14593
|
+
let targetTimeH = Number(TimeFormatter.format(params.settingInfo.timer, 'h'));
|
|
14594
|
+
await page.mouse.wheel(0, targetTimeH > lastHourElemH ? (targetTimeH - lastHourElemH) * scrollHourInfo.elementHeight : targetTimeH < fistHourElemH ? -(fistHourElemH - targetTimeH) * scrollHourInfo.elementHeight : 0);
|
|
14595
|
+
await page.locator("#select-hour_list + * .cheetah-select-item-option ", {
|
|
14596
|
+
hasText: targetTimeH + "点"
|
|
14597
|
+
}).click();
|
|
14598
|
+
await page.waitForTimeout(200);
|
|
14599
|
+
await page.locator(".timepublish-wrap-select .select-wrap", {
|
|
14600
|
+
hasText: "分"
|
|
14601
|
+
}).click();
|
|
14602
|
+
await page.locator('#select-minute_list +div.rc-virtual-list').hover();
|
|
14603
|
+
const scrollMinuteInfo = await page.evaluate(()=>{
|
|
14604
|
+
const hourInner = document.querySelector('#select-minute_list + * .rc-virtual-list-holder-inner');
|
|
14605
|
+
const hourElementHeight = hourInner?.children[0].clientHeight || 36;
|
|
14606
|
+
const hourMapsElem = Array.from(document.querySelectorAll('#select-minute_list + * .cheetah-select-item-option .cheetah-select-item-option-content'));
|
|
14607
|
+
const hourMap = hourMapsElem.map((item)=>item.textContent?.trim());
|
|
14608
|
+
return {
|
|
14609
|
+
elementHeight: hourElementHeight,
|
|
14610
|
+
elementItem: hourMap
|
|
14611
|
+
};
|
|
14612
|
+
});
|
|
14613
|
+
const fistMinuteElem = scrollMinuteInfo.elementItem[0];
|
|
14614
|
+
let fistMinuteElemH = Number(fistMinuteElem?.split("分")[0]);
|
|
14615
|
+
const lastMinuteElem = scrollMinuteInfo.elementItem[scrollMinuteInfo.elementItem.length - 1];
|
|
14616
|
+
let lastMinuteElemH = Number(lastMinuteElem?.split("分")[0]);
|
|
14617
|
+
let targetTimeM = Number(TimeFormatter.format(params.settingInfo.timer, 'm'));
|
|
14618
|
+
await page.mouse.wheel(0, targetTimeM > lastMinuteElemH ? (targetTimeM - lastMinuteElemH) * scrollMinuteInfo.elementHeight : targetTimeM < fistMinuteElemH ? -(fistMinuteElemH - targetTimeM) * scrollMinuteInfo.elementHeight : 0);
|
|
14619
|
+
await page.locator("#select-minute_list + * .cheetah-select-item-option ", {
|
|
14620
|
+
hasText: targetTimeM + "分"
|
|
14621
|
+
}).click();
|
|
14622
|
+
await page.waitForTimeout(200);
|
|
14623
|
+
await page.locator(".cheetah-modal-confirm-btns button").filter({
|
|
14624
|
+
hasText: "定时发布"
|
|
14625
|
+
}).click();
|
|
14626
|
+
} else operatorContainer.locator(".op-btn-outter-content").filter({
|
|
14627
|
+
hasText: /^发布/
|
|
14541
14628
|
}).locator("button").click();
|
|
14542
14629
|
});
|
|
14543
14630
|
await page.close();
|
|
14544
|
-
return success(articleId);
|
|
14631
|
+
return success(articleId, articleId ? "发布成功" : message);
|
|
14545
14632
|
};
|
|
14546
14633
|
const baijiahaoPublish = async (task, params)=>{
|
|
14547
14634
|
if ("rpa" === params.actionType) return rpaAction(task, params);
|
|
@@ -14722,7 +14809,7 @@ var __webpack_exports__ = {};
|
|
|
14722
14809
|
2005: "账号无【申明原创】权限,请关闭申明后重试。",
|
|
14723
14810
|
100004: "用户未登录或登陆已过期,请重新登陆后重试。"
|
|
14724
14811
|
};
|
|
14725
|
-
const
|
|
14812
|
+
const mock_generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
|
|
14726
14813
|
const encodedKey = encodeURIComponent(key);
|
|
14727
14814
|
const encodedValue = encodeURIComponent(String(value));
|
|
14728
14815
|
return `${encodedKey}=${encodedValue}`;
|
|
@@ -14846,8 +14933,8 @@ var __webpack_exports__ = {};
|
|
|
14846
14933
|
trends_writing_tag: 0,
|
|
14847
14934
|
is_refute_rumor: 0,
|
|
14848
14935
|
save: "publish" === params.saveType ? 1 : 0,
|
|
14849
|
-
timer_status: 0,
|
|
14850
|
-
timer_time: "",
|
|
14936
|
+
timer_status: params.settingInfo.timer ? 1 : 0,
|
|
14937
|
+
timer_time: params.settingInfo.timer ? TimeFormatter.format(params.settingInfo.timer) : "",
|
|
14851
14938
|
title: params.title,
|
|
14852
14939
|
content: content + topicContent,
|
|
14853
14940
|
extra: JSON.stringify(extraData),
|
|
@@ -14872,32 +14959,40 @@ var __webpack_exports__ = {};
|
|
|
14872
14959
|
claim_exclusive: toutiaoOriginal.includes("exclusive") ? 1 : 0
|
|
14873
14960
|
};
|
|
14874
14961
|
const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
|
|
14962
|
+
let publishOption = {};
|
|
14963
|
+
if (msToken) {
|
|
14964
|
+
const postHeaders = mock_generatorFormData({
|
|
14965
|
+
source: "mp",
|
|
14966
|
+
type: "article",
|
|
14967
|
+
aid: 1231,
|
|
14968
|
+
mp_publish_ab_val: 0,
|
|
14969
|
+
msToken: msToken
|
|
14970
|
+
});
|
|
14971
|
+
const postData = mock_generatorFormData(publishData);
|
|
14972
|
+
let a_bogus = GenAB(postHeaders, postData);
|
|
14973
|
+
publishOption = {
|
|
14974
|
+
method: "post",
|
|
14975
|
+
url: `https://mp.toutiao.com/mp/agw/article/publish?${postHeaders}&a_bogus=${a_bogus}`,
|
|
14976
|
+
data: postData,
|
|
14977
|
+
headers: {
|
|
14978
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
14979
|
+
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
|
|
14980
|
+
},
|
|
14981
|
+
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
14982
|
+
};
|
|
14983
|
+
} else publishOption = {
|
|
14890
14984
|
method: "post",
|
|
14891
|
-
url:
|
|
14892
|
-
data:
|
|
14985
|
+
url: "https://mp.toutiao.com/mp/agw/article/publish?source=mp&type=article&aid=1",
|
|
14986
|
+
data: publishData,
|
|
14893
14987
|
headers: {
|
|
14894
|
-
"content-type": "application/x-www-form-urlencoded"
|
|
14895
|
-
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
|
|
14988
|
+
"content-type": "application/x-www-form-urlencoded"
|
|
14896
14989
|
},
|
|
14897
14990
|
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
14898
|
-
}
|
|
14991
|
+
};
|
|
14992
|
+
const publishResult = await http.api(publishOption);
|
|
14899
14993
|
return success(publishResult.data.pgc_id);
|
|
14900
14994
|
};
|
|
14995
|
+
const rpa_GenAB = __webpack_require__("./src/utils/ttABEncrypt.js");
|
|
14901
14996
|
const rpa_rpaAction = async (task, params)=>{
|
|
14902
14997
|
const tmpCachePath = task.getTmpPath();
|
|
14903
14998
|
const commonCookies = {
|
|
@@ -14932,9 +15027,30 @@ var __webpack_exports__ = {};
|
|
|
14932
15027
|
await page.route('**', async (route, request)=>{
|
|
14933
15028
|
const url = new URL(request.url());
|
|
14934
15029
|
if (interceptUrls.some((pattern)=>url.pathname.includes(pattern))) {
|
|
14935
|
-
|
|
15030
|
+
const headers = {
|
|
15031
|
+
...request.headers(),
|
|
15032
|
+
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
|
|
15033
|
+
};
|
|
15034
|
+
const generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
|
|
15035
|
+
const encodedKey = encodeURIComponent(key);
|
|
15036
|
+
const encodedValue = encodeURIComponent(String(value));
|
|
15037
|
+
return `${encodedKey}=${encodedValue}`;
|
|
15038
|
+
}).join('&');
|
|
15039
|
+
const postHeaders = generatorFormData({
|
|
15040
|
+
source: "mp",
|
|
15041
|
+
type: "article",
|
|
15042
|
+
aid: 1231,
|
|
15043
|
+
mp_publish_ab_val: 0,
|
|
15044
|
+
msToken: url.searchParams.get('msToken')
|
|
15045
|
+
});
|
|
15046
|
+
const postData = request.postData() || "";
|
|
15047
|
+
let a_bogus = rpa_GenAB(postHeaders, postData);
|
|
15048
|
+
url.searchParams.set('aid', "1231");
|
|
15049
|
+
url.searchParams.set('mp_publish_ab_val', "0");
|
|
15050
|
+
url.searchParams.set('a_bogus', a_bogus);
|
|
14936
15051
|
await route.continue({
|
|
14937
|
-
url: url.toString()
|
|
15052
|
+
url: url.toString(),
|
|
15053
|
+
headers: headers
|
|
14938
15054
|
});
|
|
14939
15055
|
} else await route.continue();
|
|
14940
15056
|
});
|
|
@@ -15015,7 +15131,7 @@ var __webpack_exports__ = {};
|
|
|
15015
15131
|
}).locator("xpath=..");
|
|
15016
15132
|
exclusiveContainer.locator(".exclusive .exclusive-checkbox-wraper .byte-checkbox").click();
|
|
15017
15133
|
}
|
|
15018
|
-
const articleId = await new Promise((resolve)=>{
|
|
15134
|
+
const articleId = await new Promise(async (resolve)=>{
|
|
15019
15135
|
const handleResponse = async (response)=>{
|
|
15020
15136
|
const url = response.url();
|
|
15021
15137
|
if (url.includes("/mp/agw/article/publish")) {
|
|
@@ -15025,7 +15141,32 @@ var __webpack_exports__ = {};
|
|
|
15025
15141
|
}
|
|
15026
15142
|
};
|
|
15027
15143
|
page.on("response", handleResponse);
|
|
15028
|
-
|
|
15144
|
+
if (params.settingInfo.timer) {
|
|
15145
|
+
await page.locator(".publish-footer button").filter({
|
|
15146
|
+
hasText: "定时发布"
|
|
15147
|
+
}).click();
|
|
15148
|
+
await page.waitForSelector('button.publish-btn:not(.byte-btn-loading) >> nth=1', {
|
|
15149
|
+
state: 'attached'
|
|
15150
|
+
});
|
|
15151
|
+
await page.locator(".byte-modal-content .day-select .byte-select-view-value").click();
|
|
15152
|
+
await page.locator('li.byte-select-option', {
|
|
15153
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "MM月dd日")
|
|
15154
|
+
}).click();
|
|
15155
|
+
await page.waitForTimeout(200);
|
|
15156
|
+
await page.locator(".byte-modal-content .hour-select .byte-select-view-value").click();
|
|
15157
|
+
await page.locator('li.byte-select-option', {
|
|
15158
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "h")
|
|
15159
|
+
}).click();
|
|
15160
|
+
await page.waitForTimeout(200);
|
|
15161
|
+
await page.locator(".byte-modal-content .minute-select .byte-select-view-value").click();
|
|
15162
|
+
await page.locator('li.byte-select-option', {
|
|
15163
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "m")
|
|
15164
|
+
}).click();
|
|
15165
|
+
await page.waitForTimeout(200);
|
|
15166
|
+
await page.locator(".byte-modal-footer button").filter({
|
|
15167
|
+
hasText: "预览并定时发布"
|
|
15168
|
+
}).click();
|
|
15169
|
+
} else await page.locator(".publish-footer button").filter({
|
|
15029
15170
|
hasText: "预览并发布"
|
|
15030
15171
|
}).click();
|
|
15031
15172
|
});
|
|
@@ -15036,13 +15177,13 @@ var __webpack_exports__ = {};
|
|
|
15036
15177
|
}
|
|
15037
15178
|
if ("publish" === params.saveType) {
|
|
15038
15179
|
await page.locator(".publish-footer button").filter({
|
|
15039
|
-
hasText: "确认发布"
|
|
15180
|
+
hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
|
|
15040
15181
|
}).waitFor({
|
|
15041
15182
|
state: "visible"
|
|
15042
15183
|
});
|
|
15043
15184
|
await page.waitForTimeout(200);
|
|
15044
15185
|
await page.locator(".publish-footer button").filter({
|
|
15045
|
-
hasText: "确认发布"
|
|
15186
|
+
hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
|
|
15046
15187
|
}).click();
|
|
15047
15188
|
}
|
|
15048
15189
|
await page.close();
|
|
@@ -15059,6 +15200,106 @@ var __webpack_exports__ = {};
|
|
|
15059
15200
|
if ("mockApi" === params.actionType) return mock_mockAction(task, params);
|
|
15060
15201
|
return executeAction(mock_mockAction, rpa_rpaAction)(task, params);
|
|
15061
15202
|
};
|
|
15203
|
+
const TTFansExport = async (_task, params)=>{
|
|
15204
|
+
const http = new Http({
|
|
15205
|
+
headers: {
|
|
15206
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15207
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
15208
|
+
}
|
|
15209
|
+
});
|
|
15210
|
+
try {
|
|
15211
|
+
const res = await http.api({
|
|
15212
|
+
method: "get",
|
|
15213
|
+
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?app_id=1231",
|
|
15214
|
+
params: {
|
|
15215
|
+
app_id: 1231
|
|
15216
|
+
}
|
|
15217
|
+
});
|
|
15218
|
+
return success(0 === res.code ? {
|
|
15219
|
+
fans_count: res.total_fans_count
|
|
15220
|
+
} : {
|
|
15221
|
+
fans_count: null
|
|
15222
|
+
}, "获取粉丝数成功!");
|
|
15223
|
+
} catch (error) {
|
|
15224
|
+
return success({
|
|
15225
|
+
fans_count: null
|
|
15226
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
15227
|
+
}
|
|
15228
|
+
};
|
|
15229
|
+
const XhsFansExport = async (_task, params)=>{
|
|
15230
|
+
const http = new Http({
|
|
15231
|
+
headers: {
|
|
15232
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15233
|
+
referer: "https://creator.xiaohongshu.com/new/home?source=official"
|
|
15234
|
+
}
|
|
15235
|
+
});
|
|
15236
|
+
try {
|
|
15237
|
+
const res = await http.api({
|
|
15238
|
+
method: "get",
|
|
15239
|
+
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
15240
|
+
});
|
|
15241
|
+
return success(0 === res.result ? {
|
|
15242
|
+
fans_count: res.data.fans_count
|
|
15243
|
+
} : {
|
|
15244
|
+
fans_count: null
|
|
15245
|
+
}, "获取粉丝数成功!");
|
|
15246
|
+
} catch (error) {
|
|
15247
|
+
return success({
|
|
15248
|
+
fans_count: null
|
|
15249
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
15250
|
+
}
|
|
15251
|
+
};
|
|
15252
|
+
const WxFansExport = async (_task, params)=>{
|
|
15253
|
+
const http = new Http({
|
|
15254
|
+
headers: {
|
|
15255
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
15256
|
+
}
|
|
15257
|
+
});
|
|
15258
|
+
try {
|
|
15259
|
+
const htmlStr = await http.api({
|
|
15260
|
+
method: "get",
|
|
15261
|
+
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
15262
|
+
params: {
|
|
15263
|
+
t: "home/index",
|
|
15264
|
+
token: params.token,
|
|
15265
|
+
lang: "zh_CN"
|
|
15266
|
+
}
|
|
15267
|
+
});
|
|
15268
|
+
const match = htmlStr.match(/总用户数[\s\S]*?<mp-thousandth>(\d+)<\/mp-thousandth>/);
|
|
15269
|
+
return success(match ? {
|
|
15270
|
+
fans_count: Number(match[1])
|
|
15271
|
+
} : {
|
|
15272
|
+
fans_count: null
|
|
15273
|
+
}, "获取粉丝数成功!");
|
|
15274
|
+
} catch (error) {
|
|
15275
|
+
return success({
|
|
15276
|
+
fans_count: null
|
|
15277
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
15278
|
+
}
|
|
15279
|
+
};
|
|
15280
|
+
const BjhFansExport = async (_task, params)=>{
|
|
15281
|
+
const http = new Http({
|
|
15282
|
+
headers: {
|
|
15283
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15284
|
+
referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
15285
|
+
}
|
|
15286
|
+
});
|
|
15287
|
+
try {
|
|
15288
|
+
const res = await http.api({
|
|
15289
|
+
method: "get",
|
|
15290
|
+
url: "https://baijiahao.baidu.com/cms-ui/rights/growth/get_info"
|
|
15291
|
+
});
|
|
15292
|
+
return success(0 === res.errno ? {
|
|
15293
|
+
fans_count: res.data.total_fans
|
|
15294
|
+
} : {
|
|
15295
|
+
fans_count: null
|
|
15296
|
+
}, "获取粉丝数成功!");
|
|
15297
|
+
} catch (error) {
|
|
15298
|
+
return success({
|
|
15299
|
+
fans_count: null
|
|
15300
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
15301
|
+
}
|
|
15302
|
+
};
|
|
15062
15303
|
const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
15063
15304
|
const tmpCachePath = task.getTmpPath();
|
|
15064
15305
|
const http = new Http({
|
|
@@ -15217,7 +15458,8 @@ var __webpack_exports__ = {};
|
|
|
15217
15458
|
"-4": "不支持发布审核中或转码中的视频",
|
|
15218
15459
|
"-2": "不支持发布审核中或转码中的视频",
|
|
15219
15460
|
770001: "不支持发布审核中或转码中的视频",
|
|
15220
|
-
200074: "系统繁忙,请稍后重试!"
|
|
15461
|
+
200074: "系统繁忙,请稍后重试!",
|
|
15462
|
+
64702: "标题超出64字长度限制,请修改标题后重试。"
|
|
15221
15463
|
};
|
|
15222
15464
|
const ignoreErrno = [
|
|
15223
15465
|
154019
|
|
@@ -15227,7 +15469,7 @@ var __webpack_exports__ = {};
|
|
|
15227
15469
|
已关注的用户: 2,
|
|
15228
15470
|
已关注7天及以上的用户: 3
|
|
15229
15471
|
};
|
|
15230
|
-
const
|
|
15472
|
+
const weixinPublish_mock_generatorFormData = (data)=>{
|
|
15231
15473
|
const formData = new URLSearchParams();
|
|
15232
15474
|
for (const [key, value] of Object.entries(data))formData.append(key, String(value));
|
|
15233
15475
|
return formData.toString();
|
|
@@ -15243,7 +15485,7 @@ var __webpack_exports__ = {};
|
|
|
15243
15485
|
token: params.token,
|
|
15244
15486
|
lang: "zh_CN"
|
|
15245
15487
|
},
|
|
15246
|
-
data:
|
|
15488
|
+
data: weixinPublish_mock_generatorFormData(data)
|
|
15247
15489
|
});
|
|
15248
15490
|
} catch (error) {
|
|
15249
15491
|
resData = error?.data;
|
|
@@ -15357,7 +15599,7 @@ var __webpack_exports__ = {};
|
|
|
15357
15599
|
params: {
|
|
15358
15600
|
action: "searchacct"
|
|
15359
15601
|
},
|
|
15360
|
-
data:
|
|
15602
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15361
15603
|
lang: "zh_CN",
|
|
15362
15604
|
f: "json",
|
|
15363
15605
|
ajax: 1,
|
|
@@ -15486,7 +15728,7 @@ var __webpack_exports__ = {};
|
|
|
15486
15728
|
params: {
|
|
15487
15729
|
action: 'addautoreply'
|
|
15488
15730
|
},
|
|
15489
|
-
data:
|
|
15731
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15490
15732
|
type: 1,
|
|
15491
15733
|
fingerprint,
|
|
15492
15734
|
token: params.token,
|
|
@@ -15608,7 +15850,7 @@ var __webpack_exports__ = {};
|
|
|
15608
15850
|
type: 77,
|
|
15609
15851
|
lang: "zh_CN"
|
|
15610
15852
|
},
|
|
15611
|
-
data:
|
|
15853
|
+
data: weixinPublish_mock_generatorFormData(draftData),
|
|
15612
15854
|
defaultErrorMsg: "创建草稿失败,请稍后重试发布。"
|
|
15613
15855
|
});
|
|
15614
15856
|
if ("draft" === params.saveType) return {
|
|
@@ -15641,7 +15883,7 @@ var __webpack_exports__ = {};
|
|
|
15641
15883
|
lang: "zh_CN",
|
|
15642
15884
|
token: params.token
|
|
15643
15885
|
},
|
|
15644
|
-
data:
|
|
15886
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15645
15887
|
token: params.token,
|
|
15646
15888
|
lang: "zh_CN",
|
|
15647
15889
|
f: "json",
|
|
@@ -15672,7 +15914,7 @@ var __webpack_exports__ = {};
|
|
|
15672
15914
|
token: params.token,
|
|
15673
15915
|
lang: "zh_CN"
|
|
15674
15916
|
},
|
|
15675
|
-
data:
|
|
15917
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15676
15918
|
appmsgid: appMsgId,
|
|
15677
15919
|
fingerprint,
|
|
15678
15920
|
token: params.token,
|
|
@@ -15684,7 +15926,7 @@ var __webpack_exports__ = {};
|
|
|
15684
15926
|
await http.api({
|
|
15685
15927
|
method: "post",
|
|
15686
15928
|
url: "https://mp.weixin.qq.com/cgi-bin/masssend?action=check_same_material",
|
|
15687
|
-
data:
|
|
15929
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15688
15930
|
msgid: appMsgId,
|
|
15689
15931
|
fingerprint,
|
|
15690
15932
|
token: params.token,
|
|
@@ -15723,7 +15965,7 @@ var __webpack_exports__ = {};
|
|
|
15723
15965
|
token: params.token,
|
|
15724
15966
|
lang: "zh_CN"
|
|
15725
15967
|
},
|
|
15726
|
-
data:
|
|
15968
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15727
15969
|
appmsg_id: appMsgId,
|
|
15728
15970
|
fingerprint,
|
|
15729
15971
|
token: params.token,
|
|
@@ -15742,7 +15984,7 @@ var __webpack_exports__ = {};
|
|
|
15742
15984
|
params: {
|
|
15743
15985
|
action: "check_music"
|
|
15744
15986
|
},
|
|
15745
|
-
data:
|
|
15987
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15746
15988
|
appmsgid: appMsgId,
|
|
15747
15989
|
masssend_check: 1,
|
|
15748
15990
|
fingerprint,
|
|
@@ -15762,7 +16004,7 @@ var __webpack_exports__ = {};
|
|
|
15762
16004
|
lang: "zh_CN",
|
|
15763
16005
|
1: 1
|
|
15764
16006
|
},
|
|
15765
|
-
data:
|
|
16007
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15766
16008
|
token: params.token,
|
|
15767
16009
|
lang: "zh_CN",
|
|
15768
16010
|
f: "json",
|
|
@@ -15782,7 +16024,7 @@ var __webpack_exports__ = {};
|
|
|
15782
16024
|
lang: "zh_CN",
|
|
15783
16025
|
1: 1
|
|
15784
16026
|
},
|
|
15785
|
-
data:
|
|
16027
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15786
16028
|
token: params.token,
|
|
15787
16029
|
lang: "zh_CN",
|
|
15788
16030
|
f: "json",
|
|
@@ -15814,6 +16056,7 @@ var __webpack_exports__ = {};
|
|
|
15814
16056
|
ticket: getTicketResult.ticket,
|
|
15815
16057
|
uuid,
|
|
15816
16058
|
msgid: operation_seq,
|
|
16059
|
+
open_email: !!params.settingInfo.timer,
|
|
15817
16060
|
...params.masssend ? {} : {
|
|
15818
16061
|
publish_type: 1
|
|
15819
16062
|
}
|
|
@@ -15836,7 +16079,7 @@ var __webpack_exports__ = {};
|
|
|
15836
16079
|
lang: "zh_CN",
|
|
15837
16080
|
timespam: Date.now()
|
|
15838
16081
|
},
|
|
15839
|
-
data:
|
|
16082
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15840
16083
|
token: params.token,
|
|
15841
16084
|
lang: "zh_CN",
|
|
15842
16085
|
f: "json",
|
|
@@ -15866,7 +16109,7 @@ var __webpack_exports__ = {};
|
|
|
15866
16109
|
lang: "zh_CN",
|
|
15867
16110
|
1: 1
|
|
15868
16111
|
},
|
|
15869
|
-
data:
|
|
16112
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15870
16113
|
token: params.token,
|
|
15871
16114
|
lang: "zh_CN",
|
|
15872
16115
|
f: "json",
|
|
@@ -15888,7 +16131,7 @@ var __webpack_exports__ = {};
|
|
|
15888
16131
|
is_release_publish_page: 1
|
|
15889
16132
|
}
|
|
15890
16133
|
},
|
|
15891
|
-
data:
|
|
16134
|
+
data: weixinPublish_mock_generatorFormData({
|
|
15892
16135
|
token: params.token,
|
|
15893
16136
|
lang: "zh_CN",
|
|
15894
16137
|
f: "json",
|
|
@@ -15905,7 +16148,7 @@ var __webpack_exports__ = {};
|
|
|
15905
16148
|
country: "",
|
|
15906
16149
|
province: "",
|
|
15907
16150
|
city: "",
|
|
15908
|
-
send_time: "0",
|
|
16151
|
+
send_time: params.settingInfo.timer ? params.settingInfo.timer : "0",
|
|
15909
16152
|
type: "10",
|
|
15910
16153
|
share_page: "1",
|
|
15911
16154
|
synctxweibo: "0",
|
|
@@ -15922,7 +16165,7 @@ var __webpack_exports__ = {};
|
|
|
15922
16165
|
}),
|
|
15923
16166
|
defaultErrorMsg: params.masssend ? "文章群发异常,请尝试关闭群发或稍后重试。" : "文章发布异常,请稍后重试。"
|
|
15924
16167
|
});
|
|
15925
|
-
return success(appMsgId, "微信公众号发布完成。");
|
|
16168
|
+
return success(appMsgId, params.settingInfo.timer ? "微信公众号文章定时发布成功。" : "微信公众号发布完成。");
|
|
15926
16169
|
};
|
|
15927
16170
|
const waitQrcodeResultMaxTime = 2000 * scanRetryMaxCount;
|
|
15928
16171
|
const weixinPublish_rpa_rpaAction = async (task, params)=>{
|
|
@@ -16043,6 +16286,10 @@ var __webpack_exports__ = {};
|
|
|
16043
16286
|
checkInterval: 1000,
|
|
16044
16287
|
stopAfterClick: false
|
|
16045
16288
|
});
|
|
16289
|
+
PopupListener(page, '[extclass="weui-desktop-dialog_simple"] .weui-desktop-dialog', "小店", '[extclass="weui-desktop-dialog_simple"] .weui-desktop-icon-btn.weui-desktop-dialog__close-btn', {
|
|
16290
|
+
checkInterval: 1000,
|
|
16291
|
+
stopAfterClick: true
|
|
16292
|
+
});
|
|
16046
16293
|
const titleInstance = page.locator("#js_title_main textarea#title");
|
|
16047
16294
|
await titleInstance.click();
|
|
16048
16295
|
await titleInstance.fill(params.title);
|
|
@@ -16199,8 +16446,8 @@ var __webpack_exports__ = {};
|
|
|
16199
16446
|
const wxInteraction_bd = wxInteraction_setting.locator('.weui-desktop-dialog__bd');
|
|
16200
16447
|
const wxInteraction_ft = wxInteraction_setting.locator('.weui-desktop-dialog__ft');
|
|
16201
16448
|
if ("public" == params.settingInfo.wxInteraction.Type) {
|
|
16202
|
-
await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
|
|
16203
|
-
hasText:
|
|
16449
|
+
await wxInteraction_bd.locator('.weui-desktop-form__check-label span', {
|
|
16450
|
+
hasText: /^(开启|留言)$/
|
|
16204
16451
|
}).click();
|
|
16205
16452
|
const comment_area = wxInteraction_bd.locator('.comment-options-block.pt0');
|
|
16206
16453
|
const reply_area = wxInteraction_bd.locator('.comment-options-block.bb0.pb0');
|
|
@@ -16218,8 +16465,8 @@ var __webpack_exports__ = {};
|
|
|
16218
16465
|
}).click();
|
|
16219
16466
|
if (params.settingInfo.wxInteraction.Option?.elect_reply) await reply_area.locator('.weui-desktop-switch__box').check();
|
|
16220
16467
|
else await reply_area.locator('.weui-desktop-switch__input').isChecked() && reply_area.locator('.weui-desktop-switch__box').uncheck();
|
|
16221
|
-
} else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
|
|
16222
|
-
hasText:
|
|
16468
|
+
} else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label span', {
|
|
16469
|
+
hasText: /^(快捷私信|不开启)$/
|
|
16223
16470
|
}).click();
|
|
16224
16471
|
await wxInteraction_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
|
|
16225
16472
|
}
|
|
@@ -16245,7 +16492,7 @@ var __webpack_exports__ = {};
|
|
|
16245
16492
|
await poperInstance.locator('.frm_radio_item label[for="not_recomment_0"]').click();
|
|
16246
16493
|
}
|
|
16247
16494
|
await page.waitForTimeout(1000);
|
|
16248
|
-
const articleId = await new Promise((resolve)=>{
|
|
16495
|
+
const articleId = await new Promise(async (resolve)=>{
|
|
16249
16496
|
const handleResponse = async (response)=>{
|
|
16250
16497
|
const url = response.url();
|
|
16251
16498
|
const query = parseUrlQueryString(url);
|
|
@@ -16257,7 +16504,34 @@ var __webpack_exports__ = {};
|
|
|
16257
16504
|
};
|
|
16258
16505
|
page.on("response", handleResponse);
|
|
16259
16506
|
page.locator("#editor_pannel #bottom_main #js_button_area #js_send button").click();
|
|
16507
|
+
await page.waitForTimeout(200);
|
|
16508
|
+
if (params.settingInfo.timer) {
|
|
16509
|
+
await page.locator(".mass-send .mass-send__td-setting", {
|
|
16510
|
+
hasText: "定时发表"
|
|
16511
|
+
}).locator(".weui-desktop-switch__box").check();
|
|
16512
|
+
let dateD = Number(TimeFormatter.format(params.settingInfo.timer, "d"));
|
|
16513
|
+
let nowD = Number(TimeFormatter.format(Date.now(), "d"));
|
|
16514
|
+
await page.locator(".mass-send__timer .weui-desktop-form__dropdown__dt").click();
|
|
16515
|
+
const dropMenu = page.locator(".mass-send__timer .weui-desktop-dropdown-menu").locator(".weui-desktop-dropdown__list-ele");
|
|
16516
|
+
await dropMenu.filter({
|
|
16517
|
+
hasText: dateD == nowD ? "今天" : dateD == nowD + 1 ? "明天" : TimeFormatter.format(params.settingInfo.timer, "M月d日")
|
|
16518
|
+
}).click();
|
|
16519
|
+
const timeDropMenu = page.locator(".mass-send__timer .weui-desktop-picker__time:visible");
|
|
16520
|
+
await timeDropMenu.locator(".weui-desktop-form__input").fill(TimeFormatter.format(params.settingInfo.timer, "hh:mm"));
|
|
16521
|
+
await timeDropMenu.locator("i.weui-desktop-icon__time").click();
|
|
16522
|
+
}
|
|
16260
16523
|
});
|
|
16524
|
+
await page.waitForTimeout(200);
|
|
16525
|
+
if (params.masssend) {
|
|
16526
|
+
const times = Number(await page.locator(".mass-send .multi-sent__notice_time").locator('div[style="display: none;"] div:not([style*="display: none"]) span').textContent());
|
|
16527
|
+
if (0 == times) return {
|
|
16528
|
+
code: 200,
|
|
16529
|
+
message: "今日群发次数用尽,请明天再试。",
|
|
16530
|
+
data: ""
|
|
16531
|
+
};
|
|
16532
|
+
await page.locator(".mass-send .mass_send__notify").locator(".weui-desktop-switch__box").check();
|
|
16533
|
+
} else await page.locator(".mass-send .mass_send__notify").locator(".weui-desktop-switch__box").uncheck();
|
|
16534
|
+
await page.waitForTimeout(200);
|
|
16261
16535
|
await page.waitForSelector('.new_mass_send_dialog .weui-desktop-dialog__wrp:not([style*="display: none"])', {
|
|
16262
16536
|
state: "visible"
|
|
16263
16537
|
});
|
|
@@ -16266,6 +16540,19 @@ var __webpack_exports__ = {};
|
|
|
16266
16540
|
state: "visible"
|
|
16267
16541
|
});
|
|
16268
16542
|
await page.locator(".double_check_dialog .weui-desktop-dialog .weui-desktop-dialog__ft button.weui-desktop-btn_primary").click();
|
|
16543
|
+
await page.waitForTimeout(2000);
|
|
16544
|
+
const originalCheckDialog = page.locator('div[data-transfer="true"][width\\.number="800"][height\\.number="800"] .weui-desktop-dialog__title');
|
|
16545
|
+
if (await originalCheckDialog.count() > 0) {
|
|
16546
|
+
if (await originalCheckDialog.textContent() === "原创校验") {
|
|
16547
|
+
const popMassend = page.locator('div[data-transfer="true"][width\\.number="800"][height\\.number="800"]');
|
|
16548
|
+
await popMassend.locator(".weui-desktop-btn_primary", {
|
|
16549
|
+
hasText: "下一步"
|
|
16550
|
+
}).click();
|
|
16551
|
+
await popMassend.locator(".weui-desktop-btn_primary", {
|
|
16552
|
+
hasText: "继续"
|
|
16553
|
+
}).click();
|
|
16554
|
+
}
|
|
16555
|
+
}
|
|
16269
16556
|
try {
|
|
16270
16557
|
const startTime = Date.now();
|
|
16271
16558
|
await new Promise(async (resolve, reject)=>{
|
|
@@ -16992,9 +17279,7 @@ var __webpack_exports__ = {};
|
|
|
16992
17279
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
16993
17280
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
16994
17281
|
};
|
|
16995
|
-
var package_namespaceObject = {
|
|
16996
|
-
i8: "1.2.10"
|
|
16997
|
-
};
|
|
17282
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.11-beta.1"}');
|
|
16998
17283
|
class Action {
|
|
16999
17284
|
constructor(task){
|
|
17000
17285
|
this.task = task;
|
|
@@ -17018,6 +17303,18 @@ var __webpack_exports__ = {};
|
|
|
17018
17303
|
searchToutiaoTopicList(params) {
|
|
17019
17304
|
return this.bindTask(searchToutiaoTopicList, params);
|
|
17020
17305
|
}
|
|
17306
|
+
TTFansExport(params) {
|
|
17307
|
+
return this.bindTask(TTFansExport, params);
|
|
17308
|
+
}
|
|
17309
|
+
XhsFansExport(params) {
|
|
17310
|
+
return this.bindTask(XhsFansExport, params);
|
|
17311
|
+
}
|
|
17312
|
+
WxFansExport(params) {
|
|
17313
|
+
return this.bindTask(WxFansExport, params);
|
|
17314
|
+
}
|
|
17315
|
+
BjhFansExport(params) {
|
|
17316
|
+
return this.bindTask(BjhFansExport, params);
|
|
17317
|
+
}
|
|
17021
17318
|
getToutiaoConfig(params) {
|
|
17022
17319
|
return this.bindTask(getToutiaoConfig, params);
|
|
17023
17320
|
}
|