@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
package/dist/index.mjs
CHANGED
|
@@ -1213,6 +1213,22 @@ 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
|
+
};
|
|
1229
|
+
return formatStr.replace(/yyyy|yy|MM|dd|hh|mm|ss/g, (key)=>map[key]);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1216
1232
|
const replaceImgSrc = (html, callback)=>{
|
|
1217
1233
|
let lastedHtml = html;
|
|
1218
1234
|
const isImageTag = (node)=>"tag" === node.type && "img" === node.name;
|
|
@@ -1923,8 +1939,8 @@ const mock_mockAction = async (task, params)=>{
|
|
|
1923
1939
|
trends_writing_tag: 0,
|
|
1924
1940
|
is_refute_rumor: 0,
|
|
1925
1941
|
save: "publish" === params.saveType ? 1 : 0,
|
|
1926
|
-
timer_status: 0,
|
|
1927
|
-
timer_time: "",
|
|
1942
|
+
timer_status: params.settingInfo.timer ? 1 : 0,
|
|
1943
|
+
timer_time: params.settingInfo.timer ? TimeFormatter.format(params.settingInfo.timer) : "",
|
|
1928
1944
|
title: params.title,
|
|
1929
1945
|
content: content + topicContent,
|
|
1930
1946
|
extra: JSON.stringify(extraData),
|
|
@@ -1949,30 +1965,37 @@ const mock_mockAction = async (task, params)=>{
|
|
|
1949
1965
|
claim_exclusive: toutiaoOriginal.includes("exclusive") ? 1 : 0
|
|
1950
1966
|
};
|
|
1951
1967
|
const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1968
|
+
let publishOption = {};
|
|
1969
|
+
if (msToken) {
|
|
1970
|
+
const postHeaders = generatorFormData({
|
|
1971
|
+
source: "mp",
|
|
1972
|
+
type: "article",
|
|
1973
|
+
aid: 1231,
|
|
1974
|
+
mp_publish_ab_val: 0,
|
|
1975
|
+
msToken: msToken
|
|
1976
|
+
});
|
|
1977
|
+
const postData = generatorFormData(publishData);
|
|
1978
|
+
let a_bogus = GenAB(postHeaders, postData);
|
|
1979
|
+
publishOption = {
|
|
1980
|
+
method: "post",
|
|
1981
|
+
url: `https://mp.toutiao.com/mp/agw/article/publish?${postHeaders}&a_bogus=${a_bogus}`,
|
|
1982
|
+
data: postData,
|
|
1983
|
+
headers: {
|
|
1984
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
1985
|
+
"user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
|
|
1986
|
+
},
|
|
1987
|
+
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
1988
|
+
};
|
|
1989
|
+
} else publishOption = {
|
|
1967
1990
|
method: "post",
|
|
1968
|
-
url:
|
|
1969
|
-
data:
|
|
1991
|
+
url: "https://mp.toutiao.com/mp/agw/article/publish?source=mp&type=article&aid=1",
|
|
1992
|
+
data: publishData,
|
|
1970
1993
|
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"
|
|
1994
|
+
"content-type": "application/x-www-form-urlencoded"
|
|
1973
1995
|
},
|
|
1974
1996
|
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
1975
|
-
}
|
|
1997
|
+
};
|
|
1998
|
+
const publishResult = await http.api(publishOption);
|
|
1976
1999
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data.pgc_id);
|
|
1977
2000
|
};
|
|
1978
2001
|
const rpa_rpaAction = async (task, params)=>{
|
|
@@ -2136,6 +2159,106 @@ const toutiaoPublish = async (task, params)=>{
|
|
|
2136
2159
|
if ("mockApi" === params.actionType) return mock_mockAction(task, params);
|
|
2137
2160
|
return executeAction(mock_mockAction, rpa_rpaAction)(task, params);
|
|
2138
2161
|
};
|
|
2162
|
+
const TTFansExport = async (_task, params)=>{
|
|
2163
|
+
const http = new Http({
|
|
2164
|
+
headers: {
|
|
2165
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2166
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2167
|
+
}
|
|
2168
|
+
});
|
|
2169
|
+
try {
|
|
2170
|
+
const res = await http.api({
|
|
2171
|
+
method: "get",
|
|
2172
|
+
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?app_id=1231",
|
|
2173
|
+
params: {
|
|
2174
|
+
app_id: 1231
|
|
2175
|
+
}
|
|
2176
|
+
});
|
|
2177
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.code ? {
|
|
2178
|
+
fans_count: res.total_fans_count
|
|
2179
|
+
} : {
|
|
2180
|
+
fans_count: null
|
|
2181
|
+
}, "获取粉丝数成功!");
|
|
2182
|
+
} catch (error) {
|
|
2183
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2184
|
+
fans_count: null
|
|
2185
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2186
|
+
}
|
|
2187
|
+
};
|
|
2188
|
+
const XhsFansExport = async (_task, params)=>{
|
|
2189
|
+
const http = new Http({
|
|
2190
|
+
headers: {
|
|
2191
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2192
|
+
referer: "https://creator.xiaohongshu.com/new/home?source=official"
|
|
2193
|
+
}
|
|
2194
|
+
});
|
|
2195
|
+
try {
|
|
2196
|
+
const res = await http.api({
|
|
2197
|
+
method: "get",
|
|
2198
|
+
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
2199
|
+
});
|
|
2200
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.result ? {
|
|
2201
|
+
fans_count: res.data.fans_count
|
|
2202
|
+
} : {
|
|
2203
|
+
fans_count: null
|
|
2204
|
+
}, "获取粉丝数成功!");
|
|
2205
|
+
} catch (error) {
|
|
2206
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2207
|
+
fans_count: null
|
|
2208
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2209
|
+
}
|
|
2210
|
+
};
|
|
2211
|
+
const WxFansExport = async (_task, params)=>{
|
|
2212
|
+
const http = new Http({
|
|
2213
|
+
headers: {
|
|
2214
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2215
|
+
}
|
|
2216
|
+
});
|
|
2217
|
+
try {
|
|
2218
|
+
const htmlStr = await http.api({
|
|
2219
|
+
method: "get",
|
|
2220
|
+
url: "https://mp.weixin.qq.com/cgi-bin/home",
|
|
2221
|
+
params: {
|
|
2222
|
+
t: "home/index",
|
|
2223
|
+
token: params.token,
|
|
2224
|
+
lang: "zh_CN"
|
|
2225
|
+
}
|
|
2226
|
+
});
|
|
2227
|
+
const match = htmlStr.match(/总用户数[\s\S]*?<mp-thousandth>(\d+)<\/mp-thousandth>/);
|
|
2228
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(match ? {
|
|
2229
|
+
fans_count: Number(match[1])
|
|
2230
|
+
} : {
|
|
2231
|
+
fans_count: null
|
|
2232
|
+
}, "获取粉丝数成功!");
|
|
2233
|
+
} catch (error) {
|
|
2234
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2235
|
+
fans_count: null
|
|
2236
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2237
|
+
}
|
|
2238
|
+
};
|
|
2239
|
+
const BjhFansExport = async (_task, params)=>{
|
|
2240
|
+
const http = new Http({
|
|
2241
|
+
headers: {
|
|
2242
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2243
|
+
referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
2244
|
+
}
|
|
2245
|
+
});
|
|
2246
|
+
try {
|
|
2247
|
+
const res = await http.api({
|
|
2248
|
+
method: "get",
|
|
2249
|
+
url: "https://baijiahao.baidu.com/cms-ui/rights/growth/get_info"
|
|
2250
|
+
});
|
|
2251
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === res.errno ? {
|
|
2252
|
+
fans_count: res.data.total_fans
|
|
2253
|
+
} : {
|
|
2254
|
+
fans_count: null
|
|
2255
|
+
}, "获取粉丝数成功!");
|
|
2256
|
+
} catch (error) {
|
|
2257
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
2258
|
+
fans_count: null
|
|
2259
|
+
}, "获取粉丝数失败,请检查登陆有效性!");
|
|
2260
|
+
}
|
|
2261
|
+
};
|
|
2139
2262
|
const weitoutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
2140
2263
|
const tmpCachePath = task.getTmpPath();
|
|
2141
2264
|
const http = new Http({
|
|
@@ -4066,9 +4189,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
4066
4189
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
4067
4190
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
4068
4191
|
};
|
|
4069
|
-
var package_namespaceObject = {
|
|
4070
|
-
i8: "1.2.10"
|
|
4071
|
-
};
|
|
4192
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.11-beta.0"}');
|
|
4072
4193
|
class Action {
|
|
4073
4194
|
constructor(task){
|
|
4074
4195
|
this.task = task;
|
|
@@ -4092,6 +4213,18 @@ class Action {
|
|
|
4092
4213
|
searchToutiaoTopicList(params) {
|
|
4093
4214
|
return this.bindTask(searchToutiaoTopicList, params);
|
|
4094
4215
|
}
|
|
4216
|
+
TTFansExport(params) {
|
|
4217
|
+
return this.bindTask(TTFansExport, params);
|
|
4218
|
+
}
|
|
4219
|
+
XhsFansExport(params) {
|
|
4220
|
+
return this.bindTask(XhsFansExport, params);
|
|
4221
|
+
}
|
|
4222
|
+
WxFansExport(params) {
|
|
4223
|
+
return this.bindTask(WxFansExport, params);
|
|
4224
|
+
}
|
|
4225
|
+
BjhFansExport(params) {
|
|
4226
|
+
return this.bindTask(BjhFansExport, params);
|
|
4227
|
+
}
|
|
4095
4228
|
getToutiaoConfig(params) {
|
|
4096
4229
|
return this.bindTask(getToutiaoConfig, params);
|
|
4097
4230
|
}
|