@iflyrpa/actions 1.2.11-beta.0 → 1.2.11-beta.1

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.d.ts CHANGED
@@ -4,8 +4,12 @@ import { type GetBaijiahaoActivityParams } from "./actions/getBaijiahaoActivity"
4
4
  import { type GetToutiaoConfigParams } from "./actions/getToutiaoConfig";
5
5
  import { type SearchToutiaoTopicListParams } from "./actions/searchToutiaoTopicList";
6
6
  import { type searchXiaohongshuLocationParams } from "./actions/searchXiaohongshuLocation";
7
- import { SearchXiaohongshuTopicListParams } from "./actions/searchXiaohongshuTopicList";
7
+ import { type SearchXiaohongshuTopicListParams } from "./actions/searchXiaohongshuTopicList";
8
8
  import { type ToutiaoPublishParams } from "./actions/toutiaoPublish";
9
+ import { type GetTTFansSearchParams } from "./actions/common/FansTool";
10
+ import { type GetBjhFansSearchParams } from "./actions/common/FansTool";
11
+ import { type GetWxFansSearchParams } from "./actions/common/FansTool";
12
+ import { type GetXhsFansSearchParams } from "./actions/common/FansTool";
9
13
  import { type WeitoutiaoPublishParams } from "./actions/weitoutiaoPublish";
10
14
  import { type WeixinPublishParams } from "./actions/weixinPublish";
11
15
  import { type WeixinmpPublishParams } from "./actions/weixinmpPublish";
@@ -15,6 +19,10 @@ export declare class Action {
15
19
  constructor(task: AutomateTask);
16
20
  private bindTask;
17
21
  searchToutiaoTopicList(params: SearchToutiaoTopicListParams): Promise<ResponseData<import("./types").Toutiao.Topic[]>>;
22
+ TTFansExport(params: GetTTFansSearchParams): Promise<ResponseData<import("./types").Toutiao.FansCount>>;
23
+ XhsFansExport(params: GetXhsFansSearchParams): Promise<ResponseData<import("./types").Xiaohongshu.FansCount>>;
24
+ WxFansExport(params: GetWxFansSearchParams): Promise<ResponseData<import("./types").Weixin.FansCount>>;
25
+ BjhFansExport(params: GetBjhFansSearchParams): Promise<ResponseData<import("./types").BaiJiaHao.FansCount>>;
18
26
  getToutiaoConfig(params: GetToutiaoConfigParams): Promise<ResponseData<import("./actions/getToutiaoConfig").GetToutiaoConfigResult>>;
19
27
  baijiahaoPublish(params: BaijiahaoPublishParams): Promise<ResponseData<string>>;
20
28
  getBaijiahaoActivity(params: GetBaijiahaoActivityParams): Promise<ResponseData<import("./actions/getBaijiahaoActivity").ActivityData[]>>;
package/dist/index.js CHANGED
@@ -1258,6 +1258,22 @@ var __webpack_exports__ = {};
1258
1258
  parser.end();
1259
1259
  return srcList;
1260
1260
  };
1261
+ class TimeFormatter {
1262
+ static format(timestamp, formatStr = 'yyyy-MM-dd hh:mm') {
1263
+ if ('number' == typeof timestamp && 10 === timestamp.toString().length) timestamp *= 1000;
1264
+ const date = new Date(timestamp);
1265
+ const map = {
1266
+ yyyy: String(date.getFullYear()),
1267
+ yy: String(date.getFullYear()).slice(-2),
1268
+ MM: String(date.getMonth() + 1).padStart(2, '0'),
1269
+ dd: String(date.getDate()).padStart(2, '0'),
1270
+ hh: String(date.getHours()).padStart(2, '0'),
1271
+ mm: String(date.getMinutes()).padStart(2, '0'),
1272
+ ss: String(date.getSeconds()).padStart(2, '0')
1273
+ };
1274
+ return formatStr.replace(/yyyy|yy|MM|dd|hh|mm|ss/g, (key)=>map[key]);
1275
+ }
1276
+ }
1261
1277
  const replaceImgSrc = (html, callback)=>{
1262
1278
  let lastedHtml = html;
1263
1279
  const isImageTag = (node)=>"tag" === node.type && "img" === node.name;
@@ -1971,8 +1987,8 @@ var __webpack_exports__ = {};
1971
1987
  trends_writing_tag: 0,
1972
1988
  is_refute_rumor: 0,
1973
1989
  save: "publish" === params.saveType ? 1 : 0,
1974
- timer_status: 0,
1975
- timer_time: "",
1990
+ timer_status: params.settingInfo.timer ? 1 : 0,
1991
+ timer_time: params.settingInfo.timer ? TimeFormatter.format(params.settingInfo.timer) : "",
1976
1992
  title: params.title,
1977
1993
  content: content + topicContent,
1978
1994
  extra: JSON.stringify(extraData),
@@ -1997,30 +2013,37 @@ var __webpack_exports__ = {};
1997
2013
  claim_exclusive: toutiaoOriginal.includes("exclusive") ? 1 : 0
1998
2014
  };
