@iflyrpa/actions 1.2.11-beta.1 → 1.2.11-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/baijiahaoPublish/index.d.ts +6 -0
- package/dist/actions/getBaijiaohaoConfig/index.d.ts +13 -0
- package/dist/actions/searchToutiaoLocation/index.d.ts +7 -0
- package/dist/actions/searchToutiaoUserID/index.d.ts +7 -0
- package/dist/actions/toutiaoPublish/index.d.ts +15 -0
- package/dist/actions/weixinPublish/index.d.ts +1 -0
- package/dist/bundle.js +377 -79
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +377 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +377 -79
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +14 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1224,9 +1224,14 @@ class TimeFormatter {
|
|
|
1224
1224
|
dd: String(date.getDate()).padStart(2, '0'),
|
|
1225
1225
|
hh: String(date.getHours()).padStart(2, '0'),
|
|
1226
1226
|
mm: String(date.getMinutes()).padStart(2, '0'),
|
|
1227
|
-
ss: String(date.getSeconds()).padStart(2, '0')
|
|
1227
|
+
ss: String(date.getSeconds()).padStart(2, '0'),
|
|
1228
|
+
M: String(date.getMonth() + 1),
|
|
1229
|
+
d: String(date.getDate()),
|
|
1230
|
+
h: String(date.getHours()),
|
|
1231
|
+
m: String(date.getMinutes()),
|
|
1232
|
+
s: String(date.getSeconds())
|
|
1228
1233
|
};
|
|
1229
|
-
return formatStr.replace(/yyyy|yy|MM|dd|hh|mm|ss/g, (key)=>map[key]);
|
|
1234
|
+
return formatStr.replace(/yyyy|yy|MM|dd|hh|mm|ss|M|d|h|m|s/g, (key)=>map[key]);
|
|
1230
1235
|
}
|
|
1231
1236
|
}
|
|
1232
1237
|
const replaceImgSrc = (html, callback)=>{
|
|
@@ -1470,13 +1475,15 @@ const mockAction = async (task, params)=>{
|
|
|
1470
1475
|
is_checked: 1
|
|
1471
1476
|
}
|
|
1472
1477
|
] : [],
|
|
1473
|
-
...
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
}
|
|
1478
|
-
] : []
|
|
1478
|
+
...params.settingInfo.baijiahaoPublishConf?.map((item)=>({
|
|
1479
|
+
id: item.confName,
|
|
1480
|
+
is_checked: item.isChecked ? 1 : 0
|
|
1481
|
+
})) || []
|
|
1479
1482
|
];
|
|
1483
|
+
if (isAi && !activity_list.some((item)=>'aigc_bjh_status' in item)) activity_list.push({
|
|
1484
|
+
id: 'aigc_bjh_status',
|
|
1485
|
+
is_checked: 1
|
|
1486
|
+
});
|
|
1480
1487
|
const publishData = {
|
|
1481
1488
|
title: params.settingInfo.baijiahaoTitle,
|
|
1482
1489
|
content,
|
|
@@ -1492,8 +1499,10 @@ const mockAction = async (task, params)=>{
|
|
|
1492
1499
|
usingImgFilter: "false",
|
|
1493
1500
|
source: "upload",
|
|
1494
1501
|
cover_source: "upload",
|
|
1502
|
+
event2news: params.settingInfo?.baijiahaoEvent2News ? 2 : 0,
|
|
1495
1503
|
activity_list
|
|
1496
1504
|
};
|
|
1505
|
+
params.settingInfo.timer && (publishData['timer_time'] = params.settingInfo.timer);
|
|
1497
1506
|
const isDraft = "draft" === params.saveType;
|
|
1498
1507
|
const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
|
|
1499
1508
|
const res = await http.api({
|
|
@@ -1598,12 +1607,17 @@ const rpaAction = async (task, params)=>{
|
|
|
1598
1607
|
await abstractFormItem.click();
|
|
1599
1608
|
await abstractFormItem.fill(params.settingInfo.baijiahaoAbstract);
|
|
1600
1609
|
const isAi = params.settingInfo.baijiahaoIsAi.includes("isAi");
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1610
|
+
const settingFormItem = page.locator(".bjh-edit-wrap-set .cheetah-form-item").nth(5);
|
|
1611
|
+
if (isAi) await settingFormItem.locator("label.cheetah-checkbox-wrapper").filter({
|
|
1612
|
+
hasText: "AI创作声明"
|
|
1613
|
+
}).click();
|
|
1614
|
+
if (params.settingInfo.baijiahaoPublishConf) for (const item of params.settingInfo.baijiahaoPublishConf){
|
|
1615
|
+
const _settingFormItem = settingFormItem.locator("label.cheetah-checkbox-wrapper").locator(`span.${item.confName}`);
|
|
1616
|
+
if (await _settingFormItem.isChecked() !== item.isChecked) await _settingFormItem.click();
|
|
1617
|
+
await page.waitForTimeout(200);
|
|
1606
1618
|
}
|
|
1619
|
+
const enent2NewsBtn = page.locator("input#event2news");
|
|
1620
|
+
if (await enent2NewsBtn.isVisible() && params.settingInfo.baijiahaoEvent2News) await enent2NewsBtn.click();
|
|
1607
1621
|
if (params.settingInfo.baijiahaoActivity.length > 0 && params.settingInfo.baijiahaoSelectActivityCache.length > 0) {
|
|
1608
1622
|
const activity = params.settingInfo.baijiahaoActivity.filter((it)=>params.settingInfo.baijiahaoSelectActivityCache.includes(it.id));
|
|
1609
1623
|
if (activity.length > 0) {
|
|
@@ -1615,13 +1629,16 @@ const rpaAction = async (task, params)=>{
|
|
|
1615
1629
|
if (await findActivity.count() > 0) findActivity.first().locator("..").click();
|
|
1616
1630
|
}
|
|
1617
1631
|
}
|
|
1618
|
-
const articleId = await new Promise((resolve)=>{
|
|
1632
|
+
const { articleId, message } = await new Promise(async (resolve)=>{
|
|
1619
1633
|
const handleResponse = async (response)=>{
|
|
1620
1634
|
const url = response.url();
|
|
1621
1635
|
if (url.includes("/pcui/article/save") || url.includes("/pcui/article/publish")) {
|
|
1622
1636
|
const jsonResponse = await response.json();
|
|
1623
1637
|
page.off("response", handleResponse);
|
|
1624
|
-
resolve(
|
|
1638
|
+
resolve({
|
|
1639
|
+
articleId: jsonResponse?.ret?.article_id,
|
|
1640
|
+
message: jsonResponse?.errmsg
|
|
1641
|
+
});
|
|
1625
1642
|
}
|
|
1626
1643
|
};
|
|
1627
1644
|
page.on("response", handleResponse);
|
|
@@ -1629,12 +1646,75 @@ const rpaAction = async (task, params)=>{
|
|
|
1629
1646
|
if ("draft" === params.saveType) operatorContainer.locator(".op-btn-outter-content").filter({
|
|
1630
1647
|
hasText: "存草稿"
|
|
1631
1648
|
}).locator("button").click();
|
|
1632
|
-
else
|
|
1633
|
-
|
|
1649
|
+
else if (params.settingInfo.timer) {
|
|
1650
|
+
await operatorContainer.locator(".op-btn-outter-content").filter({
|
|
1651
|
+
hasText: "定时发布"
|
|
1652
|
+
}).locator("button").click();
|
|
1653
|
+
await page.locator(".timepublish-wrap-select .select-wrap", {
|
|
1654
|
+
hasText: "日"
|
|
1655
|
+
}).click();
|
|
1656
|
+
await page.locator('#select-date_list + * .cheetah-select-item-option', {
|
|
1657
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "M月dd日")
|
|
1658
|
+
}).click();
|
|
1659
|
+
await page.waitForTimeout(200);
|
|
1660
|
+
await page.locator(".timepublish-wrap-select .select-wrap", {
|
|
1661
|
+
hasText: "点"
|
|
1662
|
+
}).click();
|
|
1663
|
+
await page.locator('#select-hour_list +div.rc-virtual-list').hover();
|
|
1664
|
+
const scrollHourInfo = await page.evaluate(()=>{
|
|
1665
|
+
const hourInner = document.querySelector('#select-hour_list + * .rc-virtual-list-holder-inner');
|
|
1666
|
+
const hourElementHeight = hourInner?.children[0].clientHeight || 36;
|
|
1667
|
+
const hourMapsElem = Array.from(document.querySelectorAll('#select-hour_list + * .cheetah-select-item-option .cheetah-select-item-option-content'));
|
|
1668
|
+
const hourMap = hourMapsElem.map((item)=>item.textContent?.trim());
|
|
1669
|
+
return {
|
|
1670
|
+
elementHeight: hourElementHeight,
|
|
1671
|
+
elementItem: hourMap
|
|
1672
|
+
};
|
|
1673
|
+
});
|
|
1674
|
+
const fistHourElem = scrollHourInfo.elementItem[0];
|
|
1675
|
+
let fistHourElemH = Number(fistHourElem?.split("点")[0]);
|
|
1676
|
+
const lastHourElem = scrollHourInfo.elementItem[scrollHourInfo.elementItem.length - 1];
|
|
1677
|
+
let lastHourElemH = Number(lastHourElem?.split("点")[0]);
|
|
1678
|
+
let targetTimeH = Number(TimeFormatter.format(params.settingInfo.timer, 'h'));
|
|
1679
|
+
await page.mouse.wheel(0, targetTimeH > lastHourElemH ? (targetTimeH - lastHourElemH) * scrollHourInfo.elementHeight : targetTimeH < fistHourElemH ? -(fistHourElemH - targetTimeH) * scrollHourInfo.elementHeight : 0);
|
|
1680
|
+
await page.locator("#select-hour_list + * .cheetah-select-item-option ", {
|
|
1681
|
+
hasText: targetTimeH + "点"
|
|
1682
|
+
}).click();
|
|
1683
|
+
await page.waitForTimeout(200);
|
|
1684
|
+
await page.locator(".timepublish-wrap-select .select-wrap", {
|
|
1685
|
+
hasText: "分"
|
|
1686
|
+
}).click();
|
|
1687
|
+
await page.locator('#select-minute_list +div.rc-virtual-list').hover();
|
|
1688
|
+
const scrollMinuteInfo = await page.evaluate(()=>{
|
|
1689
|
+
const hourInner = document.querySelector('#select-minute_list + * .rc-virtual-list-holder-inner');
|
|
1690
|
+
const hourElementHeight = hourInner?.children[0].clientHeight || 36;
|
|
1691
|
+
const hourMapsElem = Array.from(document.querySelectorAll('#select-minute_list + * .cheetah-select-item-option .cheetah-select-item-option-content'));
|
|
1692
|
+
const hourMap = hourMapsElem.map((item)=>item.textContent?.trim());
|
|
1693
|
+
return {
|
|
1694
|
+
elementHeight: hourElementHeight,
|
|
1695
|
+
elementItem: hourMap
|
|
1696
|
+
};
|
|
1697
|
+
});
|
|
1698
|
+
const fistMinuteElem = scrollMinuteInfo.elementItem[0];
|
|
1699
|
+
let fistMinuteElemH = Number(fistMinuteElem?.split("分")[0]);
|
|
1700
|
+
const lastMinuteElem = scrollMinuteInfo.elementItem[scrollMinuteInfo.elementItem.length - 1];
|
|
1701
|
+
let lastMinuteElemH = Number(lastMinuteElem?.split("分")[0]);
|
|
1702
|
+
let targetTimeM = Number(TimeFormatter.format(params.settingInfo.timer, 'm'));
|
|
1703
|
+
await page.mouse.wheel(0, targetTimeM > lastMinuteElemH ? (targetTimeM - lastMinuteElemH) * scrollMinuteInfo.elementHeight : targetTimeM < fistMinuteElemH ? -(fistMinuteElemH - targetTimeM) * scrollMinuteInfo.elementHeight : 0);
|
|
1704
|
+
await page.locator("#select-minute_list + * .cheetah-select-item-option ", {
|
|
1705
|
+
hasText: targetTimeM + "分"
|
|
1706
|
+
}).click();
|
|
1707
|
+
await page.waitForTimeout(200);
|
|
1708
|
+
await page.locator(".cheetah-modal-confirm-btns button").filter({
|
|
1709
|
+
hasText: "定时发布"
|
|
1710
|
+
}).click();
|
|
1711
|
+
} else operatorContainer.locator(".op-btn-outter-content").filter({
|
|
1712
|
+
hasText: /^发布/
|
|
1634
1713
|
}).locator("button").click();
|
|
1635
1714
|
});
|
|
1715
|
+
await page.waitForTimeout(200000);
|
|
1636
1716
|
await page.close();
|
|
1637
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(articleId);
|
|
1717
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(articleId, articleId ? "发布成功" : message);
|
|
1638
1718
|
};
|
|
1639
1719
|
const baijiahaoPublish = async (task, params)=>{
|
|
1640
1720
|
if ("rpa" === params.actionType) return rpaAction(task, params);
|
|
@@ -1719,6 +1799,28 @@ const getToutiaoConfig = async (_task, params)=>{
|
|
|
1719
1799
|
userRights
|
|
1720
1800
|
});
|
|
1721
1801
|
};
|
|
1802
|
+
const getBaijiahaoConfig = async (_task, params)=>{
|
|
1803
|
+
const cookies = params.cookies ?? [];
|
|
1804
|
+
const http = new Http({
|
|
1805
|
+
headers: {
|
|
1806
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
1807
|
+
token: params.token
|
|
1808
|
+
}
|
|
1809
|
+
});
|
|
1810
|
+
const res = await http.api({
|
|
1811
|
+
method: "get",
|
|
1812
|
+
url: "https://baijiahao.baidu.com/pcui/article/edit",
|
|
1813
|
+
params: {
|
|
1814
|
+
type: "news"
|
|
1815
|
+
}
|
|
1816
|
+
});
|
|
1817
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(res?.data?.article.activity_list.map((_item)=>({
|
|
1818
|
+
id: _item.id,
|
|
1819
|
+
name: _item.name,
|
|
1820
|
+
detail: _item.detail,
|
|
1821
|
+
is_enable: _item.is_enable
|
|
1822
|
+
})) ?? [], "获取头条发布配置项成功");
|
|
1823
|
+
};
|
|
1722
1824
|
const searchToutiaoTopicList = async (_task, params)=>{
|
|
1723
1825
|
const http = new Http({
|
|
1724
1826
|
headers: {
|
|
@@ -1741,6 +1843,72 @@ const searchToutiaoTopicList = async (_task, params)=>{
|
|
|
1741
1843
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
|
|
1742
1844
|
}
|
|
1743
1845
|
};
|
|
1846
|
+
const searchToutiaoLocation = async (_task, params)=>{
|
|
1847
|
+
const http = new Http({
|
|
1848
|
+
headers: {
|
|
1849
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
1850
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish",
|
|
1851
|
+
biz: 1231
|
|
1852
|
+
}
|
|
1853
|
+
});
|
|
1854
|
+
try {
|
|
1855
|
+
const res = await http.api({
|
|
1856
|
+
method: "post",
|
|
1857
|
+
url: "https://mp.toutiao.com/poi/api/searchplace",
|
|
1858
|
+
data: {
|
|
1859
|
+
appid: 1231,
|
|
1860
|
+
device: 2,
|
|
1861
|
+
keywords: params.placeName,
|
|
1862
|
+
language: "zh-CN",
|
|
1863
|
+
location: "-1,-1",
|
|
1864
|
+
offset: 20,
|
|
1865
|
+
page: 1,
|
|
1866
|
+
region: "CN",
|
|
1867
|
+
scenario: "TIPS",
|
|
1868
|
+
timestamp: Math.floor(Date.now() / 1000)
|
|
1869
|
+
}
|
|
1870
|
+
});
|
|
1871
|
+
if (200 === res.code) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(res.data.poi.map((item)=>({
|
|
1872
|
+
position: item.name,
|
|
1873
|
+
city: item.city,
|
|
1874
|
+
longitude: item.longitude,
|
|
1875
|
+
latitude: item.latitude,
|
|
1876
|
+
type_code: item.type_code,
|
|
1877
|
+
poi_id: item.id
|
|
1878
|
+
})));
|
|
1879
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
|
|
1880
|
+
} catch (error) {
|
|
1881
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
|
|
1882
|
+
}
|
|
1883
|
+
};
|
|
1884
|
+
const searchToutiaoUserInfo = async (_task, params)=>{
|
|
1885
|
+
const http = new Http({
|
|
1886
|
+
headers: {
|
|
1887
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
1888
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1891
|
+
try {
|
|
1892
|
+
const res = await http.api({
|
|
1893
|
+
method: "get",
|
|
1894
|
+
url: "https://mp.toutiao.com/ugc/publish/post/v1/suggest/",
|
|
1895
|
+
params: {
|
|
1896
|
+
words: params.UserName,
|
|
1897
|
+
language: "zh",
|
|
1898
|
+
app_name: "toutiao_mp"
|
|
1899
|
+
}
|
|
1900
|
+
});
|
|
1901
|
+
if (0 === res.err_no) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(res.data.suggest.map((item)=>({
|
|
1902
|
+
user_id: item.user.info.user_id,
|
|
1903
|
+
name: item.user.info.name,
|
|
1904
|
+
avatar_url: item.user.info.avatar_url,
|
|
1905
|
+
followers_count: item.user.relation_count.followers_count
|
|
1906
|
+
})), '搜索成功');
|
|
1907
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
|
|
1908
|
+
} catch (error) {
|
|
1909
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
|
|
1910
|
+
}
|
|
1911
|
+
};
|
|
1744
1912
|
const searchXiaohongshuLocation = async (_task, params)=>{
|
|
1745
1913
|
const http = new Http({
|
|
1746
1914
|
headers: {
|
|
@@ -1815,7 +1983,7 @@ const mock_errnoMap = {
|
|
|
1815
1983
|
2005: "账号无【申明原创】权限,请关闭申明后重试。",
|
|
1816
1984
|
100004: "用户未登录或登陆已过期,请重新登陆后重试。"
|
|
1817
1985
|
};
|
|
1818
|
-
const
|
|
1986
|
+
const mock_generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
|
|
1819
1987
|
const encodedKey = encodeURIComponent(key);
|
|
1820
1988
|
const encodedValue = encodeURIComponent(String(value));
|
|
1821
1989
|
return `${encodedKey}=${encodedValue}`;
|
|
@@ -1828,7 +1996,7 @@ const get3101DetailError = (errorList, message, saveType)=>{
|
|
|
1828
1996
|
return error || ("draft" === saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。");
|
|
1829
1997
|
};
|
|
1830
1998
|
const mock_mockAction = async (task, params)=>{
|
|
1831
|
-
const { toutiaoSingleCover, toutiaoMultCover, toutiaoCoverType, toutiaoOriginal } = params.settingInfo;
|
|
1999
|
+
const { toutiaoSingleCover, toutiaoMultCover, toutiaoCoverType, toutiaoOriginal, toutiaoExclusive, toutiaoClaim } = params.settingInfo;
|
|
1832
2000
|
const tmpCachePath = task.getTmpPath();
|
|
1833
2001
|
const http = new Http({
|
|
1834
2002
|
headers: {
|
|
@@ -1884,23 +2052,27 @@ const mock_mockAction = async (task, params)=>{
|
|
|
1884
2052
|
toutiaoSingleCover
|
|
1885
2053
|
] : "multiple" === toutiaoCoverType ? toutiaoMultCover : [];
|
|
1886
2054
|
const coverRes = await uploadImages(coverUrl);
|
|
1887
|
-
const isSingleTitle = "single" === params.settingInfo.toutiaoTitleType;
|
|
1888
2055
|
const location = params.settingInfo.toutiaoLocation;
|
|
1889
2056
|
const topics = params.settingInfo.toutiaoTopic || [];
|
|
1890
|
-
const multiTitleData = params.settingInfo.subTitles.map((title)=>({
|
|
1891
|
-
id: "0",
|
|
1892
|
-
visibility_level: 0,
|
|
1893
|
-
source: "author",
|
|
1894
|
-
old_source: "author",
|
|
1895
|
-
text: title,
|
|
1896
|
-
version: "author",
|
|
1897
|
-
ai_title: ""
|
|
1898
|
-
}));
|
|
1899
2057
|
const topicContent = topics.map((topic)=>`<p><a class="tteditor-forum" data-name="${topic.word}" data-id="${topic.id}" data-concern-id="${topic.id}">#${topic.word}#</a ></p >`).join("");
|
|
2058
|
+
let sourceData = {
|
|
2059
|
+
source_type: toutiaoClaim ? toutiaoClaim.type : 5
|
|
2060
|
+
};
|
|
2061
|
+
if (toutiaoClaim && 1 === toutiaoClaim.type) {
|
|
2062
|
+
if (!toutiaoClaim?.source_author_uid) return {
|
|
2063
|
+
code: 500,
|
|
2064
|
+
message: "请填写作者ID",
|
|
2065
|
+
data: ""
|
|
2066
|
+
};
|
|
2067
|
+
sourceData = {
|
|
2068
|
+
...sourceData,
|
|
2069
|
+
source_author_uid: toutiaoClaim.source_author_uid,
|
|
2070
|
+
time_format: toutiaoClaim.time_format,
|
|
2071
|
+
position: toutiaoClaim.position
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
1900
2074
|
const extraData = {
|
|
1901
2075
|
content_word_cnt: params.settingInfo.cntWord,
|
|
1902
|
-
is_multi_title: isSingleTitle ? 0 : 1,
|
|
1903
|
-
sub_titles: isSingleTitle ? [] : multiTitleData,
|
|
1904
2076
|
gd_ext: {
|
|
1905
2077
|
entrance: "",
|
|
1906
2078
|
from_page: "publisher_mp",
|
|
@@ -1909,12 +2081,7 @@ const mock_mockAction = async (task, params)=>{
|
|
|
1909
2081
|
is_message: 0
|
|
1910
2082
|
},
|
|
1911
2083
|
tuwen_wtt_trans_flag: "0",
|
|
1912
|
-
info_source:
|
|
1913
|
-
source_type: 5,
|
|
1914
|
-
source_link: "",
|
|
1915
|
-
time_format: "",
|
|
1916
|
-
position: {}
|
|
1917
|
-
},
|
|
2084
|
+
info_source: sourceData,
|
|
1918
2085
|
...location ? {
|
|
1919
2086
|
city: location.label,
|
|
1920
2087
|
city_code: location.value
|
|
@@ -1961,20 +2128,19 @@ const mock_mockAction = async (task, params)=>{
|
|
|
1961
2128
|
}
|
|
1962
2129
|
}))),
|
|
1963
2130
|
article_ad_type: getAddTypeValue(params.settingInfo.toutiaoAd),
|
|
1964
|
-
|
|
1965
|
-
claim_exclusive: toutiaoOriginal.includes("exclusive") ? 1 : 0
|
|
2131
|
+
claim_exclusive: toutiaoExclusive ? toutiaoExclusive : toutiaoOriginal.includes("exclusive") ? 1 : 0
|
|
1966
2132
|
};
|
|
1967
2133
|
const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
1968
2134
|
let publishOption = {};
|
|
1969
2135
|
if (msToken) {
|
|
1970
|
-
const postHeaders =
|
|
2136
|
+
const postHeaders = mock_generatorFormData({
|
|
1971
2137
|
source: "mp",
|
|
1972
2138
|
type: "article",
|
|
1973
2139
|
aid: 1231,
|
|
1974
2140
|
mp_publish_ab_val: 0,
|
|
1975
2141
|
msToken: msToken
|
|
1976
2142
|
});
|
|
1977
|
-
const postData =
|
|
2143
|
+
const postData = mock_generatorFormData(publishData);
|
|
1978
2144
|
let a_bogus = GenAB(postHeaders, postData);
|
|
1979
2145
|
publishOption = {
|
|
1980
2146
|
method: "post",
|
|
@@ -1998,6 +2164,7 @@ const mock_mockAction = async (task, params)=>{
|
|
|
1998
2164
|
const publishResult = await http.api(publishOption);
|
|
1999
2165
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data.pgc_id);
|
|
2000
2166
|
};
|
|
2167
|
+
const rpa_GenAB = __webpack_require__("./src/utils/ttABEncrypt.js");
|
|
2001
2168
|
const rpa_rpaAction = async (task, params)=>{
|
|
2002
2169
|
const tmpCachePath = task.getTmpPath();
|
|
2003
2170
|
const commonCookies = {
|
|
@@ -2032,9 +2199,30 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
2032
2199
|
await page.route('**', async (route, request)=>{
|
|
2033
2200
|
const url = new URL(request.url());
|
|
2034
2201
|
if (interceptUrls.some((pattern)=>url.pathname.includes(pattern))) {
|
|
2035
|
-
|
|
2202
|
+
const headers = {
|
|
2203
|
+
...request.headers(),
|
|
2204
|
+
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
|
|
2205
|
+
};
|
|
2206
|
+
const generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
|
|
2207
|
+
const encodedKey = encodeURIComponent(key);
|
|
2208
|
+
const encodedValue = encodeURIComponent(String(value));
|
|
2209
|
+
return `${encodedKey}=${encodedValue}`;
|
|
2210
|
+
}).join('&');
|
|
2211
|
+
const postHeaders = generatorFormData({
|
|
2212
|
+
source: "mp",
|
|
2213
|
+
type: "article",
|
|
2214
|
+
aid: 1231,
|
|
2215
|
+
mp_publish_ab_val: 0,
|
|
2216
|
+
msToken: url.searchParams.get('msToken')
|
|
2217
|
+
});
|
|
2218
|
+
const postData = request.postData() || "";
|
|
2219
|
+
let a_bogus = rpa_GenAB(postHeaders, postData);
|
|
2220
|
+
url.searchParams.set('aid', "1231");
|
|
2221
|
+
url.searchParams.set('mp_publish_ab_val', "0");
|
|
2222
|
+
url.searchParams.set('a_bogus', a_bogus);
|
|
2036
2223
|
await route.continue({
|
|
2037
|
-
url: url.toString()
|
|
2224
|
+
url: url.toString(),
|
|
2225
|
+
headers: headers
|
|
2038
2226
|
});
|
|
2039
2227
|
} else await route.continue();
|
|
2040
2228
|
});
|
|
@@ -2109,13 +2297,40 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
2109
2297
|
}).locator("xpath=..");
|
|
2110
2298
|
const isAdOptionVisible = await adContainer.isVisible();
|
|
2111
2299
|
if (isAdOptionVisible) await adContainer.locator(`label.byte-radio:has(input[value="${getAddTypeValue(params.settingInfo.toutiaoAd)}"])`).click();
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2300
|
+
const exclusiveContainer = page.locator(".form-container .edit-cell .edit-label").filter({
|
|
2301
|
+
hasText: "声明首发"
|
|
2302
|
+
}).locator("xpath=..");
|
|
2303
|
+
if (params.settingInfo.toutiaoOriginal.includes("exclusive") || params.settingInfo.toutiaoExclusive) exclusiveContainer.locator(".exclusive .exclusive-checkbox-wraper .byte-checkbox").check();
|
|
2304
|
+
else exclusiveContainer.locator(".exclusive .exclusive-checkbox-wraper .byte-checkbox").uncheck();
|
|
2305
|
+
let claim = params.settingInfo.toutiaoClaim ? params.settingInfo.toutiaoClaim.type : 5;
|
|
2306
|
+
switch(claim){
|
|
2307
|
+
case 3:
|
|
2308
|
+
await page.locator(".source-wrap .byte-checkbox", {
|
|
2309
|
+
hasText: "引用AI"
|
|
2310
|
+
}).locator(".byte-checkbox-mask").check();
|
|
2311
|
+
break;
|
|
2312
|
+
case 4:
|
|
2313
|
+
await page.locator(".source-wrap .byte-checkbox", {
|
|
2314
|
+
hasText: "取材网络"
|
|
2315
|
+
}).locator(".byte-checkbox-mask").check();
|
|
2316
|
+
break;
|
|
2317
|
+
case 5:
|
|
2318
|
+
await page.locator(".source-wrap .byte-checkbox", {
|
|
2319
|
+
hasText: "个人观点,仅供参考"
|
|
2320
|
+
}).locator(".byte-checkbox-mask").check();
|
|
2321
|
+
break;
|
|
2322
|
+
case 6:
|
|
2323
|
+
await page.locator(".source-wrap .byte-checkbox", {
|
|
2324
|
+
hasText: "虚构演绎,故事经历"
|
|
2325
|
+
}).locator(".byte-checkbox-mask").check();
|
|
2326
|
+
break;
|
|
2327
|
+
default:
|
|
2328
|
+
await page.locator(".source-wrap .byte-checkbox", {
|
|
2329
|
+
hasText: "个人观点,仅供参考"
|
|
2330
|
+
}).locator(".byte-checkbox-mask").check();
|
|
2331
|
+
break;
|
|
2117
2332
|
}
|
|
2118
|
-
const articleId = await new Promise((resolve)=>{
|
|
2333
|
+
const articleId = await new Promise(async (resolve)=>{
|
|
2119
2334
|
const handleResponse = async (response)=>{
|
|
2120
2335
|
const url = response.url();
|
|
2121
2336
|
if (url.includes("/mp/agw/article/publish")) {
|
|
@@ -2125,7 +2340,32 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
2125
2340
|
}
|
|
2126
2341
|
};
|
|
2127
2342
|
page.on("response", handleResponse);
|
|
2128
|
-
|
|
2343
|
+
if (params.settingInfo.timer && "publish" == params.saveType) {
|
|
2344
|
+
await page.locator(".publish-footer button").filter({
|
|
2345
|
+
hasText: "定时发布"
|
|
2346
|
+
}).click();
|
|
2347
|
+
await page.waitForSelector('button.publish-btn:not(.byte-btn-loading) >> nth=1', {
|
|
2348
|
+
state: 'attached'
|
|
2349
|
+
});
|
|
2350
|
+
await page.locator(".byte-modal-content .day-select .byte-select-view-value").click();
|
|
2351
|
+
await page.locator('li.byte-select-option', {
|
|
2352
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "MM月dd日")
|
|
2353
|
+
}).click();
|
|
2354
|
+
await page.waitForTimeout(200);
|
|
2355
|
+
await page.locator(".byte-modal-content .hour-select .byte-select-view-value").click();
|
|
2356
|
+
await page.locator('li.byte-select-option', {
|
|
2357
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "h")
|
|
2358
|
+
}).click();
|
|
2359
|
+
await page.waitForTimeout(200);
|
|
2360
|
+
await page.locator(".byte-modal-content .minute-select .byte-select-view-value").click();
|
|
2361
|
+
await page.locator('li.byte-select-option', {
|
|
2362
|
+
hasText: TimeFormatter.format(params.settingInfo.timer, "m")
|
|
2363
|
+
}).click();
|
|
2364
|
+
await page.waitForTimeout(200);
|
|
2365
|
+
await page.locator(".byte-modal-footer button").filter({
|
|
2366
|
+
hasText: "预览并定时发布"
|
|
2367
|
+
}).click();
|
|
2368
|
+
} else await page.locator(".publish-footer button").filter({
|
|
2129
2369
|
hasText: "预览并发布"
|
|
2130
2370
|
}).click();
|
|
2131
2371
|
});
|
|
@@ -2136,17 +2376,17 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
2136
2376
|
}
|
|
2137
2377
|
if ("publish" === params.saveType) {
|
|
2138
2378
|
await page.locator(".publish-footer button").filter({
|
|
2139
|
-
hasText: "确认发布"
|
|
2379
|
+
hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
|
|
2140
2380
|
}).waitFor({
|
|
2141
2381
|
state: "visible"
|
|
2142
2382
|
});
|
|
2143
2383
|
await page.waitForTimeout(200);
|
|
2144
2384
|
await page.locator(".publish-footer button").filter({
|
|
2145
|
-
hasText: "确认发布"
|
|
2385
|
+
hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
|
|
2146
2386
|
}).click();
|
|
2147
2387
|
}
|
|
2148
2388
|
await page.close();
|
|
2149
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(articleId);
|
|
2389
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(articleId, "publish" === params.saveType ? "发布成功" : "保存草稿成功");
|
|
2150
2390
|
};
|
|
2151
2391
|
const COVER_TYPE = {
|
|
2152
2392
|
no: 1,
|
|
@@ -2417,7 +2657,8 @@ const weixinPublish_mock_errnoMap = {
|
|
|
2417
2657
|
"-4": "不支持发布审核中或转码中的视频",
|
|
2418
2658
|
"-2": "不支持发布审核中或转码中的视频",
|
|
2419
2659
|
770001: "不支持发布审核中或转码中的视频",
|
|
2420
|
-
200074: "系统繁忙,请稍后重试!"
|
|
2660
|
+
200074: "系统繁忙,请稍后重试!",
|
|
2661
|
+
64702: "标题超出64字长度限制,请修改标题后重试。"
|
|
2421
2662
|
};
|
|
2422
2663
|
const ignoreErrno = [
|
|
2423
2664
|
154019
|
|
@@ -2427,7 +2668,7 @@ const userTypeMap = {
|
|
|
2427
2668
|
已关注的用户: 2,
|
|
2428
2669
|
已关注7天及以上的用户: 3
|
|
2429
2670
|
};
|
|
2430
|
-
const
|
|
2671
|
+
const weixinPublish_mock_generatorFormData = (data)=>{
|
|
2431
2672
|
const formData = new URLSearchParams();
|
|
2432
2673
|
for (const [key, value] of Object.entries(data))formData.append(key, String(value));
|
|
2433
2674
|
return formData.toString();
|
|
@@ -2443,7 +2684,7 @@ const checkCopyrightStat = async (http, params, data)=>{
|
|
|
2443
2684
|
token: params.token,
|
|
2444
2685
|
lang: "zh_CN"
|
|
2445
2686
|
},
|
|
2446
|
-
data:
|
|
2687
|
+
data: weixinPublish_mock_generatorFormData(data)
|
|
2447
2688
|
});
|
|
2448
2689
|
} catch (error) {
|
|
2449
2690
|
resData = error?.data;
|
|
@@ -2557,7 +2798,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2557
2798
|
params: {
|
|
2558
2799
|
action: "searchacct"
|
|
2559
2800
|
},
|
|
2560
|
-
data:
|
|
2801
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2561
2802
|
lang: "zh_CN",
|
|
2562
2803
|
f: "json",
|
|
2563
2804
|
ajax: 1,
|
|
@@ -2686,7 +2927,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2686
2927
|
params: {
|
|
2687
2928
|
action: 'addautoreply'
|
|
2688
2929
|
},
|
|
2689
|
-
data:
|
|
2930
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2690
2931
|
type: 1,
|
|
2691
2932
|
fingerprint,
|
|
2692
2933
|
token: params.token,
|
|
@@ -2808,7 +3049,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2808
3049
|
type: 77,
|
|
2809
3050
|
lang: "zh_CN"
|
|
2810
3051
|
},
|
|
2811
|
-
data:
|
|
3052
|
+
data: weixinPublish_mock_generatorFormData(draftData),
|
|
2812
3053
|
defaultErrorMsg: "创建草稿失败,请稍后重试发布。"
|
|
2813
3054
|
});
|
|
2814
3055
|
if ("draft" === params.saveType) return {
|
|
@@ -2841,7 +3082,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2841
3082
|
lang: "zh_CN",
|
|
2842
3083
|
token: params.token
|
|
2843
3084
|
},
|
|
2844
|
-
data:
|
|
3085
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2845
3086
|
token: params.token,
|
|
2846
3087
|
lang: "zh_CN",
|
|
2847
3088
|
f: "json",
|
|
@@ -2872,7 +3113,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2872
3113
|
token: params.token,
|
|
2873
3114
|
lang: "zh_CN"
|
|
2874
3115
|
},
|
|
2875
|
-
data:
|
|
3116
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2876
3117
|
appmsgid: appMsgId,
|
|
2877
3118
|
fingerprint,
|
|
2878
3119
|
token: params.token,
|
|
@@ -2884,7 +3125,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2884
3125
|
await http.api({
|
|
2885
3126
|
method: "post",
|
|
2886
3127
|
url: "https://mp.weixin.qq.com/cgi-bin/masssend?action=check_same_material",
|
|
2887
|
-
data:
|
|
3128
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2888
3129
|
msgid: appMsgId,
|
|
2889
3130
|
fingerprint,
|
|
2890
3131
|
token: params.token,
|
|
@@ -2923,7 +3164,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2923
3164
|
token: params.token,
|
|
2924
3165
|
lang: "zh_CN"
|
|
2925
3166
|
},
|
|
2926
|
-
data:
|
|
3167
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2927
3168
|
appmsg_id: appMsgId,
|
|
2928
3169
|
fingerprint,
|
|
2929
3170
|
token: params.token,
|
|
@@ -2931,7 +3172,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2931
3172
|
f: "json",
|
|
2932
3173
|
ajax: 1,
|
|
2933
3174
|
is_release_publish_page: params.masssend ? 0 : 1,
|
|
2934
|
-
send_time: 0,
|
|
3175
|
+
send_time: params.settingInfo.timer ? params.settingInfo.timer : 0,
|
|
2935
3176
|
random: Math.random().toString()
|
|
2936
3177
|
})
|
|
2937
3178
|
});
|
|
@@ -2942,7 +3183,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2942
3183
|
params: {
|
|
2943
3184
|
action: "check_music"
|
|
2944
3185
|
},
|
|
2945
|
-
data:
|
|
3186
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2946
3187
|
appmsgid: appMsgId,
|
|
2947
3188
|
masssend_check: 1,
|
|
2948
3189
|
fingerprint,
|
|
@@ -2962,7 +3203,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2962
3203
|
lang: "zh_CN",
|
|
2963
3204
|
1: 1
|
|
2964
3205
|
},
|
|
2965
|
-
data:
|
|
3206
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2966
3207
|
token: params.token,
|
|
2967
3208
|
lang: "zh_CN",
|
|
2968
3209
|
f: "json",
|
|
@@ -2982,7 +3223,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
2982
3223
|
lang: "zh_CN",
|
|
2983
3224
|
1: 1
|
|
2984
3225
|
},
|
|
2985
|
-
data:
|
|
3226
|
+
data: weixinPublish_mock_generatorFormData({
|
|
2986
3227
|
token: params.token,
|
|
2987
3228
|
lang: "zh_CN",
|
|
2988
3229
|
f: "json",
|
|
@@ -3014,6 +3255,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
3014
3255
|
ticket: getTicketResult.ticket,
|
|
3015
3256
|
uuid,
|
|
3016
3257
|
msgid: operation_seq,
|
|
3258
|
+
open_email: !!params.settingInfo.timer,
|
|
3017
3259
|
...params.masssend ? {} : {
|
|
3018
3260
|
publish_type: 1
|
|
3019
3261
|
}
|
|
@@ -3036,7 +3278,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
3036
3278
|
lang: "zh_CN",
|
|
3037
3279
|
timespam: Date.now()
|
|
3038
3280
|
},
|
|
3039
|
-
data:
|
|
3281
|
+
data: weixinPublish_mock_generatorFormData({
|
|
3040
3282
|
token: params.token,
|
|
3041
3283
|
lang: "zh_CN",
|
|
3042
3284
|
f: "json",
|
|
@@ -3066,7 +3308,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
3066
3308
|
lang: "zh_CN",
|
|
3067
3309
|
1: 1
|
|
3068
3310
|
},
|
|
3069
|
-
data:
|
|
3311
|
+
data: weixinPublish_mock_generatorFormData({
|
|
3070
3312
|
token: params.token,
|
|
3071
3313
|
lang: "zh_CN",
|
|
3072
3314
|
f: "json",
|
|
@@ -3084,11 +3326,14 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
3084
3326
|
t: "ajax-response",
|
|
3085
3327
|
token: params.token,
|
|
3086
3328
|
lang: "zh_CN",
|
|
3329
|
+
...params.settingInfo.timer ? {
|
|
3330
|
+
action: "time_send"
|
|
3331
|
+
} : {},
|
|
3087
3332
|
...params.masssend ? {} : {
|
|
3088
3333
|
is_release_publish_page: 1
|
|
3089
3334
|
}
|
|
3090
3335
|
},
|
|
3091
|
-
data:
|
|
3336
|
+
data: weixinPublish_mock_generatorFormData({
|
|
3092
3337
|
token: params.token,
|
|
3093
3338
|
lang: "zh_CN",
|
|
3094
3339
|
f: "json",
|
|
@@ -3105,7 +3350,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
3105
3350
|
country: "",
|
|
3106
3351
|
province: "",
|
|
3107
3352
|
city: "",
|
|
3108
|
-
send_time: "0",
|
|
3353
|
+
send_time: params.settingInfo.timer ? params.settingInfo.timer : "0",
|
|
3109
3354
|
type: "10",
|
|
3110
3355
|
share_page: "1",
|
|
3111
3356
|
synctxweibo: "0",
|
|
@@ -3122,7 +3367,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
3122
3367
|
}),
|
|
3123
3368
|
defaultErrorMsg: params.masssend ? "文章群发异常,请尝试关闭群发或稍后重试。" : "文章发布异常,请稍后重试。"
|
|
3124
3369
|
});
|
|
3125
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId, "微信公众号发布完成。");
|
|
3370
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId, params.settingInfo.timer ? "微信公众号文章定时发布成功。" : "微信公众号发布完成。");
|
|
3126
3371
|
};
|
|
3127
3372
|
const waitQrcodeResultMaxTime = 2000 * scanRetryMaxCount;
|
|
3128
3373
|
const weixinPublish_rpa_rpaAction = async (task, params)=>{
|
|
@@ -3243,6 +3488,10 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
3243
3488
|
checkInterval: 1000,
|
|
3244
3489
|
stopAfterClick: false
|
|
3245
3490
|
});
|
|
3491
|
+
PopupListener(page, '[extclass="weui-desktop-dialog_simple"] .weui-desktop-dialog', "小店", '[extclass="weui-desktop-dialog_simple"] .weui-desktop-icon-btn.weui-desktop-dialog__close-btn', {
|
|
3492
|
+
checkInterval: 1000,
|
|
3493
|
+
stopAfterClick: true
|
|
3494
|
+
});
|
|
3246
3495
|
const titleInstance = page.locator("#js_title_main textarea#title");
|
|
3247
3496
|
await titleInstance.click();
|
|
3248
3497
|
await titleInstance.fill(params.title);
|
|
@@ -3399,8 +3648,8 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
3399
3648
|
const wxInteraction_bd = wxInteraction_setting.locator('.weui-desktop-dialog__bd');
|
|
3400
3649
|
const wxInteraction_ft = wxInteraction_setting.locator('.weui-desktop-dialog__ft');
|
|
3401
3650
|
if ("public" == params.settingInfo.wxInteraction.Type) {
|
|
3402
|
-
await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
|
|
3403
|
-
hasText:
|
|
3651
|
+
await wxInteraction_bd.locator('.weui-desktop-form__check-label span', {
|
|
3652
|
+
hasText: /^(开启|留言)$/
|
|
3404
3653
|
}).click();
|
|
3405
3654
|
const comment_area = wxInteraction_bd.locator('.comment-options-block.pt0');
|
|
3406
3655
|
const reply_area = wxInteraction_bd.locator('.comment-options-block.bb0.pb0');
|
|
@@ -3418,8 +3667,8 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
3418
3667
|
}).click();
|
|
3419
3668
|
if (params.settingInfo.wxInteraction.Option?.elect_reply) await reply_area.locator('.weui-desktop-switch__box').check();
|
|
3420
3669
|
else await reply_area.locator('.weui-desktop-switch__input').isChecked() && reply_area.locator('.weui-desktop-switch__box').uncheck();
|
|
3421
|
-
} else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
|
|
3422
|
-
hasText:
|
|
3670
|
+
} else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label span', {
|
|
3671
|
+
hasText: /^(快捷私信|不开启)$/
|
|
3423
3672
|
}).click();
|
|
3424
3673
|
await wxInteraction_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
|
|
3425
3674
|
}
|
|
@@ -3445,7 +3694,7 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
3445
3694
|
await poperInstance.locator('.frm_radio_item label[for="not_recomment_0"]').click();
|
|
3446
3695
|
}
|
|
3447
3696
|
await page.waitForTimeout(1000);
|
|
3448
|
-
const articleId = await new Promise((resolve)=>{
|
|
3697
|
+
const articleId = await new Promise(async (resolve)=>{
|
|
3449
3698
|
const handleResponse = async (response)=>{
|
|
3450
3699
|
const url = response.url();
|
|
3451
3700
|
const query = parseUrlQueryString(url);
|
|
@@ -3457,7 +3706,34 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
3457
3706
|
};
|
|
3458
3707
|
page.on("response", handleResponse);
|
|
3459
3708
|
page.locator("#editor_pannel #bottom_main #js_button_area #js_send button").click();
|
|
3709
|
+
await page.waitForTimeout(200);
|
|
3710
|
+
if (params.settingInfo.timer) {
|
|
3711
|
+
await page.locator(".mass-send .mass-send__td-setting", {
|
|
3712
|
+
hasText: "定时发表"
|
|
3713
|
+
}).locator(".weui-desktop-switch__box").check();
|
|
3714
|
+
let dateD = Number(TimeFormatter.format(params.settingInfo.timer, "d"));
|
|
3715
|
+
let nowD = Number(TimeFormatter.format(Date.now(), "d"));
|
|
3716
|
+
await page.locator(".mass-send__timer .weui-desktop-form__dropdown__dt").click();
|
|
3717
|
+
const dropMenu = page.locator(".mass-send__timer .weui-desktop-dropdown-menu").locator(".weui-desktop-dropdown__list-ele");
|
|
3718
|
+
await dropMenu.filter({
|
|
3719
|
+
hasText: dateD == nowD ? "今天" : dateD == nowD + 1 ? "明天" : TimeFormatter.format(params.settingInfo.timer, "M月d日")
|
|
3720
|
+
}).click();
|
|
3721
|
+
const timeDropMenu = page.locator(".mass-send__timer .weui-desktop-picker__time:visible");
|
|
3722
|
+
await timeDropMenu.locator(".weui-desktop-form__input").fill(TimeFormatter.format(params.settingInfo.timer, "hh:mm"));
|
|
3723
|
+
await timeDropMenu.locator("i.weui-desktop-icon__time").click();
|
|
3724
|
+
}
|
|
3460
3725
|
});
|
|
3726
|
+
await page.waitForTimeout(200);
|
|
3727
|
+
if (params.masssend) {
|
|
3728
|
+
const times = Number(await page.locator(".mass-send .multi-sent__notice_time").locator('div[style="display: none;"] div:not([style*="display: none"]) span').textContent());
|
|
3729
|
+
if (0 == times) return {
|
|
3730
|
+
code: 200,
|
|
3731
|
+
message: "今日群发次数用尽,请明天再试。",
|
|
3732
|
+
data: ""
|
|
3733
|
+
};
|
|
3734
|
+
await page.locator(".mass-send .mass_send__notify").locator(".weui-desktop-switch__box").check();
|
|
3735
|
+
} else await page.locator(".mass-send .mass_send__notify").locator(".weui-desktop-switch__box").uncheck();
|
|
3736
|
+
await page.waitForTimeout(200);
|
|
3461
3737
|
await page.waitForSelector('.new_mass_send_dialog .weui-desktop-dialog__wrp:not([style*="display: none"])', {
|
|
3462
3738
|
state: "visible"
|
|
3463
3739
|
});
|
|
@@ -3466,6 +3742,19 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
3466
3742
|
state: "visible"
|
|
3467
3743
|
});
|
|
3468
3744
|
await page.locator(".double_check_dialog .weui-desktop-dialog .weui-desktop-dialog__ft button.weui-desktop-btn_primary").click();
|
|
3745
|
+
await page.waitForTimeout(2000);
|
|
3746
|
+
const originalCheckDialog = page.locator('div[data-transfer="true"][width\\.number="800"][height\\.number="800"] .weui-desktop-dialog__title');
|
|
3747
|
+
if (await originalCheckDialog.count() > 0) {
|
|
3748
|
+
if (await originalCheckDialog.textContent() === "原创校验") {
|
|
3749
|
+
const popMassend = page.locator('div[data-transfer="true"][width\\.number="800"][height\\.number="800"]');
|
|
3750
|
+
await popMassend.locator(".weui-desktop-btn_primary", {
|
|
3751
|
+
hasText: "下一步"
|
|
3752
|
+
}).click();
|
|
3753
|
+
await popMassend.locator(".weui-desktop-btn_primary", {
|
|
3754
|
+
hasText: "继续"
|
|
3755
|
+
}).click();
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3469
3758
|
try {
|
|
3470
3759
|
const startTime = Date.now();
|
|
3471
3760
|
await new Promise(async (resolve, reject)=>{
|
|
@@ -4189,7 +4478,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
4189
4478
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
4190
4479
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
4191
4480
|
};
|
|
4192
|
-
var package_namespaceObject = JSON.parse('{"i8":"1.2.11-beta.
|
|
4481
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.11-beta.2"}');
|
|
4193
4482
|
class Action {
|
|
4194
4483
|
constructor(task){
|
|
4195
4484
|
this.task = task;
|
|
@@ -4225,9 +4514,18 @@ class Action {
|
|
|
4225
4514
|
BjhFansExport(params) {
|
|
4226
4515
|
return this.bindTask(BjhFansExport, params);
|
|
4227
4516
|
}
|
|
4517
|
+
searchToutiaoUserID(params) {
|
|
4518
|
+
return this.bindTask(searchToutiaoUserInfo, params);
|
|
4519
|
+
}
|
|
4520
|
+
searchToutiaoLocation(params) {
|
|
4521
|
+
return this.bindTask(searchToutiaoLocation, params);
|
|
4522
|
+
}
|
|
4228
4523
|
getToutiaoConfig(params) {
|
|
4229
4524
|
return this.bindTask(getToutiaoConfig, params);
|
|
4230
4525
|
}
|
|
4526
|
+
getBaijiahaoConfig(params) {
|
|
4527
|
+
return this.bindTask(getBaijiahaoConfig, params);
|
|
4528
|
+
}
|
|
4231
4529
|
baijiahaoPublish(params) {
|
|
4232
4530
|
return this.bindTask(baijiahaoPublish, params);
|
|
4233
4531
|
}
|