@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/actions/common/FansTool/index.d.ts +19 -0
- package/dist/actions/toutiaoPublish/index.d.ts +1 -0
- package/dist/bundle.js +158 -25
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +158 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +158 -25
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +21 -5
- package/dist/utils/index.d.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CommonAction } from "@iflyrpa/share";
|
|
2
|
+
import type { ActiomCommonParams, Toutiao, Xiaohongshu, Weixin, BaiJiaHao } from "../../../types";
|
|
3
|
+
export interface GetTTFansSearchParams extends ActiomCommonParams {
|
|
4
|
+
}
|
|
5
|
+
export type ttSearchAction = CommonAction<GetTTFansSearchParams, Toutiao.FansCount>;
|
|
6
|
+
export interface GetXhsFansSearchParams extends ActiomCommonParams {
|
|
7
|
+
}
|
|
8
|
+
export type xhsSearchAction = CommonAction<GetXhsFansSearchParams, Xiaohongshu.FansCount>;
|
|
9
|
+
export interface GetWxFansSearchParams extends ActiomCommonParams {
|
|
10
|
+
token: string | number;
|
|
11
|
+
}
|
|
12
|
+
export type wxSearchAction = CommonAction<GetWxFansSearchParams, Weixin.FansCount>;
|
|
13
|
+
export interface GetBjhFansSearchParams extends ActiomCommonParams {
|
|
14
|
+
}
|
|
15
|
+
export type bjhSearchAction = CommonAction<GetBjhFansSearchParams, BaiJiaHao.FansCount>;
|
|
16
|
+
export declare const TTFansExport: ttSearchAction;
|
|
17
|
+
export declare const XhsFansExport: xhsSearchAction;
|
|
18
|
+
export declare const WxFansExport: wxSearchAction;
|
|
19
|
+
export declare const BjhFansExport: bjhSearchAction;
|
package/dist/bundle.js
CHANGED
|
@@ -14064,6 +14064,22 @@ var __webpack_exports__ = {};
|
|
|
14064
14064
|
parser.end();
|
|
14065
14065
|
return srcList;
|
|
14066
14066
|
};
|
|
14067
|
+
class TimeFormatter {
|
|
14068
|
+
static format(timestamp, formatStr = 'yyyy-MM-dd hh:mm') {
|
|
14069
|
+
if ('number' == typeof timestamp && 10 === timestamp.toString().length) timestamp *= 1000;
|
|
14070
|
+
const date = new Date(timestamp);
|
|
14071
|
+
const map = {
|
|
14072
|
+
yyyy: String(date.getFullYear()),
|
|
14073
|
+
yy: String(date.getFullYear()).slice(-2),
|
|
14074
|
+
MM: String(date.getMonth() + 1).padStart(2, '0'),
|
|
14075
|
+
dd: String(date.getDate()).padStart(2, '0'),
|
|
14076
|
+
hh: String(date.getHours()).padStart(2, '0'),
|
|
14077
|
+
mm: String(date.getMinutes()).padStart(2, '0'),
|
|
14078
|
+
ss: String(date.getSeconds()).padStart(2, '0')
|
|
14079
|
+
};
|
|
14080
|
+
return formatStr.replace(/yyyy|yy|MM|dd|hh|mm|ss/g, (key)=>map[key]);
|
|
14081
|
+
}
|
|
14082
|
+
}
|
|
14067
14083
|
const replaceImgSrc = (html, callback)=>{
|
|
14068
14084
|
let lastedHtml = html;
|
|
14069
14085
|
const isImageTag = (node)=>"tag" === node.type && "img" === node.name;
|
|
@@ -14846,8 +14862,8 @@ var __webpack_exports__ = {};
|
|
|
14846
14862
|
trends_writing_tag: 0,
|
|
14847
14863
|
is_refute_rumor: 0,
|
|
14848
14864
|
save: "publish" === params.saveType ? 1 : 0,
|
|
14849
|
-
timer_status: 0,
|
|
14850
|
-
timer_time: "",
|
|
14865
|
+
timer_status: params.settingInfo.timer ? 1 : 0,
|
|
14866
|
+
timer_time: params.settingInfo.timer ? TimeFormatter.format(params.settingInfo.timer) : "",
|
|
14851
14867
|
title: params.title,
|
|
14852
14868
|
content: content + topicContent,
|
|
14853
14869
|
extra: JSON.stringify(extraData),
|
|
@@ -14872,30 +14888,37 @@ var __webpack_exports__ = {};
|
|
|
14872
14888
|
claim_exclusive: toutiaoOriginal.includes("exclusive") ? 1 : 0
|
|
14873
14889
|
};
|
|
14874
14890
|
const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14889
|
-
|
|
14891
|
+
let publishOption = {};
|
|
14892
|
+
if (msToken) {
|
|
14893
|
+
const postHeaders = generatorFormData({
|
|
14894
|
+
source: "mp",
|
|
14895
|
+
type: "article",
|
|
14896
|
+
aid: 1231,
|
|
14897
|
+
mp_publish_ab_val: 0,
|
|
14898
|
+
msToken: msToken
|
|
14899
|
+
});
|
|
14900
|
+
const postData = generatorFormData(publishData);
|
|
14901
|
+
let a_bogus = GenAB(postHeaders, postData);
|
|
14902
|
+
publishOption = {
|
|
14903
|
+
method: "post",
|
|
14904
|
+
url: `https://mp.toutiao.com/mp/agw/article/publish?${postHeaders}&a_bogus=${a_bogus}`,
|
|
14905
|
+
data: postData,
|
|
14906
|
+
headers: {
|
|
14907
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
14908
|
+
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
|
|
14909
|
+
},
|
|
14910
|
+
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
14911
|
+
};
|
|
14912
|
+
} else publishOption = {
|
|
14890
14913
|
method: "post",
|
|
14891
|
-
url:
|
|
14892
|
-
data:
|
|
14914
|
+
url: "https://mp.toutiao.com/mp/agw/article/publish?source=mp&type=article&aid=1",
|
|
14915
|
+
data: publishData,
|
|
14893
14916
|
headers: {
|
|
14894
|
-
"content-type": "application/x-www-form-urlencoded"
|
|
14895
|
-
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
|
|
14917
|
+
"content-type": "application/x-www-form-urlencoded"
|
|
14896
14918
|
},
|
|
14897
14919
|
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
14898
|
-
}
|
|
14920
|
+
};
|
|
14921
|
+
const publishResult = await http.api(publishOption);
|
|
14899
14922
|
return success(publishResult.data.pgc_id);
|
|
14900
14923
|
};
|
|
14901
14924
|
const rpa_rpaAction = async (task, params)=>{
|
|
@@ -15059,6 +15082,106 @@ var __webpack_exports__ = {};
|
|
|
15059
15082
|
if ("mockApi" === params.actionType) return mock_mockAction(task, params);
|
|
15060
15083
|
return executeAction(mock_mockAction, rpa_rpaAction)(task, params);
|
|
15061
15084
|
};
|
|
15085
|
+
const TTFansExport = async (_task, params)=>{
|
|
15086
|
+
const http = new Http({
|
|
15087
|
+
headers: {
|
|
15088
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15089
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
15090
|
+
}
|
|
15091
|
+
});
|
|
15092
|
+
try {
|
|
15093
|
+
const res = await http.api({
|
|
15094
|
+
method: "get",
|
|
15095
|
+
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?app_id=1231",
|
|
15096
|
+
params: {
|
|
15097
|
+
app_id: 1231
|
|
15098
|
+
}
|
|
15099
|
+
});
|
|
15100
|
+
return success(0 === res.code ? {
|
|
15101
|
+
fans_count: res.total_fans_count
|
|
15102
|
+
} : {
|
|
15103
|
+
fans_count: null
|
|
15104
|
+
}, "获取粉丝数成功!");
|
|
15105
|
+
} catch (error) {
|
|
15106
|
+
return success({
|
|
15107
|
+
fans_count: null
|
|
15108
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
15109
|
+
}
|
|
15110
|
+
};
|
|
15111
|
+
const XhsFansExport = async (_task, params)=>{
|
|
15112
|
+
const http = new Http({
|
|
15113
|
+
headers: {
|
|
15114
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15115
|
+
referer: "https://creator.xiaohongshu.com/new/home?source=official"
|
|
15116
|
+
}
|
|
15117
|
+
});
|
|
15118
|
+
try {
|
|
15119
|
+
const res = await http.api({
|
|
15120
|
+
method: "get",
|
|
15121
|
+
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
15122
|
+
});
|
|
15123
|
+
return success(0 === res.result ? {
|
|
15124
|
+
fans_count: res.data.fans_count
|
|
15125
|
+
} : {
|
|
15126
|
+
fans_count: null
|
|
15127
|
+
}, "获取粉丝数成功!");
|
|
15128
|
+
} catch (error) {
|
|
15129
|
+
return success({
|
|
15130
|
+
fans_count: null
|
|
15131
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
15132
|
+
}
|
|
15133
|
+
};
|
|
15134
|
+
const WxFansExport = async (_task, params)=>{
|
|
15135
|
+
const http = new Http({
|
|
15136
|
+
headers: {
|
|
15137
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
15138
|
+
}
|
|
15139
|
+
});
|
|
15140
|
+
try {
|
|
15141
|
+
const htmlStr = await http.api({
|
|
15142
|
+
method: "get",
|
|
15143
|
+
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
15144
|
+
params: {
|
|
15145
|
+
t: "home/index",
|
|
15146
|
+
token: params.token,
|
|
15147
|
+
lang: "zh_CN"
|
|
15148
|
+
}
|
|
15149
|
+
});
|
|
15150
|
+
const match = htmlStr.match(/总用户数[\s\S]*?<mp-thousandth>(\d+)<\/mp-thousandth>/);
|
|
15151
|
+
return success(match ? {
|
|
15152
|
+
fans_count: Number(match[1])
|
|
15153
|
+
} : {
|
|
15154
|
+
fans_count: null
|
|
15155
|
+
}, "获取粉丝数成功!");
|
|
15156
|
+
} catch (error) {
|
|
15157
|
+
return success({
|
|
15158
|
+
fans_count: null
|
|
15159
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
15160
|
+
}
|
|
15161
|
+
};
|
|
15162
|
+
const BjhFansExport = async (_task, params)=>{
|
|
15163
|
+
const http = new Http({
|
|
15164
|
+
headers: {
|
|
15165
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15166
|
+
referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
15167
|
+
}
|
|
15168
|
+
});
|
|
15169
|
+
try {
|
|
15170
|
+
const res = await http.api({
|
|
15171
|
+
method: "get",
|
|
15172
|
+
url: "https://baijiahao.baidu.com/cms-ui/rights/growth/get_info"
|
|
15173
|
+
});
|
|
15174
|
+
return success(0 === res.errno ? {
|
|
15175
|
+
fans_count: res.data.total_fans
|
|
15176
|
+
} : {
|
|
15177
|
+
fans_count: null
|
|
15178
|
+
}, "获取粉丝数成功!");
|
|
15179
|
+
} catch (error) {
|
|
15180
|
+
return success({
|
|
15181
|
+
fans_count: null
|
|
15182
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
15183
|
+
}
|
|
15184
|
+
};
|
|
15062
15185
|
const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
15063
15186
|
const tmpCachePath = task.getTmpPath();
|
|
15064
15187
|
const http = new Http({
|
|
@@ -16992,9 +17115,7 @@ var __webpack_exports__ = {};
|
|
|
16992
17115
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
16993
17116
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
16994
17117
|
};
|
|
16995
|
-
var package_namespaceObject = {
|
|
16996
|
-
i8: "1.2.10"
|
|
16997
|
-
};
|
|
17118
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.11-beta.0"}');
|
|
16998
17119
|
class Action {
|
|
16999
17120
|
constructor(task){
|
|
17000
17121
|
this.task = task;
|
|
@@ -17018,6 +17139,18 @@ var __webpack_exports__ = {};
|
|
|
17018
17139
|
searchToutiaoTopicList(params) {
|
|
17019
17140
|
return this.bindTask(searchToutiaoTopicList, params);
|
|
17020
17141
|
}
|
|
17142
|
+
TTFansExport(params) {
|
|
17143
|
+
return this.bindTask(TTFansExport, params);
|
|
17144
|
+
}
|
|
17145
|
+
XhsFansExport(params) {
|
|
17146
|
+
return this.bindTask(XhsFansExport, params);
|
|
17147
|
+
}
|
|
17148
|
+
WxFansExport(params) {
|
|
17149
|
+
return this.bindTask(WxFansExport, params);
|
|
17150
|
+
}
|
|
17151
|
+
BjhFansExport(params) {
|
|
17152
|
+
return this.bindTask(BjhFansExport, params);
|
|
17153
|
+
}
|
|
17021
17154
|
getToutiaoConfig(params) {
|
|
17022
17155
|
return this.bindTask(getToutiaoConfig, params);
|
|
17023
17156
|
}
|