1999
2015
  const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
2000
- if (!msToken) return {
2001
- code: 200,
2002
- message: "账号数据异常,请重新绑定账号后重试。",
2003
- data: ""
2004
- };
2005
- const postHeaders = generatorFormData({
2006
- source: "mp",
2007
- type: "article",
2008
- aid: 1231,
2009
- mp_publish_ab_val: 0,
2010
- msToken: msToken
2011
- });
2012
- const postData = generatorFormData(publishData);
2013
- let a_bogus = GenAB(postHeaders, postData);
2014
- const publishResult = await http.api({
2016
+ let publishOption = {};
2017
+ if (msToken) {
2018
+ const postHeaders = generatorFormData({
2019
+ source: "mp",
2020
+ type: "article",
2021
+ aid: 1231,
2022
+ mp_publish_ab_val: 0,
2023
+ msToken: msToken
2024
+ });
2025
+ const postData = generatorFormData(publishData);
2026
+ let a_bogus = GenAB(postHeaders, postData);
2027
+ publishOption = {
2028
+ method: "post",
2029
+ url: `https://mp.toutiao.com/mp/agw/article/publish?${postHeaders}&a_bogus=${a_bogus}`,
2030
+ data: postData,
2031
+ headers: {
2032
+ "content-type": "application/x-www-form-urlencoded",
2033
+ "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
2034
+ },
2035
+ defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
2036
+ };
2037
+ } else publishOption = {
2015
2038
  method: "post",
2016
- url: `https://mp.toutiao.com/mp/agw/article/publish?${postHeaders}&a_bogus=${a_bogus}`,
2017
- data: postData,
2039
+ url: "https://mp.toutiao.com/mp/agw/article/publish?source=mp&type=article&aid=1",
2040
+ data: publishData,
2018
2041
  headers: {
2019
- "content-type": "application/x-www-form-urlencoded",
2020
- "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
2042
+ "content-type": "application/x-www-form-urlencoded"
2021
2043
  },
2022
2044
  defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
2023
- });
2045
+ };
2046
+ const publishResult = await http.api(publishOption);
2024
2047
  return (0, share_namespaceObject.success)(publishResult.data.pgc_id);
2025
2048
  };
2026
2049
  const rpa_rpaAction = async (task, params)=>{
@@ -2184,6 +2207,106 @@ var __webpack_exports__ = {};
2184
2207
  if ("mockApi" === params.actionType) return mock_mockAction(task, params);
2185
2208
  return executeAction(mock_mockAction, rpa_rpaAction)(task, params);
2186
2209
  };
