@iflyrpa/actions 1.2.24-beta.5 → 1.2.24-beta.7
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/toutiaoPublish/index.d.ts +2 -0
- package/dist/bundle.js +32 -23
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +32 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -23
- package/dist/index.mjs.map +1 -1
- package/dist/utils/http.d.ts +4 -3
- package/dist/utils/proxy.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2870,14 +2870,19 @@ const ProxyData = {
|
|
|
2870
2870
|
md5akey: "6ec8d333e85044b7",
|
|
2871
2871
|
akey: "91709114"
|
|
2872
2872
|
};
|
|
2873
|
-
const ProxyAgent = async (adr)=>{
|
|
2873
|
+
const ProxyAgent = async (adr, huiwenToken)=>{
|
|
2874
2874
|
const http = new Http({});
|
|
2875
2875
|
let ProxyInfo = await http.api({
|
|
2876
2876
|
method: "GET",
|
|
2877
2877
|
url: "https://fetdev.iflysec.com/api/publish/zdy/ip",
|
|
2878
2878
|
params: {
|
|
2879
2879
|
addr: adr
|
|
2880
|
-
}
|
|
2880
|
+
},
|
|
2881
|
+
...huiwenToken ? {
|
|
2882
|
+
headers: {
|
|
2883
|
+
token: huiwenToken
|
|
2884
|
+
}
|
|
2885
|
+
} : null
|
|
2881
2886
|
});
|
|
2882
2887
|
console.log("代理获取状态:", ProxyInfo.msg, "代理返回信息:", JSON.stringify(ProxyInfo.data[0]));
|
|
2883
2888
|
return 0 === ProxyInfo.code && ProxyInfo.data.length > 0 ? new dist.HttpsProxyAgent(`http://${ProxyData.api}:${ProxyData.akey}@${ProxyInfo.data[0].proxyAddress}`) : null;
|
|
@@ -2891,11 +2896,12 @@ class Http {
|
|
|
2891
2896
|
data: error
|
|
2892
2897
|
};
|
|
2893
2898
|
}
|
|
2894
|
-
constructor(config, adr){
|
|
2899
|
+
constructor(config, adr, huiwenToken){
|
|
2895
2900
|
this.apiClient = __WEBPACK_EXTERNAL_MODULE_axios__["default"].create({
|
|
2896
2901
|
...config
|
|
2897
2902
|
});
|
|
2898
2903
|
this.adr = adr;
|
|
2904
|
+
this.heiwenToken = huiwenToken;
|
|
2899
2905
|
}
|
|
2900
2906
|
addResponseInterceptor(findError) {
|
|
2901
2907
|
this.apiClient.interceptors.response.use((response)=>{
|
|
@@ -2929,10 +2935,10 @@ class Http {
|
|
|
2929
2935
|
}
|
|
2930
2936
|
async api(config) {
|
|
2931
2937
|
try {
|
|
2932
|
-
const agent = this.adr ? await ProxyAgent(this.adr) : void 0;
|
|
2938
|
+
const agent = this.adr ? await ProxyAgent(this.adr, this.heiwenToken) : void 0;
|
|
2933
2939
|
if (this.adr && null == agent) return Promise.reject({
|
|
2934
2940
|
code: 200,
|
|
2935
|
-
message: "
|
|
2941
|
+
message: "当前发文IP地址暂不支持!"
|
|
2936
2942
|
});
|
|
2937
2943
|
const response = await this.apiClient({
|
|
2938
2944
|
...config,
|
|
@@ -3299,9 +3305,9 @@ const mockAction = async (task, params)=>{
|
|
|
3299
3305
|
const isDraft = "draft" === params.saveType;
|
|
3300
3306
|
const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
|
|
3301
3307
|
task._timerRecord['PrePublish'] = Date.now();
|
|
3302
|
-
const proxyHttp = new Http({
|
|
3308
|
+
const proxyHttp = task?.isBeta ?? false ? new Http({
|
|
3303
3309
|
headers
|
|
3304
|
-
}, params.proxyLoc);
|
|
3310
|
+
}, params.proxyLoc, params.huiwenToken) : http;
|
|
3305
3311
|
const res = await proxyHttp.api({
|
|
3306
3312
|
method: "post",
|
|
3307
3313
|
url: saveUrl,
|
|
@@ -3313,7 +3319,7 @@ const mockAction = async (task, params)=>{
|
|
|
3313
3319
|
},
|
|
3314
3320
|
defaultErrorMsg: isDraft ? "文章同步出现异常,请稍后重试。" : "文章发布出现异常,请稍后重试。"
|
|
3315
3321
|
});
|
|
3316
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(res.ret
|
|
3322
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 == res.errno ? res?.ret?.article_id || '' : "", 0 == res.errno ? `文章发布成功!${res.proxyInfo ? JSON.stringify(res.proxyInfo) : null}` : res.errmsg || '文章发布失败,请稍后重试。');
|
|
3317
3323
|
};
|
|
3318
3324
|
const rpaAction = async (task, params)=>{
|
|
3319
3325
|
const tmpCachePath = task.getTmpPath();
|
|
@@ -4261,11 +4267,14 @@ const mock_mockAction = async (task, params)=>{
|
|
|
4261
4267
|
device_platform: "mp",
|
|
4262
4268
|
is_message: 0
|
|
4263
4269
|
},
|
|
4264
|
-
tuwen_wtt_trans_flag: "0",
|
|
4270
|
+
tuwen_wtt_trans_flag: params.settingInfo?.toutiaoTransWtt ? "2" : "0",
|
|
4265
4271
|
info_source: sourceData,
|
|
4266
4272
|
...location ? {
|
|
4267
4273
|
city: location.label,
|
|
4268
4274
|
city_code: location.value
|
|
4275
|
+
} : null,
|
|
4276
|
+
...params.settingInfo?.toutiaoCollectionId ? {
|
|
4277
|
+
want_join_collection_id: params.settingInfo.toutiaoCollectionId
|
|
4269
4278
|
} : null
|
|
4270
4279
|
};
|
|
4271
4280
|
const publishData = {
|
|
@@ -4343,9 +4352,9 @@ const mock_mockAction = async (task, params)=>{
|
|
|
4343
4352
|
},
|
|
4344
4353
|
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
4345
4354
|
};
|
|
4346
|
-
const proxyHttp = new Http({
|
|
4355
|
+
const proxyHttp = task?.isBeta ?? false ? new Http({
|
|
4347
4356
|
headers
|
|
4348
|
-
}, params.proxyLoc);
|
|
4357
|
+
}, params.proxyLoc, params.huiwenToken) : http;
|
|
4349
4358
|
const publishResult = await proxyHttp.api(publishOption);
|
|
4350
4359
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data.pgc_id, `文章发布成功!${JSON.stringify(publishResult.proxyInfo)}`);
|
|
4351
4360
|
};
|
|
@@ -5300,10 +5309,10 @@ async function handleBaijiahaoData(params) {
|
|
|
5300
5309
|
}
|
|
5301
5310
|
const final = filtered.slice(0, pageSize);
|
|
5302
5311
|
const articleCell = final.map((item)=>({
|
|
5303
|
-
title: item.title,
|
|
5304
|
-
imageUrl: JSON.parse(item.cover_images)[0]
|
|
5312
|
+
title: item?.is_transfer ?? false ? item.content || "" : item.title,
|
|
5313
|
+
imageUrl: JSON.parse(item.cover_images)[0]?.src || "",
|
|
5305
5314
|
createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
|
|
5306
|
-
redirectUrl: item.url,
|
|
5315
|
+
redirectUrl: item.url || item.share_url,
|
|
5307
5316
|
recommendNum: item.rec_amount | item.forward_num,
|
|
5308
5317
|
collectNum: item.collection_amount,
|
|
5309
5318
|
readNum: item.read_amount | item.read_num,
|
|
@@ -6279,9 +6288,9 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
6279
6288
|
uuid
|
|
6280
6289
|
})
|
|
6281
6290
|
});
|
|
6282
|
-
const proxyHttp = new Http({
|
|
6291
|
+
const proxyHttp = task?.isBeta ?? false ? new Http({
|
|
6283
6292
|
headers
|
|
6284
|
-
}, params.proxyLoc);
|
|
6293
|
+
}, params.proxyLoc, params.huiwenToken) : http;
|
|
6285
6294
|
const massData = await proxyHttp.api({
|
|
6286
6295
|
method: "post",
|
|
6287
6296
|
url: "https://mp.weixin.qq.com/cgi-bin/masssend",
|
|
@@ -7219,9 +7228,9 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
7219
7228
|
const publishXt = Date.now().toString();
|
|
7220
7229
|
const publishXs = mock_xsEncrypt.signXsPost("/web_api/sns/v2/note", a1Cookie, "xhs-pc-web", publishData);
|
|
7221
7230
|
const xscommon = GenXSCommon(a1Cookie, publishXt, publishXs);
|
|
7222
|
-
const proxyHttp = new Http({
|
|
7231
|
+
const proxyHttp = task?.isBeta ?? false ? new Http({
|
|
7223
7232
|
headers
|
|
7224
|
-
}, params.proxyLoc);
|
|
7233
|
+
}, params.proxyLoc, params.huiwenToken) : http;
|
|
7225
7234
|
task._timerRecord['PrePublish'] = Date.now();
|
|
7226
7235
|
const publishResult = await proxyHttp.api({
|
|
7227
7236
|
method: "post",
|
|
@@ -7455,7 +7464,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
7455
7464
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
7456
7465
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
7457
7466
|
};
|
|
7458
|
-
var package_namespaceObject = JSON.parse('{"i8":"1.2.24-beta.
|
|
7467
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.24-beta.6"}');
|
|
7459
7468
|
const BetaFlag = "HuiwenCanary";
|
|
7460
7469
|
class Action {
|
|
7461
7470
|
constructor(task){
|
|
@@ -7463,13 +7472,13 @@ class Action {
|
|
|
7463
7472
|
}
|
|
7464
7473
|
async bindTask(func, params) {
|
|
7465
7474
|
let responseData;
|
|
7466
|
-
this.task.isBeta = this.task.isFeatOn(BetaFlag);
|
|
7475
|
+
this.task.isBeta = this.task?.isFeatOn ? this.task?.isFeatOn(BetaFlag) : false;
|
|
7467
7476
|
this.task._timerRecord = {
|
|
7468
7477
|
ActionStart: Date.now()
|
|
7469
7478
|
};
|
|
7470
|
-
if (this.task
|
|
7471
|
-
if (this.task
|
|
7472
|
-
if (
|
|
7479
|
+
if (this.task?.setArticleId) this.task.setArticleId(params.articleId ?? "");
|
|
7480
|
+
if (this.task?.setSaveType ?? false) this.task.setSaveType(params.saveType ?? "");
|
|
7481
|
+
if (this.task?.isInitializedGB !== void 0) this.task.setGbInitType(this.task.isInitializedGB);
|
|
7473
7482
|
if ("object" == typeof params) params.cookies = params?.cookies ?? [];
|
|
7474
7483
|
try {
|
|
7475
7484
|
responseData = await func(this.task, params);
|