@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/index.mjs CHANGED
@@ -1213,6 +1213,27 @@ const extractImgTag = (html)=>{
1213
1213
  parser.end();
1214
1214
  return srcList;
1215
1215
  };
1216
+ class TimeFormatter {
1217
+ static format(timestamp, formatStr = 'yyyy-MM-dd hh:mm') {
1218
+ if ('number' == typeof timestamp && 10 === timestamp.toString().length) timestamp *= 1000;
1219
+ const date = new Date(timestamp);
1220
+ const map = {
1221
+ yyyy: String(date.getFullYear()),
1222
+ yy: String(date.getFullYear()).slice(-2),
1223
+ MM: String(date.getMonth() + 1).padStart(2, '0'),
1224
+ dd: String(date.getDate()).padStart(2, '0'),
1225
+ hh: String(date.getHours()).padStart(2, '0'),
1226
+ mm: String(date.getMinutes()).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())
1233
+ };
1234
+ return formatStr.replace(/yyyy|yy|MM|dd|hh|mm|ss|M|d|h|m|s/g, (key)=>map[key]);
1235
+ }
1236
+ }
1216
1237
  const replaceImgSrc = (html, callback)=>{
1217
1238
  let lastedHtml = html;
1218
1239
  const isImageTag = (node)=>"tag" === node.type && "img" === node.name;
@@ -1478,6 +1499,7 @@ const mockAction = async (task, params)=>{
1478
1499
  cover_source: "upload",
1479
1500
  activity_list
1480
1501
  };
1502
+ params.settingInfo.timer && (publishData['timer_time'] = params.settingInfo.timer);
1481
1503
  const isDraft = "draft" === params.saveType;
1482
1504
  const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
1483
1505
  const res = await http.api({
@@ -1599,13 +1621,16 @@ const rpaAction = async (task, params)=>{
1599
1621
  if (await findActivity.count() > 0) findActivity.first().locator("..").click();
1600
1622
  }
1601
1623
  }
1602
- const articleId = await new Promise((resolve)=>{
1624
+ const { articleId, message } = await new Promise(async (resolve)=>{
1603
1625
  const handleResponse = async (response)=>{
1604
1626
  const url = response.url();
1605
1627
  if (url.includes("/pcui/article/save") || url.includes("/pcui/article/publish")) {
1606
1628
  const jsonResponse = await response.json();
1607
1629
  page.off("response", handleResponse);
1608
- resolve(jsonResponse?.ret?.article_id);
1630
+ resolve({
1631
+ articleId: jsonResponse?.ret?.article_id,
1632
+ message: jsonResponse?.errmsg
1633
+ });
1609
1634
  }
1610
1635
  };
1611
1636
  page.on("response", handleResponse);
@@ -1613,12 +1638,74 @@ const rpaAction = async (task, params)=>{
1613
1638
  if ("draft" === params.saveType) operatorContainer.locator(".op-btn-outter-content").filter({
1614
1639
  hasText: "存草稿"
1615
1640
  }).locator("button").click();
1616
- else operatorContainer.locator(".op-btn-outter-content").filter({
1617
- hasText: "发布"
1641
+ else if (params.settingInfo.timer) {
1642
+ await operatorContainer.locator(".op-btn-outter-content").filter({
1643
+ hasText: "定时发布"
1644
+ }).locator("button").click();
1645
+ await page.locator(".timepublish-wrap-select .select-wrap", {
1646
+ hasText: "日"
1647
+ }).click();
1648
+ await page.locator('#select-date_list + * .cheetah-select-item-option', {
1649
+ hasText: TimeFormatter.format(params.settingInfo.timer, "M月dd日")
1650
+ }).click();
1651
+ await page.waitForTimeout(200);
1652
+ await page.locator(".timepublish-wrap-select .select-wrap", {
1653
+ hasText: "点"
1654
+ }).click();
1655
+ await page.locator('#select-hour_list +div.rc-virtual-list').hover();
1656
+ const scrollHourInfo = await page.evaluate(()=>{
1657
+ const hourInner = document.querySelector('#select-hour_list + * .rc-virtual-list-holder-inner');
1658
+ const hourElementHeight = hourInner?.children[0].clientHeight || 36;
1659
+ const hourMapsElem = Array.from(document.querySelectorAll('#select-hour_list + * .cheetah-select-item-option .cheetah-select-item-option-content'));
1660
+ const hourMap = hourMapsElem.map((item)=>item.textContent?.trim());
1661
+ return {
1662
+ elementHeight: hourElementHeight,
1663
+ elementItem: hourMap
1664
+ };
1665
+ });
1666
+ const fistHourElem = scrollHourInfo.elementItem[0];
1667
+ let fistHourElemH = Number(fistHourElem?.split("点")[0]);
1668
+ const lastHourElem = scrollHourInfo.elementItem[scrollHourInfo.elementItem.length - 1];
1669
+ let lastHourElemH = Number(lastHourElem?.split("点")[0]);
1670
+ let targetTimeH = Number(TimeFormatter.format(params.settingInfo.timer, 'h'));
1671
+ await page.mouse.wheel(0, targetTimeH > lastHourElemH ? (targetTimeH - lastHourElemH) * scrollHourInfo.elementHeight : targetTimeH < fistHourElemH ? -(fistHourElemH - targetTimeH) * scrollHourInfo.elementHeight : 0);
1672
+ await page.locator("#select-hour_list + * .cheetah-select-item-option ", {
1673
+ hasText: targetTimeH + "点"
1674
+ }).click();
1675
+ await page.waitForTimeout(200);
1676
+ await page.locator(".timepublish-wrap-select .select-wrap", {
1677
+ hasText: "分"
1678
+ }).click();
1679
+ await page.locator('#select-minute_list +div.rc-virtual-list').hover();
1680
+ const scrollMinuteInfo = await page.evaluate(()=>{
1681
+ const hourInner = document.querySelector('#select-minute_list + * .rc-virtual-list-holder-inner');
1682
+ const hourElementHeight = hourInner?.children[0].clientHeight || 36;
1683
+ const hourMapsElem = Array.from(document.querySelectorAll('#select-minute_list + * .cheetah-select-item-option .cheetah-select-item-option-content'));
1684
+ const hourMap = hourMapsElem.map((item)=>item.textContent?.trim());
1685
+ return {
1686
+ elementHeight: hourElementHeight,
1687
+ elementItem: hourMap
1688
+ };
1689
+ });
1690
+ const fistMinuteElem = scrollMinuteInfo.elementItem[0];
1691
+ let fistMinuteElemH = Number(fistMinuteElem?.split("分")[0]);
1692
+ const lastMinuteElem = scrollMinuteInfo.elementItem[scrollMinuteInfo.elementItem.length - 1];
1693
+ let lastMinuteElemH = Number(lastMinuteElem?.split("分")[0]);
1694
+ let targetTimeM = Number(TimeFormatter.format(params.settingInfo.timer, 'm'));
1695
+ await page.mouse.wheel(0, targetTimeM > lastMinuteElemH ? (targetTimeM - lastMinuteElemH) * scrollMinuteInfo.elementHeight : targetTimeM < fistMinuteElemH ? -(fistMinuteElemH - targetTimeM) * scrollMinuteInfo.elementHeight : 0);
1696
+ await page.locator("#select-minute_list + * .cheetah-select-item-option ", {
1697
+ hasText: targetTimeM + "分"
1698
+ }).click();
1699
+ await page.waitForTimeout(200);
1700
+ await page.locator(".cheetah-modal-confirm-btns button").filter({
1701
+ hasText: "定时发布"
1702
+ }).click();
1703
+ } else operatorContainer.locator(".op-btn-outter-content").filter({
1704
+ hasText: /^发布/
1618
1705
  }).locator("button").click();
1619
1706
  });
1620
1707
  await page.close();
1621
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(articleId);
1708
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(articleId, articleId ? "发布成功" : message);
1622
1709
  };
1623
1710
  const baijiahaoPublish = async (task, params)=>{
1624
1711
  if ("rpa" === params.actionType) return rpaAction(task, params);
@@ -1799,7 +1886,7 @@ const mock_errnoMap = {
1799
1886
  2005: "账号无【申明原创】权限,请关闭申明后重试。",
1800
1887
  100004: "用户未登录或登陆已过期,请重新登陆后重试。"
1801
1888
  };
1802
- const generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
1889
+ const mock_generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
1803
1890
  const encodedKey = encodeURIComponent(key);
1804
1891
  const encodedValue = encodeURIComponent(String(value));
1805
1892
  return `${encodedKey}=${encodedValue}`;
@@ -1923,8 +2010,8 @@ const mock_mockAction = async (task, params)=>{
1923
2010
  trends_writing_tag: 0,
1924
2011
  is_refute_rumor: 0,
1925
2012
  save: "publish" === params.saveType ? 1 : 0,
1926
- timer_status: 0,
1927
- timer_time: "",
2013
+ timer_status: params.settingInfo.timer ? 1 : 0,
2014
+ timer_time: params.settingInfo.timer ? TimeFormatter.format(params.settingInfo.timer) : "",
1928
2015
  title: params.title,
1929
2016
  content: content + topicContent,
1930
2017
  extra: JSON.stringify(extraData),
@@ -1949,32 +2036,40 @@ const mock_mockAction = async (task, params)=>{
1949
2036
  claim_exclusive: toutiaoOriginal.includes("exclusive") ? 1 : 0
1950
2037
  };
1951
2038
  const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
1952
- if (!msToken) return {
1953
- code: 200,
1954
- message: "账号数据异常,请重新绑定账号后重试。",
1955
- data: ""
1956
- };
1957
- const postHeaders = generatorFormData({
1958
- source: "mp",
1959
- type: "article",
1960
- aid: 1231,
1961
- mp_publish_ab_val: 0,
1962
- msToken: msToken
1963
- });
1964
- const postData = generatorFormData(publishData);
1965
- let a_bogus = GenAB(postHeaders, postData);
1966
- const publishResult = await http.api({
2039
+ let publishOption = {};
2040
+ if (msToken) {
2041
+ const postHeaders = mock_generatorFormData({
2042
+ source: "mp",
2043
+ type: "article",
2044
+ aid: 1231,
2045
+ mp_publish_ab_val: 0,
2046
+ msToken: msToken
2047
+ });
2048
+ const postData = mock_generatorFormData(publishData);
2049
+ let a_bogus = GenAB(postHeaders, postData);
2050
+ publishOption = {
2051
+ method: "post",
2052
+ url: `https://mp.toutiao.com/mp/agw/article/publish?${postHeaders}&a_bogus=${a_bogus}`,
2053
+ data: postData,
2054
+ headers: {
2055
+ "content-type": "application/x-www-form-urlencoded",
2056
+ "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
2057
+ },
2058
+ defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
2059
+ };
2060
+ } else publishOption = {
1967
2061
  method: "post",
1968
- url: `https://mp.toutiao.com/mp/agw/article/publish?${postHeaders}&a_bogus=${a_bogus}`,
1969
- data: postData,
2062
+ url: "https://mp.toutiao.com/mp/agw/article/publish?source=mp&type=article&aid=1",
2063
+ data: publishData,
1970
2064
  headers: {
1971
- "content-type": "application/x-www-form-urlencoded",
1972
- "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
2065
+ "content-type": "application/x-www-form-urlencoded"
1973
2066
  },
1974
2067
  defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
1975
- });
2068
+ };
2069
+ const publishResult = await http.api(publishOption);
1976
2070
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data.pgc_id);
1977
2071
  };
2072
+ const rpa_GenAB = __webpack_require__("./src/utils/ttABEncrypt.js");
1978
2073
  const rpa_rpaAction = async (task, params)=>{
1979
2074
  const tmpCachePath = task.getTmpPath();
1980
2075
  const commonCookies = {
@@ -2009,9 +2104,30 @@ const rpa_rpaAction = async (task, params)=>{
2009
2104
  await page.route('**', async (route, request)=>{
2010
2105
  const url = new URL(request.url());
2011
2106
  if (interceptUrls.some((pattern)=>url.pathname.includes(pattern))) {
2012
- url.searchParams.set('aid', '1');
2107
+ const headers = {
2108
+ ...request.headers(),
2109
+ "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
2110
+ };
2111
+ const generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
2112
+ const encodedKey = encodeURIComponent(key);
2113
+ const encodedValue = encodeURIComponent(String(value));
2114
+ return `${encodedKey}=${encodedValue}`;
2115
+ }).join('&');
2116
+ const postHeaders = generatorFormData({
2117
+ source: "mp",
2118
+ type: "article",
2119
+ aid: 1231,
2120
+ mp_publish_ab_val: 0,
2121
+ msToken: url.searchParams.get('msToken')
2122
+ });
2123
+ const postData = request.postData() || "";
2124
+ let a_bogus = rpa_GenAB(postHeaders, postData);
2125
+ url.searchParams.set('aid', "1231");
2126
+ url.searchParams.set('mp_publish_ab_val', "0");
2127
+ url.searchParams.set('a_bogus', a_bogus);
2013
2128
  await route.continue({
2014
- url: url.toString()
2129
+ url: url.toString(),
2130
+ headers: headers
2015
2131
  });
2016
2132
  } else await route.continue();
2017
2133
  });
@@ -2092,7 +2208,7 @@ const rpa_rpaAction = async (task, params)=>{
2092
2208
  }).locator("xpath=..");
2093
2209
  exclusiveContainer.locator(".exclusive .exclusive-checkbox-wraper .byte-checkbox").click();
2094
2210
  }
2095
- const articleId = await new Promise((resolve)=>{
2211
+ const articleId = await new Promise(async (resolve)=>{
2096
2212
  const handleResponse = async (response)=>{
2097
2213
  const url = response.url();
2098
2214
  if (url.includes("/mp/agw/article/publish")) {
@@ -2102,7 +2218,32 @@ const rpa_rpaAction = async (task, params)=>{
2102
2218
  }
2103
2219
  };
2104
2220
  page.on("response", handleResponse);
2105
- page.locator(".publish-footer button").filter({
2221
+ if (params.settingInfo.timer) {
2222
+ await page.locator(".publish-footer button").filter({
2223
+ hasText: "定时发布"
2224
+ }).click();
2225
+ await page.waitForSelector('button.publish-btn:not(.byte-btn-loading) >> nth=1', {
2226
+ state: 'attached'
2227
+ });
2228
+ await page.locator(".byte-modal-content .day-select .byte-select-view-value").click();
2229
+ await page.locator('li.byte-select-option', {
2230
+ hasText: TimeFormatter.format(params.settingInfo.timer, "MM月dd日")
2231
+ }).click();
2232
+ await page.waitForTimeout(200);
2233
+ await page.locator(".byte-modal-content .hour-select .byte-select-view-value").click();
2234
+ await page.locator('li.byte-select-option', {
2235
+ hasText: TimeFormatter.format(params.settingInfo.timer, "h")
2236
+ }).click();
2237
+ await page.waitForTimeout(200);
2238
+ await page.locator(".byte-modal-content .minute-select .byte-select-view-value").click();
2239
+ await page.locator('li.byte-select-option', {
2240
+ hasText: TimeFormatter.format(params.settingInfo.timer, "m")
2241
+ }).click();
2242
+ await page.waitForTimeout(200);
2243
+ await page.locator(".byte-modal-footer button").filter({
2244
+ hasText: "预览并定时发布"
2245
+ }).click();
2246
+ } else await page.locator(".publish-footer button").filter({
2106
2247
  hasText: "预览并发布"
2107
2248
  }).click();
2108
2249
  });
@@ -2113,13 +2254,13 @@ const rpa_rpaAction = async (task, params)=>{
2113
2254
  }
2114
2255
  if ("publish" === params.saveType) {
2115
2256
  await page.locator(".publish-footer button").filter({
2116
- hasText: "确认发布"
2257
+ hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
2117
2258
  }).waitFor({
2118
2259
  state: "visible"
2119
2260
  });
2120
2261
  await page.waitForTimeout(200);
2121
2262
  await page.locator(".publish-footer button").filter({
2122
- hasText: "确认发布"
2263
+ hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
2123
2264
  }).click();
2124
2265
  }
2125
2266
  await page.close();
@@ -2136,6 +2277,106 @@ const toutiaoPublish = async (task, params)=>{
2136
2277
  if ("mockApi" === params.actionType) return mock_mockAction(task, params);
2137
2278
  return executeAction(mock_mockAction, rpa_rpaAction)(task, params);
2138
2279
  };
2280
+ const TTFansExport = async (_task, params)=>{
2281
+ const http = new Http({
2282
+ headers: {
2283
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2284
+ referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
2285
+ }
2286
+ });
2287
+ try {
2288
+ const res = await http.api({
2289
+ method: "get",
2290
+ url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?app_id=1231",
2291
+ params: {
2292
+ app_id: 1231
2293
+ }
2294
+ });
2295
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.code ? {
2296
+ fans_count: res.total_fans_count
2297
+ } : {
2298
+ fans_count: null
2299
+ }, "获取粉丝数成功!");
2300
+ } catch (error) {
2301
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
2302
+ fans_count: null
2303
+ }, "获取粉丝数失败,请检查登陆有效性!");
2304
+ }
2305
+ };
2306
+ const XhsFansExport = async (_task, params)=>{
2307
+ const http = new Http({
2308
+ headers: {
2309
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2310
+ referer: "https://creator.xiaohongshu.com/new/home?source=official"
2311
+ }
2312
+ });
2313
+ try {
2314
+ const res = await http.api({
2315
+ method: "get",
2316
+ url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
2317
+ });
2318
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.result ? {
2319
+ fans_count: res.data.fans_count
2320
+ } : {
2321
+ fans_count: null
2322
+ }, "获取粉丝数成功!");
2323
+ } catch (error) {
2324
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
2325
+ fans_count: null
2326
+ }, "获取粉丝数失败,请检查登陆有效性!");
2327
+ }
2328
+ };
2329
+ const WxFansExport = async (_task, params)=>{
2330
+ const http = new Http({
2331
+ headers: {
2332
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
2333
+ }
2334
+ });
2335
+ try {
2336
+ const htmlStr = await http.api({
2337
+ method: "get",
2338
+ url: "https://mp.weixin.qq.com/cgi-bin/home",
2339
+ params: {
2340
+ t: "home/index",
2341
+ token: params.token,
2342
+ lang: "zh_CN"
2343
+ }
2344
+ });
2345
+ const match = htmlStr.match(/总用户数[\s\S]*?<mp-thousandth>(\d+)<\/mp-thousandth>/);
2346
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(match ? {
2347
+ fans_count: Number(match[1])
2348
+ } : {
2349
+ fans_count: null
2350
+ }, "获取粉丝数成功!");
2351
+ } catch (error) {
2352
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
2353
+ fans_count: null
2354
+ }, "获取粉丝数失败,请检查登陆有效性!");
2355
+ }
2356
+ };
2357
+ const BjhFansExport = async (_task, params)=>{
2358
+ const http = new Http({
2359
+ headers: {
2360
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2361
+ referer: "https://baijiahao.baidu.com/builder/rc/home"
2362
+ }
2363
+ });
2364
+ try {
2365
+ const res = await http.api({
2366
+ method: "get",
2367
+ url: "https://baijiahao.baidu.com/cms-ui/rights/growth/get_info"
2368
+ });
2369
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.errno ? {
2370
+ fans_count: res.data.total_fans
2371
+ } : {
2372
+ fans_count: null
2373
+ }, "获取粉丝数成功!");
2374
+ } catch (error) {
2375
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
2376
+ fans_count: null
2377
+ }, "获取粉丝数失败,请检查登陆有效性!");
2378
+ }
2379
+ };
2139
2380
  const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
