@iflyrpa/actions 4.0.4-beta.3 → 4.0.4-beta.5

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
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8b4e45ee-5a8e-53e3-b9eb-aaddbf5aef36")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="108ecd30-8541-54e3-aef4-897782dc7b9b")}catch(e){}}();
3
3
  import * as __WEBPACK_EXTERNAL_MODULE_crypto__ from "crypto";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_package_json_58ae5f06__ from "@iflyrpa/share/package.json";
@@ -4352,7 +4352,7 @@ function __webpack_require__(moduleId) {
4352
4352
  return module;
4353
4353
  };
4354
4354
  })();
4355
- var package_namespaceObject = JSON.parse('{"i8":"4.0.4-beta.3"}');
4355
+ var package_namespaceObject = JSON.parse('{"i8":"4.0.4-beta.5"}');
4356
4356
  const PROXY_CREDENTIALS = [
4357
4357
  {
4358
4358
  ip: "47.110.131.129",
@@ -13722,7 +13722,7 @@ const mock_mockAction = async (task, params)=>{
13722
13722
  error: message,
13723
13723
  result: {
13724
13724
  ...safeDecision,
13725
- data: safeDecision,
13725
+ data: decision,
13726
13726
  uploadedImgList: JSON.stringify(publishData.item.common.images)
13727
13727
  }
13728
13728
  };
@@ -15379,8 +15379,6 @@ async function getDouyinData(_task, params) {
15379
15379
  userProfileP,
15380
15380
  overviewP
15381
15381
  ]);
15382
- _task.logger.info(`抖音用户信息响应: ${JSON.stringify(userProfile)}`);
15383
- _task.logger.info(`抖音近7日数据响应: ${JSON.stringify(overview)}`);
15384
15382
  let fansNum = 0;
15385
15383
  let favedNum = 0;
15386
15384
  let followingNum = 0;
@@ -15395,12 +15393,12 @@ async function getDouyinData(_task, params) {
15395
15393
  const douyinData = {
15396
15394
  fansNum,
15397
15395
  favedNum,
15398
- fansNumLastWeek: toNum(ov?.fans_incr?.current_count),
15399
- watchNumLastWeek: toNum(ov?.play_count?.current_count),
15400
- likeNumLastWeek: toNum(ov?.like_count?.current_count),
15401
- commentNumLastWeek: toNum(ov?.comment_count?.current_count),
15402
- shareNumLastWeek: toNum(ov?.share_count?.current_count),
15403
- visitNumLastWeek: toNum(ov?.profile_visit?.current_count)
15396
+ fansNumLastWeek: toNum(ov?.new_fans?.last_period_incr),
15397
+ watchNumLastWeek: toNum(ov?.play?.last_period_incr),
15398
+ likeNumLastWeek: toNum(ov?.digg?.last_period_incr),
15399
+ commentNumLastWeek: toNum(ov?.comment?.last_period_incr),
15400
+ shareNumLastWeek: toNum(ov?.share?.last_period_incr),
15401
+ visitNumLastWeek: toNum(ov?.profile?.last_period_incr)
15404
15402
  };
15405
15403
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(douyinData, "抖音平台数据获取成功!");
15406
15404
  } catch (error) {
@@ -15464,7 +15462,6 @@ async function getShipinhaoData(_task, params) {
15464
15462
  retryDelay: 100,
15465
15463
  timeout: 5000
15466
15464
  });
15467
- _task.logger.info(`视频号账号数据响应: ${JSON.stringify(authData)}`);
15468
15465
  const AUTH_ERROR_CODES = [
15469
15466
  300333,
15470
15467
  300334,
@@ -15481,13 +15478,60 @@ async function getShipinhaoData(_task, params) {
15481
15478
  return types_errorResponse(`视频号账号信息获取失败:${authData.errMsg || "未知错误"}`, 414);
15482
15479
  }
15483
15480
  const finderUser = authData.data?.finderUser;
15481
+ const now = new Date();
15482
+ const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 2);
15483
+ const startTs = Math.floor(yesterday.getTime() / 1000);
15484
+ const endTs = startTs + 86400;
15485
+ _task.logger.info(`视频号昨日数据范围 start: ${startTs} ~ end: ${endTs}`);
15486
+ let fansNumYesterday = 0;
15487
+ let playNumYesterday = 0;
15488
+ let likeNumYesterday = 0;
15489
+ let commentNumYesterday = 0;
15490
+ try {
15491
+ const statsData = await http.api({
15492
+ method: "post",
15493
+ url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/statistic/new_post_total_data",
15494
+ params: {
15495
+ _aid: aid,
15496
+ _rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
15497
+ _pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
15498
+ },
15499
+ data: {
15500
+ startTs: startTs.toString(),
15501
+ endTs: endTs.toString(),
15502
+ interval: 3,
15503
+ timestamp: Date.now().toString(),
15504
+ _log_finder_uin: "",
15505
+ _log_finder_id: finderId,
15506
+ rawKeyBuff: "",
15507
+ pluginSessionId: null,
15508
+ scene: 7,
15509
+ reqScene: 7
15510
+ }
15511
+ }, {
15512
+ retries: 3,
15513
+ retryDelay: 100,
15514
+ timeout: 5000
15515
+ });
15516
+ if (!statsData.errCode && statsData.data?.totalData) {
15517
+ const data = statsData.data.totalData;
15518
+ fansNumYesterday = Number.parseInt(data.follow?.[1] || "0", 10) || 0;
15519
+ playNumYesterday = Number.parseInt(data.browse?.[1] || "0", 10) || 0;
15520
+ likeNumYesterday = Number.parseInt(data.like?.[1] || "0", 10) || 0;
15521
+ commentNumYesterday = Number.parseInt(data.comment?.[1] || "0", 10) || 0;
15522
+ _task.logger.info(`视频号昨日数据提取成功 - 净增关注:${fansNumYesterday}, 播放:${playNumYesterday}, 喜欢:${likeNumYesterday}, 评论:${commentNumYesterday}`);
15523
+ }
15524
+ } catch (error) {
15525
+ const errMsg = error instanceof Error ? error.message : String(error);
15526
+ _task.logger.warn(`视频号昨日数据获取失败(降级为null): ${errMsg}`);
15527
+ }
15484
15528
  const shipinhaoData = {
15485
15529
  fansNum: finderUser?.fansCount || 0,
15486
15530
  feedsCount: finderUser?.feedsCount || 0,
15487
- fansNumYesterday: null,
15488
- playNumYesterday: null,
15489
- likeNumYesterday: null,
15490
- commentNumYesterday: null
15531
+ fansNumYesterday,
15532
+ playNumYesterday,
15533
+ likeNumYesterday,
15534
+ commentNumYesterday
15491
15535
  };
15492
15536
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(shipinhaoData, "视频号平台数据获取成功!");
15493
15537
  } catch (error) {
@@ -15942,7 +15986,8 @@ async function handleBaijiahaoData(_task, params) {
15942
15986
  }
15943
15987
  async function handleDouyinData(_task, params) {
15944
15988
  try {
15945
- const { cookies, pageNum = 1, pageSize = 12, status = 0, showOriginalData = false, onlySuccess = false } = params;
15989
+ const { cookies, pageSize = 12, status = 0, showOriginalData = false, onlySuccess = false } = params;
15990
+ const pageNum = params.pageNum || 1;
15946
15991
  const headers = {
15947
15992
  cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
15948
15993
  referer: "https://creator.douyin.com"
@@ -16037,7 +16082,8 @@ async function handleDouyinData(_task, params) {
16037
16082
  }
16038
16083
  async function handleShipinhaoData(_task, params) {
16039
16084
  try {
16040
- const { cookies, postType = "all", pageNum = 1, pageSize = 20, showOriginalData = false } = params;
16085
+ const { cookies, postType = "all", pageSize = 10, showOriginalData = false } = params;
16086
+ const pageNum = params.pageNum || 1;
16041
16087
  const aidCookie = cookies.find((it)=>"_aid" === it.name)?.value;
16042
16088
  const aid = aidCookie || "9d3e0e9f-b842-498d-a273-4285d58df264";
16043
16089
  const uinCookie = cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
@@ -16063,7 +16109,7 @@ async function handleShipinhaoData(_task, params) {
16063
16109
  ];
16064
16110
  const http = new Http(...args);
16065
16111
  const finderIdCookie = cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
16066
- async function fetchPosts(currentPage, userpageType, pageUrl) {
16112
+ async function fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff = "") {
16067
16113
  return await http.api({
16068
16114
  method: "post",
16069
16115
  url: "https://channels.weixin.qq.com/micro/content/cgi-bin/mmfinderassistant-bin/post/post_list",
@@ -16080,7 +16126,7 @@ async function handleShipinhaoData(_task, params) {
16080
16126
  timestamp: Date.now().toString(),
16081
16127
  _log_finder_uin: "",
16082
16128
  _log_finder_id: finderIdCookie,
16083
- rawKeyBuff: "",
16129
+ rawKeyBuff,
16084
16130
  pluginSessionId: null,
16085
16131
  scene: 7,
16086
16132
  reqScene: 7
@@ -16091,6 +16137,37 @@ async function handleShipinhaoData(_task, params) {
16091
16137
  timeout: 5000
16092
16138
  });
16093
16139
  }
16140
+ async function fetchAllPosts(userpageType, pageUrl) {
16141
+ const allPosts = [];
16142
+ let currentPage = 1;
16143
+ let rawKeyBuff = "";
16144
+ let continueFlag = true;
16145
+ let totalCount = 0;
16146
+ while(continueFlag){
16147
+ const response = await fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff);
16148
+ if (response.errCode && AUTH_ERROR_CODES.includes(response.errCode)) throw new Error(`AUTH_ERROR:${response.errMsg || "登录已失效"}`);
16149
+ if (response.errCode) {
16150
+ _task.logger.warn(`视频号API错误:${response.errMsg} (${response.errCode})`);
16151
+ throw new Error(`视频号API错误:${response.errMsg} (${response.errCode})`);
16152
+ }
16153
+ if (1 === currentPage) totalCount = response.data?.totalCount ?? 0;
16154
+ const posts = response.data?.list || response.posts || response.post_list || [];
16155
+ allPosts.push(...posts);
16156
+ continueFlag = response.data?.continueFlag ?? false;
16157
+ rawKeyBuff = response.data?.lastBuff || "";
16158
+ _task.logger.info(`获取${11 === userpageType ? "视频" : "图文"}第${currentPage}页,本页${posts.length}条,累计${allPosts.length}条,continueFlag=${continueFlag}`);
16159
+ currentPage++;
16160
+ if (currentPage > 100) {
16161
+ _task.logger.warn("分页超过100页,停止请求");
16162
+ break;
16163
+ }
16164
+ }
16165
+ if (totalCount > 0 && allPosts.length !== totalCount) _task.logger.warn(`视频号分页可能不完整:期望${totalCount}条,实际${allPosts.length}条`);
16166
+ return {
16167
+ posts: allPosts,
16168
+ totalCount
16169
+ };
16170
+ }
16094
16171
  const mapPost = (item, forcePostType)=>{
16095
16172
  let imageUrl = "";
16096
16173
  if (item.desc?.media?.[0]?.thumbUrl) imageUrl = item.desc.media[0].thumbUrl;
@@ -16126,21 +16203,14 @@ async function handleShipinhaoData(_task, params) {
16126
16203
  300331,
16127
16204
  300332
16128
16205
  ];
16206
+ let combinedTotal = 0;
16129
16207
  if (needVideo) try {
16130
16208
  const videoPageUrl = "https://channels.weixin.qq.com/micro/content/post/list";
16131
- const videoResponse = await fetchPosts(pageNum, 11, videoPageUrl);
16132
- _task.logger.info(`视频号视频获取响应:${JSON.stringify(videoResponse)}`);
16133
- if (videoResponse.errCode && AUTH_ERROR_CODES.includes(videoResponse.errCode)) throw new Error(`AUTH_ERROR:${videoResponse.errMsg || "登录已失效"}`);
16134
- if (videoResponse.errCode) {
16135
- _task.logger.warn(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
16136
- throw new Error(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
16137
- }
16138
- {
16139
- const posts = videoResponse.data?.list || videoResponse.posts || videoResponse.post_list || [];
16140
- const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
16141
- allArticles.push(...videoArticles);
16142
- _task.logger.info(`视频号视频获取成功,共${videoArticles.length}条`);
16143
- }
16209
+ const { posts, totalCount } = await fetchAllPosts(11, videoPageUrl);
16210
+ _task.logger.info(`视频号视频获取响应:共${posts.length}条,totalCount=${totalCount}`);
16211
+ const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
16212
+ allArticles.push(...videoArticles);
16213
+ combinedTotal += totalCount || videoArticles.length;
16144
16214
  } catch (error) {
16145
16215
  const errMsg = error instanceof Error ? error.message : String(error);
16146
16216
  if (errMsg.startsWith("AUTH_ERROR:")) throw error;
@@ -16148,30 +16218,26 @@ async function handleShipinhaoData(_task, params) {
16148
16218
  }
16149
16219
  if (needArticle) try {
16150
16220
  const articlePageUrl = "https://channels.weixin.qq.com/micro/content/post/finderNewLifePostList";
16151
- const articleResponse = await fetchPosts(pageNum, 10, articlePageUrl);
16152
- if (articleResponse.errCode && AUTH_ERROR_CODES.includes(articleResponse.errCode)) throw new Error(`AUTH_ERROR:${articleResponse.errMsg || "登录已失效"}`);
16153
- if (articleResponse.errCode) {
16154
- _task.logger.warn(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
16155
- throw new Error(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
16156
- }
16157
- {
16158
- const posts = articleResponse.data?.list || articleResponse.posts || articleResponse.post_list || [];
16159
- const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
16160
- allArticles.push(...articleArticles);
16161
- _task.logger.info(`视频号图文获取成功,共${articleArticles.length}条`);
16162
- }
16221
+ const { posts, totalCount } = await fetchAllPosts(10, articlePageUrl);
16222
+ _task.logger.info(`视频号图文获取响应:共${posts.length}条,totalCount=${totalCount}`);
16223
+ const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
16224
+ allArticles.push(...articleArticles);
16225
+ combinedTotal += totalCount || articleArticles.length;
16163
16226
  } catch (error) {
16164
16227
  const errMsg = error instanceof Error ? error.message : String(error);
16165
16228
  if (errMsg.startsWith("AUTH_ERROR:")) throw error;
16166
16229
  _task.logger.warn(`获取视频号图文失败:${errMsg}`);
16167
16230
  }
16168
16231
  allArticles.sort((a, b)=>b.createTime - a.createTime);
16169
- _task.logger.info(`视频号数据获取成功,${JSON.stringify(allArticles)}`);
16232
+ const total = allArticles.length;
16233
+ const start = (pageNum - 1) * pageSize;
16234
+ const pageItems = allArticles.slice(start, start + pageSize);
16235
+ _task.logger.info(`视频号数据获取成功,合计${total}条,第${pageNum}页返回${pageItems.length}条`);
16170
16236
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
16171
- articleCell: allArticles,
16237
+ articleCell: pageItems,
16172
16238
  pagination: {
16173
- total: allArticles.length,
16174
- nextPage: false,
16239
+ total,
16240
+ nextPage: start + pageSize < total,
16175
16241
  pageNum,
16176
16242
  pageSize
16177
16243
  }
@@ -25525,4 +25591,4 @@ var __webpack_exports__version = package_namespaceObject.i8;
25525
25591
  export { Action, ActionCommonParamsSchema, BaijiahaoPublishParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, DouyinCheckVerifyQrCodeParamsSchema, DouyinCreateCommentReplyParamsSchema, DouyinGetCollectionParamsSchema, DouyinGetCommentListParamsSchema, DouyinGetCommentReplyListParamsSchema, DouyinGetHotParamsSchema, DouyinGetLocationParamsSchema, DouyinGetMusicByCategoryParamsSchema, DouyinGetMusicCategoryParamsSchema, DouyinGetMusicParamsSchema, DouyinGetTopicsParamsSchema, DouyinGetVerifyQrCodeParamsSchema, DouyinGetWorkListParamsSchema, DouyinPublishParamsSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, ShipinhaoCheckLinkValidateParamsSchema, ShipinhaoGetLocationParamsSchema, ShipinhaoGetMsgParamsSchema, ShipinhaoPublishParamsSchema, ShipinhaoSendMsgParamsSchema, ToutiaoPublishParamsSchema, UnreadCountSchema, WeixinPublishParamsSchema, WxBjhSessionParamsSchema, XhsWebSearchParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, douyinConfigDataSchema, getFileState, reportLogger, rpaAction_Server_Mock, shipinhaoConfigDataSchema, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
25526
25592
 
25527
25593
  //# sourceMappingURL=index.mjs.map
25528
- //# debugId=8b4e45ee-5a8e-53e3-b9eb-aaddbf5aef36
25594
+ //# debugId=108ecd30-8541-54e3-aef4-897782dc7b9b