2210
+ const TTFansExport = async (_task, params)=>{
2211
+ const http = new Http({
2212
+ headers: {
2213
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2214
+ referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
2215
+ }
2216
+ });
2217
+ try {
2218
+ const res = await http.api({
2219
+ method: "get",
2220
+ url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?app_id=1231",
2221
+ params: {
2222
+ app_id: 1231
2223
+ }
2224
+ });
2225
+ return (0, share_namespaceObject.success)(0 === res.code ? {
2226
+ fans_count: res.total_fans_count
2227
+ } : {
2228
+ fans_count: null
2229
+ }, "获取粉丝数成功!");
2230
+ } catch (error) {
2231
+ return (0, share_namespaceObject.success)({
2232
+ fans_count: null
2233
+ }, "获取粉丝数失败,请检查登陆有效性!");
2234
+ }
2235
+ };
2236
+ const XhsFansExport = async (_task, params)=>{
2237
+ const http = new Http({
2238
+ headers: {
2239
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2240
+ referer: "https://creator.xiaohongshu.com/new/home?source=official"
2241
+ }
2242
+ });
2243
+ try {
2244
+ const res = await http.api({
2245
+ method: "get",
2246
+ url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
2247
+ });
2248
+ return (0, share_namespaceObject.success)(0 === res.result ? {
2249
+ fans_count: res.data.fans_count
2250
+ } : {
2251
+ fans_count: null
2252
+ }, "获取粉丝数成功!");
2253
+ } catch (error) {
2254
+ return (0, share_namespaceObject.success)({
2255
+ fans_count: null
2256
+ }, "获取粉丝数失败,请检查登陆有效性!");
2257
+ }
2258
+ };
2259
+ const WxFansExport = async (_task, params)=>{
2260
+ const http = new Http({
2261
+ headers: {
2262
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
2263
+ }
2264
+ });
2265
+ try {
2266
+ const htmlStr = await http.api({
2267
+ method: "get",
2268
+ url: "https://mp.weixin.qq.com/cgi-bin/home",
2269
+ params: {
2270
+ t: "home/index",
2271
+ token: params.token,
2272
+ lang: "zh_CN"
2273
+ }
2274
+ });
2275
+ const match = htmlStr.match(/总用户数[\s\S]*?<mp-thousandth>(\d+)<\/mp-thousandth>/);
2276
+ return (0, share_namespaceObject.success)(match ? {
2277
+ fans_count: Number(match[1])
2278
+ } : {
2279
+ fans_count: null
2280
+ }, "获取粉丝数成功!");
2281
+ } catch (error) {
2282
+ return (0, share_namespaceObject.success)({
2283
+ fans_count: null
2284
+ }, "获取粉丝数失败,请检查登陆有效性!");
2285
+ }
2286
+ };
2287
+ const BjhFansExport = async (_task, params)=>{
2288
+ const http = new Http({
2289
+ headers: {
2290
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
2291
+ referer: "https://baijiahao.baidu.com/builder/rc/home"
2292
+ }
2293
+ });
2294
+ try {
2295
+ const res = await http.api({
2296
+ method: "get",
2297
+ url: "https://baijiahao.baidu.com/cms-ui/rights/growth/get_info"
2298
+ });
2299
+ return (0, share_namespaceObject.success)(0 === res.errno ? {
2300
+ fans_count: res.data.total_fans
2301
+ } : {
2302
+ fans_count: null
2303
+ }, "获取粉丝数成功!");
2304
+ } catch (error) {
2305
+ return (0, share_namespaceObject.success)({
2306
+ fans_count: null
2307
+ }, "获取粉丝数失败,请检查登陆有效性!");
2308
+ }
2309
+ };
2187
2310
  const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
2188
2311
  const tmpCachePath = task.getTmpPath();
2189
2312
  const http = new Http({
@@ -4117,9 +4240,7 @@ var __webpack_exports__ = {};
4117
4240
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
4118
4241
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
4119
4242
  };
4120
- var package_namespaceObject = {
4121
- i8: "1.2.10"
4122
- };
4243
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.11-beta.0"}');
4123
4244
  class Action {
4124
4245
  constructor(task){
4125
4246
  this.task = task;
@@ -4143,6 +4264,18 @@ var __webpack_exports__ = {};
4143
4264
  searchToutiaoTopicList(params) {
4144
4265
  return this.bindTask(searchToutiaoTopicList, params);
4145
4266
  }
4267
+ TTFansExport(params) {
4268
+ return this.bindTask(TTFansExport, params);
4269
+ }
4270
+ XhsFansExport(params) {
4271
+ return this.bindTask(XhsFansExport, params);
4272
+ }
4273
+ WxFansExport(params) {
4274
+ return this.bindTask(WxFansExport, params);
4275
+ }
4276
+ BjhFansExport(params) {
4277
+ return this.bindTask(BjhFansExport, params);
4278
+ }
4146
4279
  getToutiaoConfig(params) {
4147
4280
  return this.bindTask(getToutiaoConfig, params);
4148
4281
  }