@iflyrpa/actions 1.2.11-beta.1 → 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
@@ -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)=>{
@@ -1494,6 +1499,7 @@ const mockAction = async (task, params)=>{
1494
1499
  cover_source: "upload",
1495
1500
  activity_list
1496
1501
  };
1502
+ params.settingInfo.timer && (publishData['timer_time'] = params.settingInfo.timer);
1497
1503
  const isDraft = "draft" === params.saveType;
1498
1504
  const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
1499
1505
  const res = await http.api({
@@ -1615,13 +1621,16 @@ const rpaAction = async (task, params)=>{
1615
1621
  if (await findActivity.count() > 0) findActivity.first().locator("..").click();
1616
1622
  }
1617
1623
  }
1618
- const articleId = await new Promise((resolve)=>{
1624
+ const { articleId, message } = await new Promise(async (resolve)=>{
1619
1625
  const handleResponse = async (response)=>{
1620
1626
  const url = response.url();
1621
1627
  if (url.includes("/pcui/article/save") || url.includes("/pcui/article/publish")) {
1622
1628
  const jsonResponse = await response.json();
1623
1629
  page.off("response", handleResponse);
1624
- resolve(jsonResponse?.ret?.article_id);
1630
+ resolve({
1631
+ articleId: jsonResponse?.ret?.article_id,
1632
+ message: jsonResponse?.errmsg
1633
+ });
1625
1634
  }
1626
1635
  };
1627
1636
  page.on("response", handleResponse);
@@ -1629,12 +1638,74 @@ const rpaAction = async (task, params)=>{
1629
1638
  if ("draft" === params.saveType) operatorContainer.locator(".op-btn-outter-content").filter({
1630
1639
  hasText: "存草稿"
1631
1640
  }).locator("button").click();
1632
- else operatorContainer.locator(".op-btn-outter-content").filter({
1633
- 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: /^发布/
1634
1705
  }).locator("button").click();
1635
1706
  });
1636
1707
  await page.close();
1637
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(articleId);
1708
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(articleId, articleId ? "发布成功" : message);
1638
1709
  };
1639
1710
  const baijiahaoPublish = async (task, params)=>{
1640
1711
  if ("rpa" === params.actionType) return rpaAction(task, params);
@@ -1815,7 +1886,7 @@ const mock_errnoMap = {
1815
1886
  2005: "账号无【申明原创】权限,请关闭申明后重试。",
1816
1887
  100004: "用户未登录或登陆已过期,请重新登陆后重试。"
1817
1888
  };
1818
- const generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
1889
+ const mock_generatorFormData = (data)=>Object.entries(data).map(([key, value])=>{
1819
1890
  const encodedKey = encodeURIComponent(key);
1820
1891
  const encodedValue = encodeURIComponent(String(value));
1821
1892
  return `${encodedKey}=${encodedValue}`;
@@ -1967,14 +2038,14 @@ const mock_mockAction = async (task, params)=>{
1967
2038
  const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
1968
2039
  let publishOption = {};
1969
2040
  if (msToken) {
1970
- const postHeaders = generatorFormData({
2041
+ const postHeaders = mock_generatorFormData({
1971
2042
  source: "mp",
1972
2043
  type: "article",
1973
2044
  aid: 1231,
1974
2045
  mp_publish_ab_val: 0,
1975
2046
  msToken: msToken
1976
2047
  });
1977
- const postData = generatorFormData(publishData);
2048
+ const postData = mock_generatorFormData(publishData);
1978
2049
  let a_bogus = GenAB(postHeaders, postData);
1979
2050
  publishOption = {
1980
2051
  method: "post",
@@ -1998,6 +2069,7 @@ const mock_mockAction = async (task, params)=>{
1998
2069
  const publishResult = await http.api(publishOption);
1999
2070
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data.pgc_id);
2000
2071
  };
2072
+ const rpa_GenAB = __webpack_require__("./src/utils/ttABEncrypt.js");
2001
2073
  const rpa_rpaAction = async (task, params)=>{
2002
2074
  const tmpCachePath = task.getTmpPath();
2003
2075
  const commonCookies = {
@@ -2032,9 +2104,30 @@ const rpa_rpaAction = async (task, params)=>{
2032
2104
  await page.route('**', async (route, request)=>{
2033
2105
  const url = new URL(request.url());
2034
2106
  if (interceptUrls.some((pattern)=>url.pathname.includes(pattern))) {
2035
- 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);
2036
2128
  await route.continue({
2037
- url: url.toString()
2129
+ url: url.toString(),
2130
+ headers: headers
2038
2131
  });
2039
2132
  } else await route.continue();
2040
2133
  });
@@ -2115,7 +2208,7 @@ const rpa_rpaAction = async (task, params)=>{
2115
2208
  }).locator("xpath=..");
2116
2209
  exclusiveContainer.locator(".exclusive .exclusive-checkbox-wraper .byte-checkbox").click();
2117
2210
  }
2118
- const articleId = await new Promise((resolve)=>{
2211
+ const articleId = await new Promise(async (resolve)=>{
2119
2212
  const handleResponse = async (response)=>{
2120
2213
  const url = response.url();
2121
2214
  if (url.includes("/mp/agw/article/publish")) {
@@ -2125,7 +2218,32 @@ const rpa_rpaAction = async (task, params)=>{
2125
2218
  }
2126
2219
  };
2127
2220
  page.on("response", handleResponse);
2128
- 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({
2129
2247
  hasText: "预览并发布"
2130
2248
  }).click();
2131
2249
  });
@@ -2136,13 +2254,13 @@ const rpa_rpaAction = async (task, params)=>{
2136
2254
  }
2137
2255
  if ("publish" === params.saveType) {
2138
2256
  await page.locator(".publish-footer button").filter({
2139
- hasText: "确认发布"
2257
+ hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
2140
2258
  }).waitFor({
2141
2259
  state: "visible"
2142
2260
  });
2143
2261
  await page.waitForTimeout(200);
2144
2262
  await page.locator(".publish-footer button").filter({
2145
- hasText: "确认发布"
2263
+ hasText: params.settingInfo.timer ? "定时发布" : "确认发布"
2146
2264
  }).click();
2147
2265
  }
2148
2266
  await page.close();
@@ -2417,7 +2535,8 @@ const weixinPublish_mock_errnoMap = {
2417
2535
  "-4": "不支持发布审核中或转码中的视频",
2418
2536
  "-2": "不支持发布审核中或转码中的视频",
2419
2537
  770001: "不支持发布审核中或转码中的视频",
2420
- 200074: "系统繁忙,请稍后重试!"
2538
+ 200074: "系统繁忙,请稍后重试!",
2539
+ 64702: "标题超出64字长度限制,请修改标题后重试。"
2421
2540
  };
2422
2541
  const ignoreErrno = [
2423
2542
  154019
@@ -2427,7 +2546,7 @@ const userTypeMap = {
2427
2546
  已关注的用户: 2,
2428
2547
  已关注7天及以上的用户: 3
2429
2548
  };
2430
- const mock_generatorFormData = (data)=>{
2549
+ const weixinPublish_mock_generatorFormData = (data)=>{
2431
2550
  const formData = new URLSearchParams();
2432
2551
  for (const [key, value] of Object.entries(data))formData.append(key, String(value));
2433
2552
  return formData.toString();
@@ -2443,7 +2562,7 @@ const checkCopyrightStat = async (http, params, data)=>{
2443
2562
  token: params.token,
2444
2563
  lang: "zh_CN"
2445
2564
  },
2446
- data: mock_generatorFormData(data)
2565
+ data: weixinPublish_mock_generatorFormData(data)
2447
2566
  });
2448
2567
  } catch (error) {
2449
2568
  resData = error?.data;
@@ -2557,7 +2676,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2557
2676
  params: {
2558
2677
  action: "searchacct"
2559
2678
  },
2560
- data: mock_generatorFormData({
2679
+ data: weixinPublish_mock_generatorFormData({
2561
2680
  lang: "zh_CN",
2562
2681
  f: "json",
2563
2682
  ajax: 1,
@@ -2686,7 +2805,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2686
2805
  params: {
2687
2806
  action: 'addautoreply'
2688
2807
  },
2689
- data: mock_generatorFormData({
2808
+ data: weixinPublish_mock_generatorFormData({
2690
2809
  type: 1,
2691
2810
  fingerprint,
2692
2811
  token: params.token,
@@ -2808,7 +2927,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2808
2927
  type: 77,
2809
2928
  lang: "zh_CN"
2810
2929
  },
2811
- data: mock_generatorFormData(draftData),
2930
+ data: weixinPublish_mock_generatorFormData(draftData),
2812
2931
  defaultErrorMsg: "创建草稿失败,请稍后重试发布。"
2813
2932
  });
2814
2933
  if ("draft" === params.saveType) return {
@@ -2841,7 +2960,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2841
2960
  lang: "zh_CN",
2842
2961
  token: params.token
2843
2962
  },
2844
- data: mock_generatorFormData({
2963
+ data: weixinPublish_mock_generatorFormData({
2845
2964
  token: params.token,
2846
2965
  lang: "zh_CN",
2847
2966
  f: "json",
@@ -2872,7 +2991,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2872
2991
  token: params.token,
2873
2992
  lang: "zh_CN"
2874
2993
  },
2875
- data: mock_generatorFormData({
2994
+ data: weixinPublish_mock_generatorFormData({
2876
2995
  appmsgid: appMsgId,
2877
2996
  fingerprint,
2878
2997
  token: params.token,
@@ -2884,7 +3003,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2884
3003
  await http.api({
2885
3004
  method: "post",
2886
3005
  url: "https://mp.weixin.qq.com/cgi-bin/masssend?action=check_same_material",
2887
- data: mock_generatorFormData({
3006
+ data: weixinPublish_mock_generatorFormData({
2888
3007
  msgid: appMsgId,
2889
3008
  fingerprint,
2890
3009
  token: params.token,
@@ -2923,7 +3042,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2923
3042
  token: params.token,
2924
3043
  lang: "zh_CN"
2925
3044
  },
2926
- data: mock_generatorFormData({
3045
+ data: weixinPublish_mock_generatorFormData({
2927
3046
  appmsg_id: appMsgId,
2928
3047
  fingerprint,
2929
3048
  token: params.token,
@@ -2942,7 +3061,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2942
3061
  params: {
2943
3062
  action: "check_music"
2944
3063
  },
2945
- data: mock_generatorFormData({
3064
+ data: weixinPublish_mock_generatorFormData({
2946
3065
  appmsgid: appMsgId,
2947
3066
  masssend_check: 1,
2948
3067
  fingerprint,
@@ -2962,7 +3081,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2962
3081
  lang: "zh_CN",
2963
3082
  1: 1
2964
3083
  },
2965
- data: mock_generatorFormData({
3084
+ data: weixinPublish_mock_generatorFormData({
2966
3085
  token: params.token,
2967
3086
  lang: "zh_CN",
2968
3087
  f: "json",
@@ -2982,7 +3101,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
2982
3101
  lang: "zh_CN",
2983
3102
  1: 1
2984
3103
  },
2985
- data: mock_generatorFormData({
3104
+ data: weixinPublish_mock_generatorFormData({
2986
3105
  token: params.token,
2987
3106
  lang: "zh_CN",
2988
3107
  f: "json",
@@ -3014,6 +3133,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
3014
3133
  ticket: getTicketResult.ticket,
3015
3134
  uuid,
3016
3135
  msgid: operation_seq,
3136
+ open_email: !!params.settingInfo.timer,
3017
3137
  ...params.masssend ? {} : {
3018
3138
  publish_type: 1
3019
3139
  }
@@ -3036,7 +3156,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
3036
3156
  lang: "zh_CN",
3037
3157
  timespam: Date.now()
3038
3158
  },
3039
- data: mock_generatorFormData({
3159
+ data: weixinPublish_mock_generatorFormData({
3040
3160
  token: params.token,
3041
3161
  lang: "zh_CN",
3042
3162
  f: "json",
@@ -3066,7 +3186,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
3066
3186
  lang: "zh_CN",
3067
3187
  1: 1
3068
3188
  },
3069
- data: mock_generatorFormData({
3189
+ data: weixinPublish_mock_generatorFormData({
3070
3190
  token: params.token,
3071
3191
  lang: "zh_CN",
3072
3192
  f: "json",
@@ -3088,7 +3208,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
3088
3208
  is_release_publish_page: 1
3089
3209
  }
3090
3210
  },
3091
- data: mock_generatorFormData({
3211
+ data: weixinPublish_mock_generatorFormData({
3092
3212
  token: params.token,
3093
3213
  lang: "zh_CN",
3094
3214
  f: "json",
@@ -3105,7 +3225,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
3105
3225
  country: "",
3106
3226
  province: "",
3107
3227
  city: "",
3108
- send_time: "0",
3228
+ send_time: params.settingInfo.timer ? params.settingInfo.timer : "0",
3109
3229
  type: "10",
3110
3230
  share_page: "1",
3111
3231
  synctxweibo: "0",
@@ -3122,7 +3242,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
3122
3242
  }),
3123
3243
  defaultErrorMsg: params.masssend ? "文章群发异常,请尝试关闭群发或稍后重试。" : "文章发布异常,请稍后重试。"
3124
3244
  });
3125
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId, "微信公众号发布完成。");
3245
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId, params.settingInfo.timer ? "微信公众号文章定时发布成功。" : "微信公众号发布完成。");
3126
3246
  };
3127
3247
  const waitQrcodeResultMaxTime = 2000 * scanRetryMaxCount;
3128
3248
  const weixinPublish_rpa_rpaAction = async (task, params)=>{
@@ -3243,6 +3363,10 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3243
3363
  checkInterval: 1000,
3244
3364
  stopAfterClick: false
3245
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
+ });
3246
3370
  const titleInstance = page.locator("#js_title_main textarea#title");
3247
3371
  await titleInstance.click();
3248
3372
  await titleInstance.fill(params.title);
@@ -3399,8 +3523,8 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3399
3523
  const wxInteraction_bd = wxInteraction_setting.locator('.weui-desktop-dialog__bd');
3400
3524
  const wxInteraction_ft = wxInteraction_setting.locator('.weui-desktop-dialog__ft');
3401
3525
  if ("public" == params.settingInfo.wxInteraction.Type) {
3402
- await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
3403
- hasText: '留言'
3526
+ await wxInteraction_bd.locator('.weui-desktop-form__check-label span', {
3527
+ hasText: /^(开启|留言)$/
3404
3528
  }).click();
3405
3529
  const comment_area = wxInteraction_bd.locator('.comment-options-block.pt0');
3406
3530
  const reply_area = wxInteraction_bd.locator('.comment-options-block.bb0.pb0');
@@ -3418,8 +3542,8 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3418
3542
  }).click();
3419
3543
  if (params.settingInfo.wxInteraction.Option?.elect_reply) await reply_area.locator('.weui-desktop-switch__box').check();
3420
3544
  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: '快捷私信'
3545
+ } else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label span', {
3546
+ hasText: /^(快捷私信|不开启)$/
3423
3547
  }).click();
3424
3548
  await wxInteraction_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
3425
3549
  }
@@ -3445,7 +3569,7 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3445
3569
  await poperInstance.locator('.frm_radio_item label[for="not_recomment_0"]').click();
3446
3570
  }
3447
3571
  await page.waitForTimeout(1000);
3448
- const articleId = await new Promise((resolve)=>{
3572
+ const articleId = await new Promise(async (resolve)=>{
3449
3573
  const handleResponse = async (response)=>{
3450
3574
  const url = response.url();
3451
3575
  const query = parseUrlQueryString(url);
@@ -3457,7 +3581,34 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3457
3581
  };
3458
3582
  page.on("response", handleResponse);
3459
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
+ }
3460
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);
3461
3612
  await page.waitForSelector('.new_mass_send_dialog .weui-desktop-dialog__wrp:not([style*="display: none"])', {
3462
3613
  state: "visible"
3463
3614
  });
@@ -3466,6 +3617,19 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
3466
3617
  state: "visible"
3467
3618
  });
3468
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
+ }
3469
3633
  try {
3470
3634
  const startTime = Date.now();
3471
3635
  await new Promise(async (resolve, reject)=>{
@@ -4189,7 +4353,7 @@ const xiaohongshuPublish = async (task, params)=>{
4189
4353
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
4190
4354
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
4191
4355
  };
4192
- var package_namespaceObject = JSON.parse('{"i8":"1.2.11-beta.0"}');
4356
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.11-beta.1"}');
4193
4357
  class Action {
4194
4358
  constructor(task){
4195
4359
  this.task = task;