2140
2381
  const tmpCachePath = task.getTmpPath();
2141
2382
  const http = new Http({
@@ -2294,7 +2535,8 @@ const weixinPublish_mock_errnoMap = {
2294
2535
  "-4": "不支持发布审核中或转码中的视频",
2295
2536
  "-2": "不支持发布审核中或转码中的视频",
2296
2537
  770001: "不支持发布审核中或转码中的视频",
2297
- 200074: "系统繁忙,请稍后重试!"
2538
+ 200074: "系统繁忙,请稍后重试!",
2539
+ 64702: "标题超出64字长度限制,请修改标题后重试。"
2298
2540
  };
2299
2541
  const ignoreErrno = [
2300
2542
  154019
@@ -2304,7 +2546,7 @@ const userTypeMap = {
2304
2546
  已关注的用户: 2,
2305
2547
  已关注7天及以上的用户: 3
2306
2548
  };
2307
- const mock_generatorFormData = (data)=>{
2549
+ const weixinPublish_mock_generatorFormData = (data)=>{
2308
2550
  const formData = new URLSearchParams();
2309
2551
  for (const [key, value] of Object.entries(data))formData.append(key, String(value));
2310
2552
  return formData.toString();
@@ -2320,7 +2562,7 @@ const checkCopyrightStat = async (http, params, data)=>{
2320
2562
  token: params.token,
2321
2563
  lang: "zh_CN"
2322
2564
  },
2323
- data: mock_generatorFormData(data)
2565
+ data: weixinPublish_mock_generatorFormData(data)
2324
2566
  });
2325
2567
  } catch (error) {
2326
2568
  resData = error?.data;
@@ -2434,7 +2676,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2434
2676
  params: {
2435
2677
  action: "searchacct"
2436
2678
  },
2437
- data: mock_generatorFormData({
2679
+ data: weixinPublish_mock_generatorFormData({
2438
2680
  lang: "zh_CN",
2439
2681
  f: "json",
2440
2682
  ajax: 1,
@@ -2563,7 +2805,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2563
2805
  params: {
2564
2806
  action: 'addautoreply'
2565
2807
  },
2566
- data: mock_generatorFormData({
2808
+ data: weixinPublish_mock_generatorFormData({
2567
2809
  type: 1,
2568
2810
  fingerprint,
2569
2811
  token: params.token,
@@ -2685,7 +2927,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2685
2927
  type: 77,
2686
2928
  lang: "zh_CN"
2687
2929
  },
2688
- data: mock_generatorFormData(draftData),
2930
+ data: weixinPublish_mock_generatorFormData(draftData),
2689
2931
  defaultErrorMsg: "创建草稿失败,请稍后重试发布。"
2690
2932
  });
2691
2933
  if ("draft" === params.saveType) return {
@@ -2718,7 +2960,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2718
2960
  lang: "zh_CN",
2719
2961
  token: params.token
2720
2962
  },
2721
- data: mock_generatorFormData({
2963
+ data: weixinPublish_mock_generatorFormData({
2722
2964
  token: params.token,
2723
2965
  lang: "zh_CN",
2724
2966
  f: "json",
@@ -2749,7 +2991,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2749
2991
  token: params.token,
2750
2992
  lang: "zh_CN"
2751
2993
  },
2752
- data: mock_generatorFormData({
2994
+ data: weixinPublish_mock_generatorFormData({
2753
2995
  appmsgid: appMsgId,
2754
2996
  fingerprint,
2755
2997
  token: params.token,
@@ -2761,7 +3003,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2761
3003
  await http.api({
2762
3004
  method: "post",
2763
3005
  url: "https://mp.weixin.qq.com/cgi-bin/masssend?action=check_same_material",
2764
- data: mock_generatorFormData({
3006
+ data: weixinPublish_mock_generatorFormData({
2765
3007
  msgid: appMsgId,
2766
3008
  fingerprint,
2767
3009
  token: params.token,
@@ -2800,7 +3042,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2800
3042
  token: params.token,
2801
3043
  lang: "zh_CN"
2802
3044
  },
2803
- data: mock_generatorFormData({
3045
+ data: weixinPublish_mock_generatorFormData({
2804
3046
  appmsg_id: appMsgId,
2805
3047
  fingerprint,
2806
3048
  token: params.token,
@@ -2819,7 +3061,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2819
3061
  params: {
2820
3062
  action: "check_music"
2821
3063
  },
2822
- data: mock_generatorFormData({
3064
+ data: weixinPublish_mock_generatorFormData({
2823
3065
  appmsgid: appMsgId,
2824
3066
  masssend_check: 1,
2825
3067
  fingerprint,
@@ -2839,7 +3081,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2839
3081
  lang: "zh_CN",
2840
3082
  1: 1
2841
3083
  },
2842
- data: mock_generatorFormData({
3084
+ data: weixinPublish_mock_generatorFormData({
2843
3085
  token: params.token,
2844
3086
  lang: "zh_CN",
2845
3087
  f: "json",
@@ -2859,7 +3101,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2859
3101
  lang: "zh_CN",
2860
3102
  1: 1
2861
3103
  },
2862
- data: mock_generatorFormData({
3104
+ data: weixinPublish_mock_generatorFormData({
2863
3105
  token: params.token,
2864
3106
  lang: "zh_CN",
2865
3107
  f: "json",
@@ -2891,6 +3133,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2891
3133
  ticket: getTicketResult.ticket,
2892
3134
  uuid,
2893
3135
  msgid: operation_seq,
3136
+ open_email: !!params.settingInfo.timer,
2894
3137
  ...params.masssend ? {} : {
2895
3138
  publish_type: 1
2896
3139
  }
@@ -2913,7 +3156,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2913
3156
  lang: "zh_CN",
2914
3157
  timespam: Date.now()
2915
3158
  },
2916
- data: mock_generatorFormData({
3159
+ data: weixinPublish_mock_generatorFormData({
2917
3160
  token: params.token,
2918
3161
  lang: "zh_CN",
2919
3162
  f: "json",
@@ -2943,7 +3186,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2943
3186
  lang: "zh_CN",
2944
3187
  1: 1
2945
3188
  },
2946
- data: mock_generatorFormData({
3189
+ data: weixinPublish_mock_generatorFormData({
2947
3190
  token: params.token,
2948
3191
  lang: "zh_CN",
2949
3192
  f: "json",
@@ -2965,7 +3208,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2965
3208
  is_release_publish_page: 1
2966
3209
  }
2967
3210
  },
2968
- data: mock_generatorFormData({
3211
+ data: weixinPublish_mock_generatorFormData({
2969
3212
  token: params.token,
2970
3213
  lang: "zh_CN",
2971
3214
  f: "json",
@@ -2982,7 +3225,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2982
3225
  country: "",
2983
3226
  province: "",
2984
3227
  city: "",
2985
- send_time: "0",
3228
+ send_time: params.settingInfo.timer ? params.settingInfo.timer : "0",
2986
3229
  type: "10",
2987
3230
  share_page: "1",
2988
3231
  synctxweibo: "0",
@@ -2999,7 +3242,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2999
3242
  }),
3000
3243
  defaultErrorMsg: params.masssend ? "文章群发异常,请尝试关闭群发或稍后重试。" : "文章发布异常,请稍后重试。"
3001
3244
  });
3002
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId, "微信公众号发布完成。");
3245
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId, params.settingInfo.timer ? "微信公众号文章定时发布成功。" : "微信公众号发布完成。");
3003
3246
  };
3004
3247
  const waitQrcodeResultMaxTime = 2000 * scanRetryMaxCount;
3005
3248
  const weixinPublish_rpa_rpaAction = async (task, params)=>{
@@ -3120,6 +3363,10 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3120
3363
  checkInterval: 1000,
3121
3364
  stopAfterClick: false
3122
3365
  });
3366
+ PopupListener(page, '[extclass="weui-desktop-dialog_simple"] .weui-desktop-dialog', "小店", '[extclass="weui-desktop-dialog_simple"] .weui-desktop-icon-btn.weui-desktop-dialog__close-btn', {
3367
+ checkInterval: 1000,
3368
+ stopAfterClick: true
3369
+ });
3123
3370
  const titleInstance = page.locator("#js_title_main textarea#title");
3124
3371
  await titleInstance.click();
3125
3372
  await titleInstance.fill(params.title);
@@ -3276,8 +3523,8 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3276
3523
  const wxInteraction_bd = wxInteraction_setting.locator('.weui-desktop-dialog__bd');
3277
3524
  const wxInteraction_ft = wxInteraction_setting.locator('.weui-desktop-dialog__ft');
3278
3525
  if ("public" == params.settingInfo.wxInteraction.Type) {
3279
- await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
3280
- hasText: '留言'
3526
+ await wxInteraction_bd.locator('.weui-desktop-form__check-label span', {
3527
+ hasText: /^(开启|留言)$/
3281
3528
  }).click();
3282
3529
  const comment_area = wxInteraction_bd.locator('.comment-options-block.pt0');
3283
3530
  const reply_area = wxInteraction_bd.locator('.comment-options-block.bb0.pb0');
@@ -3295,8 +3542,8 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3295
3542
  }).click();
3296
3543
  if (params.settingInfo.wxInteraction.Option?.elect_reply) await reply_area.locator('.weui-desktop-switch__box').check();
3297
3544
  else await reply_area.locator('.weui-desktop-switch__input').isChecked() && reply_area.locator('.weui-desktop-switch__box').uncheck();
3298
- } else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
3299
- hasText: '快捷私信'
3545
+ } else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label span', {
3546
+ hasText: /^(快捷私信|不开启)$/
3300
3547
  }).click();
3301
3548
  await wxInteraction_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
3302
3549
  }
@@ -3322,7 +3569,7 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3322
3569
  await poperInstance.locator('.frm_radio_item label[for="not_recomment_0"]').click();
3323
3570
  }
3324
3571
  await page.waitForTimeout(1000);
3325
- const articleId = await new Promise((resolve)=>{
3572
+ const articleId = await new Promise(async (resolve)=>{
3326
3573
  const handleResponse = async (response)=>{
3327
3574
  const url = response.url();
3328
3575
  const query = parseUrlQueryString(url);
@@ -3334,7 +3581,34 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3334
3581
  };
3335
3582
  page.on("response", handleResponse);
3336
3583
  page.locator("#editor_pannel #bottom_main #js_button_area #js_send button").click();
3584
+ await page.waitForTimeout(200);
3585
+ if (params.settingInfo.timer) {
3586
+ await page.locator(".mass-send .mass-send__td-setting", {
3587
+ hasText: "定时发表"
3588
+ }).locator(".weui-desktop-switch__box").check();
3589
+ let dateD = Number(TimeFormatter.format(params.settingInfo.timer, "d"));
3590
+ let nowD = Number(TimeFormatter.format(Date.now(), "d"));
3591
+ await page.locator(".mass-send__timer .weui-desktop-form__dropdown__dt").click();
3592
+ const dropMenu = page.locator(".mass-send__timer .weui-desktop-dropdown-menu").locator(".weui-desktop-dropdown__list-ele");
3593
+ await dropMenu.filter({
3594
+ hasText: dateD == nowD ? "今天" : dateD == nowD + 1 ? "明天" : TimeFormatter.format(params.settingInfo.timer, "M月d日")
3595
+ }).click();
3596
+ const timeDropMenu = page.locator(".mass-send__timer .weui-desktop-picker__time:visible");
3597
+ await timeDropMenu.locator(".weui-desktop-form__input").fill(TimeFormatter.format(params.settingInfo.timer, "hh:mm"));
3598
+ await timeDropMenu.locator("i.weui-desktop-icon__time").click();
3599
+ }
3337
3600
  });
3601
+ await page.waitForTimeout(200);
3602
+ if (params.masssend) {
3603
+ const times = Number(await page.locator(".mass-send .multi-sent__notice_time").locator('div[style="display: none;"] div:not([style*="display: none"]) span').textContent());
3604
+ if (0 == times) return {
3605
+ code: 200,
3606
+ message: "今日群发次数用尽,请明天再试。",
3607
+ data: ""
3608
+ };
3609
+ await page.locator(".mass-send .mass_send__notify").locator(".weui-desktop-switch__box").check();
3610
+ } else await page.locator(".mass-send .mass_send__notify").locator(".weui-desktop-switch__box").uncheck();
3611
+ await page.waitForTimeout(200);
3338
3612
  await page.waitForSelector('.new_mass_send_dialog .weui-desktop-dialog__wrp:not([style*="display: none"])', {
3339
3613
  state: "visible"
3340
3614
  });
@@ -3343,6 +3617,19 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3343
3617
  state: "visible"
3344
3618
  });
3345
3619
  await page.locator(".double_check_dialog .weui-desktop-dialog .weui-desktop-dialog__ft button.weui-desktop-btn_primary").click();
3620
+ await page.waitForTimeout(2000);
3621
+ const originalCheckDialog = page.locator('div[data-transfer="true"][width\\.number="800"][height\\.number="800"] .weui-desktop-dialog__title');
3622
+ if (await originalCheckDialog.count() > 0) {
3623
+ if (await originalCheckDialog.textContent() === "原创校验") {
3624
+ const popMassend = page.locator('div[data-transfer="true"][width\\.number="800"][height\\.number="800"]');
3625
+ await popMassend.locator(".weui-desktop-btn_primary", {
3626
+ hasText: "下一步"
3627
+ }).click();
3628
+ await popMassend.locator(".weui-desktop-btn_primary", {
3629
+ hasText: "继续"
3630
+ }).click();
3631
+ }
3632
+ }
3346
3633
  try {
3347
3634
  const startTime = Date.now();
3348
3635
  await new Promise(async (resolve, reject)=>{
@@ -4066,9 +4353,7 @@ const xiaohongshuPublish = async (task, params)=>{
4066
4353
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
4067
4354
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
4068
4355
  };
4069
- var package_namespaceObject = {
4070
- i8: "1.2.10"
4071
- };
4356
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.11-beta.1"}');
4072
4357
  class Action {
4073
4358
  constructor(task){
4074
4359
  this.task = task;
@@ -4092,6 +4377,18 @@ class Action {
4092
4377
  searchToutiaoTopicList(params) {
4093
4378
  return this.bindTask(searchToutiaoTopicList, params);
4094
4379
  }
4380
+ TTFansExport(params) {
4381
+ return this.bindTask(TTFansExport, params);
4382
+ }
4383
+ XhsFansExport(params) {
4384
+ return this.bindTask(XhsFansExport, params);
4385
+ }
4386
+ WxFansExport(params) {
4387
+ return this.bindTask(WxFansExport, params);
4388
+ }
4389
+ BjhFansExport(params) {
4390
+ return this.bindTask(BjhFansExport, params);
4391
+ }
4095
4392
  getToutiaoConfig(params) {
4096
4393
  return this.bindTask(getToutiaoConfig, params);
4097
4394
  }