@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/index.js
CHANGED
|
@@ -1258,6 +1258,27 @@ var __webpack_exports__ = {};
|
|
|
1258
1258
|
parser.end();
|
|
1259
1259
|
return srcList;
|
|
1260
1260
|
};
|
|
1261
|
+
class TimeFormatter {
|
|
1262
|
+
static format(timestamp, formatStr = 'yyyy-MM-dd hh:mm') {
|
|
1263
|
+
if ('number' == typeof timestamp && 10 === timestamp.toString().length) timestamp *= 1000;
|
|
1264
|
+
const date = new Date(timestamp);
|
|
1265
|
+
const map = {
|
|
1266
|
+
yyyy: String(date.getFullYear()),
|
|
1267
|
+
yy: String(date.getFullYear()).slice(-2),
|
|
1268
|
+
MM: String(date.getMonth() + 1).padStart(2, '0'),
|
|
1269
|
+
dd: String(date.getDate()).padStart(2, '0'),
|
|
1270
|
+
hh: String(date.getHours()).padStart(2, '0'),
|
|
1271
|
+
mm: String(date.getMinutes()).padStart(2, '0'),
|
|
1272
|
+
ss: String(date.getSeconds()).padStart(2, '0'),
|
|
1273
|
+
M: String(date.getMonth() + 1),
|
|
1274
|
+
d: String(date.getDate()),
|
|
1275
|
+
h: String(date.getHours()),
|
|
1276
|
+
m: String(date.getMinutes()),
|
|
1277
|
+
s: String(date.getSeconds())
|
|
1278
|
+
};
|
|
1279
|
+
return formatStr.replace(/yyyy|yy|MM|dd|hh|mm|ss|M|d|h|m|s/g, (key)=>map[key]);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1261
1282
|
const replaceImgSrc = (html, callback)=>{
|
|
1262
1283
|
let lastedHtml = html;
|
|
1263
1284
|
const isImageTag = (node)=>"tag" === node.type && "img" === node.name;
|
|
@@ -1526,6 +1547,7 @@ var __webpack_exports__ = {};
|
|
|
1526
1547
|
cover_source: "upload",
|
|
1527
1548
|
activity_list
|
|
1528
1549
|
};
|
|
1550
|
+
params.settingInfo.timer && (publishData['timer_time'] = params.settingInfo.timer);
|
|
1529
1551
|
const isDraft = "draft" === params.saveType;
|
|
1530
1552
|
const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
|
|
1531
1553
|
const res = await http.api({
|
|
@@ -1647,13 +1669,16 @@ var __webpack_exports__ = {};
|
|
|
1647
1669
|
if (await findActivity.count() > 0) findActivity.first().locator("..").click();
|
|
1648
1670
|
}
|
|
1649
1671
|
}
|
|
1650
|
-
const articleId = await new Promise((resolve)=>{
|
|
1672
|
+
const { articleId, message } = await new Promise(async (resolve)=>{
|
|
1651
1673
|
const handleResponse = async (response)=>{
|
|
1652
1674
|
const url = response.url();
|
|
1653
1675
|
if (url.includes("/pcui/article/save") || url.includes("/pcui/article/publish")) {
|
|
1654
1676
|
const jsonResponse = await response.json();
|
|
1655
1677
|
page.off("response", handleResponse);
|
|
1656
|
-
resolve(
|
|
1678
|
+
resolve({
|
|
1679
|
+
articleId: jsonResponse?.ret?.article_id,
|
|
1680
|
+
message: jsonResponse?.errmsg
|
|
1681
|
+
});
|
|
1657
1682
|
}
|
|
1658
1683
|
};
|
|
1659
1684
|
page.on("response", handleResponse);
|
|
@@ -1661,12 +1686,74 @@ var __webpack_exports__ = {};
|
|
|
1661
1686
|
if ("draft" === params.saveType) operatorContainer.locator(".op-btn-outter-content").filter({
|
|
1662
1687
|
hasText: "存草稿"
|
|
1663
1688
|
}).locator("button").click();
|
|
1664
|
-
else
|
|
1665
|
-
|
|
1689
|
+
else if (params.settingInfo.timer) {
|
|
1690
|
+
await operatorContainer.locator(".op-btn-outter-content").filter({
|
|
1691
|
+
hasText: "定时发布"
|
|
1692
|
+
}).locator("button").click();
|
|
1693
|
+
await page.locator(".timepublish-wrap-select .select-wrap", {
|
|
1694
|
+
hasText: "日"
|
|
1695
|
+
}).click();
|
|
1696
|
+
await page.locator('#select-date_list + * .cheetah-select-item-option', {
|
|
1697
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "M月dd日")
|
|
1698
|
+
}).click();
|
|
1699
|
+
await page.waitForTimeout(200);
|
|
1700
|
+
await page.locator(".timepublish-wrap-select .select-wrap", {
|
|
1701
|
+
hasText: "点"
|
|
1702
|
+
}).click();
|
|
1703
|
+
await page.locator('#select-hour_list +div.rc-virtual-list').hover();
|
|
1704
|
+
const scrollHourInfo = await page.evaluate(()=>{
|
|
1705
|
+
const hourInner = document.querySelector('#select-hour_list + * .rc-virtual-list-holder-inner');
|
|
1706
|
+
const hourElementHeight = hourInner?.children[0].clientHeight || 36;
|
|
1707
|
+
const hourMapsElem = Array.from(document.querySelectorAll('#select-hour_list + * .cheetah-select-item-option .cheetah-select-item-option-content'));
|
|
1708
|
+
const hourMap = hourMapsElem.map((item)=>item.textContent?.trim());
|
|
1709
|
+
return {
|
|
1710
|
+
elementHeight: hourElementHeight,
|
|
1711
|
+
elementItem: hourMap
|
|
1712
|
+
};
|
|
1713
|
+
});
|
|
1714
|
+
const fistHourElem = scrollHourInfo.elementItem[0];
|
|
1715
|
+
let fistHourElemH = Number(fistHourElem?.split("点")[0]);
|
|
1716
|
+
const lastHourElem = scrollHourInfo.elementItem[scrollHourInfo.elementItem.length - 1];
|
|
1717
|
+
let lastHourElemH = Number(lastHourElem?.split("点")[0]);
|
|
1718
|
+
let targetTimeH = Number(TimeFormatter.format(params.settingInfo.timer, 'h'));
|
|
1719
|
+
await page.mouse.wheel(0, targetTimeH > lastHourElemH ? (targetTimeH - lastHourElemH) * scrollHourInfo.elementHeight : targetTimeH < fistHourElemH ? -(fistHourElemH - targetTimeH) * scrollHourInfo.elementHeight : 0);
|
|
1720
|
+
await page.locator("#select-hour_list + * .cheetah-select-item-option ", {
|
|
1721
|
+
hasText: targetTimeH + "点"
|
|
1722
|
+
}).click();
|
|
1723
|
+
await page.waitForTimeout(200);
|
|
1724
|
+
await page.locator(".timepublish-wrap-select .select-wrap", {
|
|
1725
|
+
hasText: "分"
|
|
1726
|
+
}).click();
|
|
1727
|
+
await page.locator('#select-minute_list +div.rc-virtual-list').hover();
|
|
1728
|
+
const scrollMinuteInfo = await page.evaluate(()=>{
|
|
1729
|
+
const hourInner = document.querySelector('#select-minute_list + * .rc-virtual-list-holder-inner');
|
|
1730
|
+
const hourElementHeight = hourInner?.children[0].clientHeight || 36;
|
|
1731
|
+
const hourMapsElem = Array.from(document.querySelectorAll('#select-minute_list + * .cheetah-select-item-option .cheetah-select-item-option-content'));
|
|
1732
|
+
const hourMap = hourMapsElem.map((item)=>item.textContent?.trim());
|
|
1733
|
+
return {
|
|
1734
|
+
elementHeight: hourElementHeight,
|
|
1735
|
+
elementItem: hourMap
|
|
1736
|
+
};
|
|
1737
|
+
});
|
|
1738
|
+
const fistMinuteElem = scrollMinuteInfo.elementItem[0];
|
|
1739
|
+
let fistMinuteElemH = Number(fistMinuteElem?.split("分")[0]);
|
|
1740
|
+
const lastMinuteElem = scrollMinuteInfo.elementItem[scrollMinuteInfo.elementItem.length - 1];
|
|
1741
|
+
let lastMinuteElemH = Number(lastMinuteElem?.split("分")[0]);
|
|
1742
|
+
let targetTimeM = Number(TimeFormatter.format(params.settingInfo.timer, 'm'));
|
|
1743
|
+
await page.mouse.wheel(0, targetTimeM > lastMinuteElemH ? (targetTimeM - lastMinuteElemH) * scrollMinuteInfo.elementHeight : targetTimeM < fistMinuteElemH ? -(fistMinuteElemH - targetTimeM) * scrollMinuteInfo.elementHeight : 0);
|
|
1744
|
+
await page.locator("#select-minute_list + * .cheetah-select-item-option ", {
|
|
1745
|
+
hasText: targetTimeM + "分"
|
|
1746
|
+
}).click();
|
|
1747
|
+
await page.waitForTimeout(200);
|
|
1748
|
+
await page.locator(".cheetah-modal-confirm-btns button").filter({
|
|
1749
|
+
hasText: "定时发布"
|
|
1750
|
+
}).click();
|
|
1751
|
+
} else operatorContainer.locator(".op-btn-outter-content").filter({
|
|
1752
|
+
hasText: /^发布/
|
|
1666
1753
|
}).locator("button").click();
|
|
1667
1754
|
});
|
|
1668
1755
|
await page.close();
|
|
1669
|
-
return (0, share_namespaceObject.success)(articleId);
|
|
1756
|
+
return (0, share_namespaceObject.success)(articleId, articleId ? "发布成功" : message);
|
|
1670
1757
|
};
|
|
1671
1758
|
const baijiahaoPublish = async (task, params)=>{
|
|
1672
1759
|
if ("rpa" === params.actionType) return rpaAction(task, params);
|
|
@@ -1847,7 +1934,7 @@ var __webpack_exports__ = {};
|
|
|
1847
1934
|
2005: "账号无【申明原创】权限,请关闭申明后重试。",
|
|
1848
1935
|
100004: "用户未登录或登陆已过期,请重新登陆后重试。"
|
|
1849
1936
|
};
|
|
1850
|
-
const
|
|
1937
|
+
const mock_generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
|
|
1851
1938
|
const encodedKey = encodeURIComponent(key);
|
|
1852
1939
|
const encodedValue = encodeURIComponent(String(value));
|
|
1853
1940
|
return `${encodedKey}=${encodedValue}`;
|
|
@@ -1971,8 +2058,8 @@ var __webpack_exports__ = {};
|
|
|
1971
2058
|
trends_writing_tag: 0,
|
|
1972
2059
|
is_refute_rumor: 0,
|
|
1973
2060
|
save: "publish" === params.saveType ? 1 : 0,
|
|
1974
|
-
timer_status: 0,
|
|
1975
|
-
timer_time: "",
|
|
2061
|
+
timer_status: params.settingInfo.timer ? 1 : 0,
|
|
2062
|
+
timer_time: params.settingInfo.timer ? TimeFormatter.format(params.settingInfo.timer) : "",
|
|
1976
2063
|
title: params.title,
|
|
1977
2064
|
content: content + topicContent,
|
|
1978
2065
|
extra: JSON.stringify(extraData),
|
|
@@ -1997,32 +2084,40 @@ var __webpack_exports__ = {};
|
|
|
1997
2084
|
claim_exclusive: toutiaoOriginal.includes("exclusive") ? 1 : 0
|
|
1998
2085
|
};
|
|
1999
2086
|
const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2087
|
+
let publishOption = {};
|
|
2088
|
+
if (msToken) {
|
|
2089
|
+
const postHeaders = mock_generatorFormData({
|
|
2090
|
+
source: "mp",
|
|
2091
|
+
type: "article",
|
|
2092
|
+
aid: 1231,
|
|
2093
|
+
mp_publish_ab_val: 0,
|
|
2094
|
+
msToken: msToken
|
|
2095
|
+
});
|
|
2096
|
+
const postData = mock_generatorFormData(publishData);
|
|
2097
|
+
let a_bogus = GenAB(postHeaders, postData);
|
|
2098
|
+
publishOption = {
|
|
2099
|
+
method: "post",
|
|
2100
|
+
url: `https://mp.toutiao.com/mp/agw/article/publish?${postHeaders}&a_bogus=${a_bogus}`,
|
|
2101
|
+
data: postData,
|
|
2102
|
+
headers: {
|
|
2103
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
2104
|
+
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
|
|
2105
|
+
},
|
|
2106
|
+
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
2107
|
+
};
|
|
2108
|
+
} else publishOption = {
|
|
2015
2109
|
method: "post",
|
|
2016
|
-
url:
|
|
2017
|
-
data:
|
|
2110
|
+
url: "https://mp.toutiao.com/mp/agw/article/publish?source=mp&type=article&aid=1",
|
|
2111
|
+
data: publishData,
|
|
2018
2112
|
headers: {
|
|
2019
|
-
"content-type": "application/x-www-form-urlencoded"
|
|
2020
|
-
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
|
|
2113
|
+
"content-type": "application/x-www-form-urlencoded"
|
|
2021
2114
|
},
|
|
2022
2115
|
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
2023
|
-
}
|
|
2116
|
+
};
|
|
2117
|
+
const publishResult = await http.api(publishOption);
|
|
2024
2118
|
return (0, share_namespaceObject.success)(publishResult.data.pgc_id);
|
|
2025
2119
|
};
|
|
2120
|
+
const rpa_GenAB = __webpack_require__("./src/utils/ttABEncrypt.js");
|
|
2026
2121
|
const rpa_rpaAction = async (task, params)=>{
|
|
2027
2122
|
const tmpCachePath = task.getTmpPath();
|
|
2028
2123
|
const commonCookies = {
|
|
@@ -2057,9 +2152,30 @@ var __webpack_exports__ = {};
|
|
|
2057
2152
|
await page.route('**', async (route, request)=>{
|
|
2058
2153
|
const url = new URL(request.url());
|
|
2059
2154
|
if (interceptUrls.some((pattern)=>url.pathname.includes(pattern))) {
|
|
2060
|
-
|
|
2155
|
+
const headers = {
|
|
2156
|
+
...request.headers(),
|
|
2157
|
+
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
|
|
2158
|
+
};
|
|
2159
|
+
const generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
|
|
2160
|
+
const encodedKey = encodeURIComponent(key);
|
|
2161
|
+
const encodedValue = encodeURIComponent(String(value));
|
|
2162
|
+
return `${encodedKey}=${encodedValue}`;
|
|
2163
|
+
}).join('&');
|
|
2164
|
+
const postHeaders = generatorFormData({
|
|
2165
|
+
source: "mp",
|
|
2166
|
+
type: "article",
|
|
2167
|
+
aid: 1231,
|
|
2168
|
+
mp_publish_ab_val: 0,
|
|
2169
|
+
msToken: url.searchParams.get('msToken')
|
|
2170
|
+
});
|
|
2171
|
+
const postData = request.postData() || "";
|
|
2172
|
+
let a_bogus = rpa_GenAB(postHeaders, postData);
|
|
2173
|
+
url.searchParams.set('aid', "1231");
|
|
2174
|
+
url.searchParams.set('mp_publish_ab_val', "0");
|
|
2175
|
+
url.searchParams.set('a_bogus', a_bogus);
|
|
2061
2176
|
await route.continue({
|
|
2062
|
-
url: url.toString()
|
|
2177
|
+
url: url.toString(),
|
|
2178
|
+
headers: headers
|
|
2063
2179
|
});
|
|
2064
2180
|
} else await route.continue();
|
|
2065
2181
|
});
|
|
@@ -2140,7 +2256,7 @@ var __webpack_exports__ = {};
|
|
|
2140
2256
|
}).locator("xpath=..");
|
|
2141
2257
|
exclusiveContainer.locator(".exclusive .exclusive-checkbox-wraper .byte-checkbox").click();
|
|
2142
2258
|
}
|
|
2143
|
-
const articleId = await new Promise((resolve)=>{
|
|
2259
|
+
const articleId = await new Promise(async (resolve)=>{
|
|
2144
2260
|
const handleResponse = async (response)=>{
|
|
2145
2261
|
const url = response.url();
|
|
2146
2262
|
if (url.includes("/mp/agw/article/publish")) {
|
|
@@ -2150,7 +2266,32 @@ var __webpack_exports__ = {};
|
|
|
2150
2266
|
}
|
|
2151
2267
|
};
|
|
2152
2268
|
page.on("response", handleResponse);
|
|
2153
|
-
|
|
2269
|
+
if (params.settingInfo.timer) {
|
|
2270
|
+
await page.locator(".publish-footer button").filter({
|
|
2271
|
+
hasText: "定时发布"
|
|
2272
|
+
}).click();
|
|
2273
|
+
await page.waitForSelector('button.publish-btn:not(.byte-btn-loading) >> nth=1', {
|
|
2274
|
+
state: 'attached'
|
|
2275
|
+
});
|
|
2276
|
+
await page.locator(".byte-modal-content .day-select .byte-select-view-value").click();
|
|
2277
|
+
await page.locator('li.byte-select-option', {
|
|
2278
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "MM月dd日")
|
|
2279
|
+
}).click();
|
|
2280
|
+
await page.waitForTimeout(200);
|
|
2281
|
+
await page.locator(".byte-modal-content .hour-select .byte-select-view-value").click();
|
|
2282
|
+
await page.locator('li.byte-select-option', {
|
|
2283
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "h")
|
|
2284
|
+
}).click();
|
|
2285
|
+
await page.waitForTimeout(200);
|
|
2286
|
+
await page.locator(".byte-modal-content .minute-select .byte-select-view-value").click();
|
|
2287
|
+
await page.locator('li.byte-select-option', {
|
|
2288
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "m")
|
|
2289
|
+
}).click();
|
|
2290
|
+
await page.waitForTimeout(200);
|
|
2291
|
+
await page.locator(".byte-modal-footer button").filter({
|
|
2292
|
+
hasText: "预览并定时发布"
|
|
2293
|
+
}).click();
|
|
2294
|
+
} else await page.locator(".publish-footer button").filter({
|
|
2154
2295
|
hasText: "预览并发布"
|
|
2155
2296
|
}).click();
|
|
2156
2297
|
});
|
|
@@ -2161,13 +2302,13 @@ var __webpack_exports__ = {};
|
|
|
2161
2302
|
}
|
|
2162
2303
|
if ("publish" === params.saveType) {
|
|
2163
2304
|
await page.locator(".publish-footer button").filter({
|
|
2164
|
-
hasText: "确认发布"
|
|
2305
|
+
hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
|
|
2165
2306
|
}).waitFor({
|
|
2166
2307
|
state: "visible"
|
|
2167
2308
|
});
|
|
2168
2309
|
await page.waitForTimeout(200);
|
|
2169
2310
|
await page.locator(".publish-footer button").filter({
|
|
2170
|
-
hasText: "确认发布"
|
|
2311
|
+
hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
|
|
2171
2312
|
}).click();
|
|
2172
2313
|
}
|
|
2173
2314
|
await page.close();
|
|
@@ -2184,6 +2325,106 @@ var __webpack_exports__ = {};
|
|
|
2184
2325
|
if ("mockApi" === params.actionType) return mock_mockAction(task, params);
|
|
2185
2326
|
return executeAction(mock_mockAction, rpa_rpaAction)(task, params);
|
|
2186
2327
|
};
|
|
2328
|
+
const TTFansExport = async (_task, params)=>{
|
|
2329
|
+
const http = new Http({
|
|
2330
|
+
headers: {
|
|
2331
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2332
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2333
|
+
}
|
|
2334
|
+
});
|
|
2335
|
+
try {
|
|
2336
|
+
const res = await http.api({
|
|
2337
|
+
method: "get",
|
|
2338
|
+
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?app_id=1231",
|
|
2339
|
+
params: {
|
|
2340
|
+
app_id: 1231
|
|
2341
|
+
}
|
|
2342
|
+
});
|
|
2343
|
+
return (0, share_namespaceObject.success)(0 === res.code ? {
|
|
2344
|
+
fans_count: res.total_fans_count
|
|
2345
|
+
} : {
|
|
2346
|
+
fans_count: null
|
|
2347
|
+
}, "获取粉丝数成功!");
|
|
2348
|
+
} catch (error) {
|
|
2349
|
+
return (0, share_namespaceObject.success)({
|
|
2350
|
+
fans_count: null
|
|
2351
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2352
|
+
}
|
|
2353
|
+
};
|
|
2354
|
+
const XhsFansExport = async (_task, params)=>{
|
|
2355
|
+
const http = new Http({
|
|
2356
|
+
headers: {
|
|
2357
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2358
|
+
referer: "https://creator.xiaohongshu.com/new/home?source=official"
|
|
2359
|
+
}
|
|
2360
|
+
});
|
|
2361
|
+
try {
|
|
2362
|
+
const res = await http.api({
|
|
2363
|
+
method: "get",
|
|
2364
|
+
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
2365
|
+
});
|
|
2366
|
+
return (0, share_namespaceObject.success)(0 === res.result ? {
|
|
2367
|
+
fans_count: res.data.fans_count
|
|
2368
|
+
} : {
|
|
2369
|
+
fans_count: null
|
|
2370
|
+
}, "获取粉丝数成功!");
|
|
2371
|
+
} catch (error) {
|
|
2372
|
+
return (0, share_namespaceObject.success)({
|
|
2373
|
+
fans_count: null
|
|
2374
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2377
|
+
const WxFansExport = async (_task, params)=>{
|
|
2378
|
+
const http = new Http({
|
|
2379
|
+
headers: {
|
|
2380
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2381
|
+
}
|
|
2382
|
+
});
|
|
2383
|
+
try {
|
|
2384
|
+
const htmlStr = await http.api({
|
|
2385
|
+
method: "get",
|
|
2386
|
+
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
2387
|
+
params: {
|
|
2388
|
+
t: "home/index",
|
|
2389
|
+
token: params.token,
|
|
2390
|
+
lang: "zh_CN"
|
|
2391
|
+
}
|
|
2392
|
+
});
|
|
2393
|
+
const match = htmlStr.match(/总用户数[\s\S]*?<mp-thousandth>(\d+)<\/mp-thousandth>/);
|
|
2394
|
+
return (0, share_namespaceObject.success)(match ? {
|
|
2395
|
+
fans_count: Number(match[1])
|
|
2396
|
+
} : {
|
|
2397
|
+
fans_count: null
|
|
2398
|
+
}, "获取粉丝数成功!");
|
|
2399
|
+
} catch (error) {
|
|
2400
|
+
return (0, share_namespaceObject.success)({
|
|
2401
|
+
fans_count: null
|
|
2402
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2403
|
+
}
|
|
2404
|
+
};
|
|
2405
|
+
const BjhFansExport = async (_task, params)=>{
|
|
2406
|
+
const http = new Http({
|
|
2407
|
+
headers: {
|
|
2408
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2409
|
+
referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
2410
|
+
}
|
|
2411
|
+
});
|
|
2412
|
+
try {
|
|
2413
|
+
const res = await http.api({
|
|
2414
|
+
method: "get",
|
|
2415
|
+
url: "https://baijiahao.baidu.com/cms-ui/rights/growth/get_info"
|
|
2416
|
+
});
|
|
2417
|
+
return (0, share_namespaceObject.success)(0 === res.errno ? {
|
|
2418
|
+
fans_count: res.data.total_fans
|
|
2419
|
+
} : {
|
|
2420
|
+
fans_count: null
|
|
2421
|
+
}, "获取粉丝数成功!");
|
|
2422
|
+
} catch (error) {
|
|
2423
|
+
return (0, share_namespaceObject.success)({
|
|
2424
|
+
fans_count: null
|
|
2425
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2426
|
+
}
|
|
2427
|
+
};
|
|
2187
2428
|
const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
2188
2429
|
const tmpCachePath = task.getTmpPath();
|
|
2189
2430
|
const http = new Http({
|
|
@@ -2342,7 +2583,8 @@ var __webpack_exports__ = {};
|
|
|
2342
2583
|
"-4": "不支持发布审核中或转码中的视频",
|
|
2343
2584
|
"-2": "不支持发布审核中或转码中的视频",
|
|
2344
2585
|
770001: "不支持发布审核中或转码中的视频",
|
|
2345
|
-
200074: "系统繁忙,请稍后重试!"
|
|
2586
|
+
200074: "系统繁忙,请稍后重试!",
|
|
2587
|
+
64702: "标题超出64字长度限制,请修改标题后重试。"
|
|
2346
2588
|
};
|
|
2347
2589
|
const ignoreErrno = [
|
|
2348
2590
|
154019
|
|
@@ -2352,7 +2594,7 @@ var __webpack_exports__ = {};
|
|
|
2352
2594
|
已关注的用户: 2,
|
|
2353
2595
|
已关注7天及以上的用户: 3
|
|
2354
2596
|
};
|
|
2355
|
-
const
|
|
2597
|
+
const weixinPublish_mock_generatorFormData = (data)=>{
|
|
2356
2598
|
const formData = new URLSearchParams();
|
|
2357
2599
|
for (const [key, value] of Object.entries(data))formData.append(key, String(value));
|
|
2358
2600
|
return formData.toString();
|
|
@@ -2368,7 +2610,7 @@ var __webpack_exports__ = {};
|
|
|
2368
2610
|
token: params.token,
|
|
2369
2611
|
lang: "zh_CN"
|
|
2370
2612
|
},
|
|
2371
|
-
data:
|
|
2613
|
+
data: weixinPublish_mock_generatorFormData(data)
|
|
2372
2614
|
});
|
|
2373
2615
|
} catch (error) {
|
|
2374
2616
|
resData = error?.data;
|
|
@@ -2482,7 +2724,7 @@ var __webpack_exports__ = {};
|
|
|
2482
2724
|
params: {
|
|
2483
2725
|
action: "searchacct"
|
|
2484
2726
|
},
|
|
2485
|
-
data:
|
|
2727
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2486
2728
|
lang: "zh_CN",
|
|
2487
2729
|
f: "json",
|
|
2488
2730
|
ajax: 1,
|
|
@@ -2611,7 +2853,7 @@ var __webpack_exports__ = {};
|
|
|
2611
2853
|
params: {
|
|
2612
2854
|
action: 'addautoreply'
|
|
2613
2855
|
},
|
|
2614
|
-
data:
|
|
2856
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2615
2857
|
type: 1,
|
|
2616
2858
|
fingerprint,
|
|
2617
2859
|
token: params.token,
|
|
@@ -2733,7 +2975,7 @@ var __webpack_exports__ = {};
|
|
|
2733
2975
|
type: 77,
|
|
2734
2976
|
lang: "zh_CN"
|
|
2735
2977
|
},
|
|
2736
|
-
data:
|
|
2978
|
+
data: weixinPublish_mock_generatorFormData(draftData),
|
|
2737
2979
|
defaultErrorMsg: "创建草稿失败,请稍后重试发布。"
|
|
2738
2980
|
});
|
|
2739
2981
|
if ("draft" === params.saveType) return {
|
|
@@ -2766,7 +3008,7 @@ var __webpack_exports__ = {};
|
|
|
2766
3008
|
lang: "zh_CN",
|
|
2767
3009
|
token: params.token
|
|
2768
3010
|
},
|
|
2769
|
-
data:
|
|
3011
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2770
3012
|
token: params.token,
|
|
2771
3013
|
lang: "zh_CN",
|
|
2772
3014
|
f: "json",
|
|
@@ -2797,7 +3039,7 @@ var __webpack_exports__ = {};
|
|
|
2797
3039
|
token: params.token,
|
|
2798
3040
|
lang: "zh_CN"
|
|
2799
3041
|
},
|
|
2800
|
-
data:
|
|
3042
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2801
3043
|
appmsgid: appMsgId,
|
|
2802
3044
|
fingerprint,
|
|
2803
3045
|
token: params.token,
|
|
@@ -2809,7 +3051,7 @@ var __webpack_exports__ = {};
|
|
|
2809
3051
|
await http.api({
|
|
2810
3052
|
method: "post",
|
|
2811
3053
|
url: "https://mp.weixin.qq.com/cgi-bin/masssend?action=check_same_material",
|
|
2812
|
-
data:
|
|
3054
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2813
3055
|
msgid: appMsgId,
|
|
2814
3056
|
fingerprint,
|
|
2815
3057
|
token: params.token,
|
|
@@ -2848,7 +3090,7 @@ var __webpack_exports__ = {};
|
|
|
2848
3090
|
token: params.token,
|
|
2849
3091
|
lang: "zh_CN"
|
|
2850
3092
|
},
|
|
2851
|
-
data:
|
|
3093
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2852
3094
|
appmsg_id: appMsgId,
|
|
2853
3095
|
fingerprint,
|
|
2854
3096
|
token: params.token,
|
|
@@ -2867,7 +3109,7 @@ var __webpack_exports__ = {};
|
|
|
2867
3109
|
params: {
|
|
2868
3110
|
action: "check_music"
|
|
2869
3111
|
},
|
|
2870
|
-
data:
|
|
3112
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2871
3113
|
appmsgid: appMsgId,
|
|
2872
3114
|
masssend_check: 1,
|
|
2873
3115
|
fingerprint,
|
|
@@ -2887,7 +3129,7 @@ var __webpack_exports__ = {};
|
|
|
2887
3129
|
lang: "zh_CN",
|
|
2888
3130
|
1: 1
|
|
2889
3131
|
},
|
|
2890
|
-
data:
|
|
3132
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2891
3133
|
token: params.token,
|
|
2892
3134
|
lang: "zh_CN",
|
|
2893
3135
|
f: "json",
|
|
@@ -2907,7 +3149,7 @@ var __webpack_exports__ = {};
|
|
|
2907
3149
|
lang: "zh_CN",
|
|
2908
3150
|
1: 1
|
|
2909
3151
|
},
|
|
2910
|
-
data:
|
|
3152
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2911
3153
|
token: params.token,
|
|
2912
3154
|
lang: "zh_CN",
|
|
2913
3155
|
f: "json",
|
|
@@ -2939,6 +3181,7 @@ var __webpack_exports__ = {};
|
|
|
2939
3181
|
ticket: getTicketResult.ticket,
|
|
2940
3182
|
uuid,
|
|
2941
3183
|
msgid: operation_seq,
|
|
3184
|
+
open_email: !!params.settingInfo.timer,
|
|
2942
3185
|
...params.masssend ? {} : {
|
|
2943
3186
|
publish_type: 1
|
|
2944
3187
|
}
|
|
@@ -2961,7 +3204,7 @@ var __webpack_exports__ = {};
|
|
|
2961
3204
|
lang: "zh_CN",
|
|
2962
3205
|
timespam: Date.now()
|
|
2963
3206
|
},
|
|
2964
|
-
data:
|
|
3207
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2965
3208
|
token: params.token,
|
|
2966
3209
|
lang: "zh_CN",
|
|
2967
3210
|
f: "json",
|
|
@@ -2991,7 +3234,7 @@ var __webpack_exports__ = {};
|
|
|
2991
3234
|
lang: "zh_CN",
|
|
2992
3235
|
1: 1
|
|
2993
3236
|
},
|
|
2994
|
-
data:
|
|
3237
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2995
3238
|
token: params.token,
|
|
2996
3239
|
lang: "zh_CN",
|
|
2997
3240
|
f: "json",
|
|
@@ -3013,7 +3256,7 @@ var __webpack_exports__ = {};
|
|
|
3013
3256
|
is_release_publish_page: 1
|
|
3014
3257
|
}
|
|
3015
3258
|
},
|
|
3016
|
-
data:
|
|
3259
|
+
data: weixinPublish_mock_generatorFormData({
|
|
3017
3260
|
token: params.token,
|
|
3018
3261
|
lang: "zh_CN",
|
|
3019
3262
|
f: "json",
|
|
@@ -3030,7 +3273,7 @@ var __webpack_exports__ = {};
|
|
|
3030
3273
|
country: "",
|
|
3031
3274
|
province: "",
|
|
3032
3275
|
city: "",
|
|
3033
|
-
send_time: "0",
|
|
3276
|
+
send_time: params.settingInfo.timer ? params.settingInfo.timer : "0",
|
|
3034
3277
|
type: "10",
|
|
3035
3278
|
share_page: "1",
|
|
3036
3279
|
synctxweibo: "0",
|
|
@@ -3047,7 +3290,7 @@ var __webpack_exports__ = {};
|
|
|
3047
3290
|
}),
|
|
3048
3291
|
defaultErrorMsg: params.masssend ? "文章群发异常,请尝试关闭群发或稍后重试。" : "文章发布异常,请稍后重试。"
|
|
3049
3292
|
});
|
|
3050
|
-
return (0, share_namespaceObject.success)(appMsgId, "微信公众号发布完成。");
|
|
3293
|
+
return (0, share_namespaceObject.success)(appMsgId, params.settingInfo.timer ? "微信公众号文章定时发布成功。" : "微信公众号发布完成。");
|
|
3051
3294
|
};
|
|
3052
3295
|
const waitQrcodeResultMaxTime = 2000 * scanRetryMaxCount;
|
|
3053
3296
|
const weixinPublish_rpa_rpaAction = async (task, params)=>{
|
|
@@ -3168,6 +3411,10 @@ var __webpack_exports__ = {};
|
|
|
3168
3411
|
checkInterval: 1000,
|
|
3169
3412
|
stopAfterClick: false
|
|
3170
3413
|
});
|
|
3414
|
+
PopupListener(page, '[extclass="weui-desktop-dialog_simple"] .weui-desktop-dialog', "小店", '[extclass="weui-desktop-dialog_simple"] .weui-desktop-icon-btn.weui-desktop-dialog__close-btn', {
|
|
3415
|
+
checkInterval: 1000,
|
|
3416
|
+
stopAfterClick: true
|
|
3417
|
+
});
|
|
3171
3418
|
const titleInstance = page.locator("#js_title_main textarea#title");
|
|
3172
3419
|
await titleInstance.click();
|
|
3173
3420
|
await titleInstance.fill(params.title);
|
|
@@ -3324,8 +3571,8 @@ var __webpack_exports__ = {};
|
|
|
3324
3571
|
const wxInteraction_bd = wxInteraction_setting.locator('.weui-desktop-dialog__bd');
|
|
3325
3572
|
const wxInteraction_ft = wxInteraction_setting.locator('.weui-desktop-dialog__ft');
|
|
3326
3573
|
if ("public" == params.settingInfo.wxInteraction.Type) {
|
|
3327
|
-
await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
|
|
3328
|
-
hasText:
|
|
3574
|
+
await wxInteraction_bd.locator('.weui-desktop-form__check-label span', {
|
|
3575
|
+
hasText: /^(开启|留言)$/
|
|
3329
3576
|
}).click();
|
|
3330
3577
|
const comment_area = wxInteraction_bd.locator('.comment-options-block.pt0');
|
|
3331
3578
|
const reply_area = wxInteraction_bd.locator('.comment-options-block.bb0.pb0');
|
|
@@ -3343,8 +3590,8 @@ var __webpack_exports__ = {};
|
|
|
3343
3590
|
}).click();
|
|
3344
3591
|
if (params.settingInfo.wxInteraction.Option?.elect_reply) await reply_area.locator('.weui-desktop-switch__box').check();
|
|
3345
3592
|
else await reply_area.locator('.weui-desktop-switch__input').isChecked() && reply_area.locator('.weui-desktop-switch__box').uncheck();
|
|
3346
|
-
} else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
|
|
3347
|
-
hasText:
|
|
3593
|
+
} else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label span', {
|
|
3594
|
+
hasText: /^(快捷私信|不开启)$/
|
|
3348
3595
|
}).click();
|
|
3349
3596
|
await wxInteraction_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
|
|
3350
3597
|
}
|
|
@@ -3370,7 +3617,7 @@ var __webpack_exports__ = {};
|
|
|
3370
3617
|
await poperInstance.locator('.frm_radio_item label[for="not_recomment_0"]').click();
|
|
3371
3618
|
}
|
|
3372
3619
|
await page.waitForTimeout(1000);
|
|
3373
|
-
const articleId = await new Promise((resolve)=>{
|
|
3620
|
+
const articleId = await new Promise(async (resolve)=>{
|
|
3374
3621
|
const handleResponse = async (response)=>{
|
|
3375
3622
|
const url = response.url();
|
|
3376
3623
|
const query = parseUrlQueryString(url);
|
|
@@ -3382,7 +3629,34 @@ var __webpack_exports__ = {};
|
|
|
3382
3629
|
};
|
|
3383
3630
|
page.on("response", handleResponse);
|
|
3384
3631
|
page.locator("#editor_pannel #bottom_main #js_button_area #js_send button").click();
|
|
3632
|
+
await page.waitForTimeout(200);
|
|
3633
|
+
if (params.settingInfo.timer) {
|
|
3634
|
+
await page.locator(".mass-send .mass-send__td-setting", {
|
|
3635
|
+
hasText: "定时发表"
|
|
3636
|
+
}).locator(".weui-desktop-switch__box").check();
|
|
3637
|
+
let dateD = Number(TimeFormatter.format(params.settingInfo.timer, "d"));
|
|
3638
|
+
let nowD = Number(TimeFormatter.format(Date.now(), "d"));
|
|
3639
|
+
await page.locator(".mass-send__timer .weui-desktop-form__dropdown__dt").click();
|
|
3640
|
+
const dropMenu = page.locator(".mass-send__timer .weui-desktop-dropdown-menu").locator(".weui-desktop-dropdown__list-ele");
|
|
3641
|
+
await dropMenu.filter({
|
|
3642
|
+
hasText: dateD == nowD ? "今天" : dateD == nowD + 1 ? "明天" : TimeFormatter.format(params.settingInfo.timer, "M月d日")
|
|
3643
|
+
}).click();
|
|
3644
|
+
const timeDropMenu = page.locator(".mass-send__timer .weui-desktop-picker__time:visible");
|
|
3645
|
+
await timeDropMenu.locator(".weui-desktop-form__input").fill(TimeFormatter.format(params.settingInfo.timer, "hh:mm"));
|
|
3646
|
+
await timeDropMenu.locator("i.weui-desktop-icon__time").click();
|
|
3647
|
+
}
|
|
3385
3648
|
});
|
|
3649
|
+
await page.waitForTimeout(200);
|
|
3650
|
+
if (params.masssend) {
|
|
3651
|
+
const times = Number(await page.locator(".mass-send .multi-sent__notice_time").locator('div[style="display: none;"] div:not([style*="display: none"]) span').textContent());
|
|
3652
|
+
if (0 == times) return {
|
|
3653
|
+
code: 200,
|
|
3654
|
+
message: "今日群发次数用尽,请明天再试。",
|
|
3655
|
+
data: ""
|
|
3656
|
+
};
|
|
3657
|
+
await page.locator(".mass-send .mass_send__notify").locator(".weui-desktop-switch__box").check();
|
|
3658
|
+
} else await page.locator(".mass-send .mass_send__notify").locator(".weui-desktop-switch__box").uncheck();
|
|
3659
|
+
await page.waitForTimeout(200);
|
|
3386
3660
|
await page.waitForSelector('.new_mass_send_dialog .weui-desktop-dialog__wrp:not([style*="display: none"])', {
|
|
3387
3661
|
state: "visible"
|
|
3388
3662
|
});
|
|
@@ -3391,6 +3665,19 @@ var __webpack_exports__ = {};
|
|
|
3391
3665
|
state: "visible"
|
|
3392
3666
|
});
|
|
3393
3667
|
await page.locator(".double_check_dialog .weui-desktop-dialog .weui-desktop-dialog__ft button.weui-desktop-btn_primary").click();
|
|
3668
|
+
await page.waitForTimeout(2000);
|
|
3669
|
+
const originalCheckDialog = page.locator('div[data-transfer="true"][width\\.number="800"][height\\.number="800"] .weui-desktop-dialog__title');
|
|
3670
|
+
if (await originalCheckDialog.count() > 0) {
|
|
3671
|
+
if (await originalCheckDialog.textContent() === "原创校验") {
|
|
3672
|
+
const popMassend = page.locator('div[data-transfer="true"][width\\.number="800"][height\\.number="800"]');
|
|
3673
|
+
await popMassend.locator(".weui-desktop-btn_primary", {
|
|
3674
|
+
hasText: "下一步"
|
|
3675
|
+
}).click();
|
|
3676
|
+
await popMassend.locator(".weui-desktop-btn_primary", {
|
|
3677
|
+
hasText: "继续"
|
|
3678
|
+
}).click();
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3394
3681
|
try {
|
|
3395
3682
|
const startTime = Date.now();
|
|
3396
3683
|
await new Promise(async (resolve, reject)=>{
|
|
@@ -4117,9 +4404,7 @@ var __webpack_exports__ = {};
|
|
|
4117
4404
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
4118
4405
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
4119
4406
|
};
|
|
4120
|
-
var package_namespaceObject = {
|
|
4121
|
-
i8: "1.2.10"
|
|
4122
|
-
};
|
|
4407
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.11-beta.1"}');
|
|
4123
4408
|
class Action {
|
|
4124
4409
|
constructor(task){
|
|
4125
4410
|
this.task = task;
|
|
@@ -4143,6 +4428,18 @@ var __webpack_exports__ = {};
|
|
|
4143
4428
|
searchToutiaoTopicList(params) {
|
|
4144
4429
|
return this.bindTask(searchToutiaoTopicList, params);
|
|
4145
4430
|
}
|
|
4431
|
+
TTFansExport(params) {
|
|
4432
|
+
return this.bindTask(TTFansExport, params);
|
|
4433
|
+
}
|
|
4434
|
+
XhsFansExport(params) {
|
|
4435
|
+
return this.bindTask(XhsFansExport, params);
|
|
4436
|
+
}
|
|
4437
|
+
WxFansExport(params) {
|
|
4438
|
+
return this.bindTask(WxFansExport, params);
|
|
4439
|
+
}
|
|
4440
|
+
BjhFansExport(params) {
|
|
4441
|
+
return this.bindTask(BjhFansExport, params);
|
|
4442
|
+
}
|
|
4146
4443
|
getToutiaoConfig(params) {
|
|
4147
4444
|
return this.bindTask(getToutiaoConfig, params);
|
|
4148
4445
|
}
|