@iflyrpa/actions 1.2.24-beta.1 → 1.2.24-beta.10
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 +39 -29
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +39 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -29
- package/dist/index.mjs.map +1 -1
- package/dist/utils/http.d.ts +5 -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
|
-
url: "https://
|
|
2877
|
+
url: "https://preview.huiwen.top/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
|
return 0 === ProxyInfo.code && ProxyInfo.data.length > 0 ? new dist.HttpsProxyAgent(`http://${ProxyData.api}:${ProxyData.akey}@${ProxyInfo.data[0].proxyAddress}`) : null;
|
|
2883
2888
|
};
|
|
@@ -2890,11 +2895,12 @@ class Http {
|
|
|
2890
2895
|
data: error
|
|
2891
2896
|
};
|
|
2892
2897
|
}
|
|
2893
|
-
constructor(config, adr){
|
|
2898
|
+
constructor(config, adr, huiwenToken){
|
|
2894
2899
|
this.apiClient = __WEBPACK_EXTERNAL_MODULE_axios__["default"].create({
|
|
2895
2900
|
...config
|
|
2896
2901
|
});
|
|
2897
2902
|
this.adr = adr;
|
|
2903
|
+
this.heiwenToken = huiwenToken;
|
|
2898
2904
|
}
|
|
2899
2905
|
addResponseInterceptor(findError) {
|
|
2900
2906
|
this.apiClient.interceptors.response.use((response)=>{
|
|
@@ -2928,11 +2934,12 @@ class Http {
|
|
|
2928
2934
|
}
|
|
2929
2935
|
async api(config) {
|
|
2930
2936
|
try {
|
|
2931
|
-
const agent = this.adr ? await ProxyAgent(this.adr) : void 0;
|
|
2937
|
+
const agent = this.adr ? await ProxyAgent(this.adr, this.heiwenToken) : void 0;
|
|
2932
2938
|
if (this.adr && null == agent) return Promise.reject({
|
|
2933
2939
|
code: 200,
|
|
2934
|
-
message: "
|
|
2940
|
+
message: "当前发文IP地址暂不支持!"
|
|
2935
2941
|
});
|
|
2942
|
+
this.proxyInfo = agent?.proxy.host;
|
|
2936
2943
|
const response = await this.apiClient({
|
|
2937
2944
|
...config,
|
|
2938
2945
|
...agent ? {
|
|
@@ -3289,9 +3296,9 @@ const mockAction = async (task, params)=>{
|
|
|
3289
3296
|
const isDraft = "draft" === params.saveType;
|
|
3290
3297
|
const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
|
|
3291
3298
|
task._timerRecord['PrePublish'] = Date.now();
|
|
3292
|
-
const proxyHttp = new Http({
|
|
3299
|
+
const proxyHttp = task?.isBeta ?? false ? new Http({
|
|
3293
3300
|
headers
|
|
3294
|
-
}, params.proxyLoc);
|
|
3301
|
+
}, params.proxyLoc, params.huiwenToken) : http;
|
|
3295
3302
|
const res = await proxyHttp.api({
|
|
3296
3303
|
method: "post",
|
|
3297
3304
|
url: saveUrl,
|
|
@@ -3303,7 +3310,7 @@ const mockAction = async (task, params)=>{
|
|
|
3303
3310
|
},
|
|
3304
3311
|
defaultErrorMsg: isDraft ? "文章同步出现异常,请稍后重试。" : "文章发布出现异常,请稍后重试。"
|
|
3305
3312
|
});
|
|
3306
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(res.ret
|
|
3313
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 == res.errno ? res?.ret?.article_id || '' : "", 0 == res.errno ? `文章发布成功!` + (proxyHttp.proxyInfo || "") : res.errmsg ?? '文章发布失败,请稍后重试。');
|
|
3307
3314
|
};
|
|
3308
3315
|
const rpaAction = async (task, params)=>{
|
|
3309
3316
|
const tmpCachePath = task.getTmpPath();
|
|
@@ -4251,11 +4258,14 @@ const mock_mockAction = async (task, params)=>{
|
|
|
4251
4258
|
device_platform: "mp",
|
|
4252
4259
|
is_message: 0
|
|
4253
4260
|
},
|
|
4254
|
-
tuwen_wtt_trans_flag: "0",
|
|
4261
|
+
tuwen_wtt_trans_flag: params.settingInfo?.toutiaoTransWtt ? "2" : "0",
|
|
4255
4262
|
info_source: sourceData,
|
|
4256
4263
|
...location ? {
|
|
4257
4264
|
city: location.label,
|
|
4258
4265
|
city_code: location.value
|
|
4266
|
+
} : null,
|
|
4267
|
+
...params.settingInfo?.toutiaoCollectionId ? {
|
|
4268
|
+
want_join_collection_id: params.settingInfo.toutiaoCollectionId
|
|
4259
4269
|
} : null
|
|
4260
4270
|
};
|
|
4261
4271
|
const publishData = {
|
|
@@ -4333,11 +4343,11 @@ const mock_mockAction = async (task, params)=>{
|
|
|
4333
4343
|
},
|
|
4334
4344
|
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
4335
4345
|
};
|
|
4336
|
-
const proxyHttp = new Http({
|
|
4346
|
+
const proxyHttp = task?.isBeta ?? false ? new Http({
|
|
4337
4347
|
headers
|
|
4338
|
-
}, params.proxyLoc);
|
|
4348
|
+
}, params.proxyLoc, params.huiwenToken) : http;
|
|
4339
4349
|
const publishResult = await proxyHttp.api(publishOption);
|
|
4340
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data.pgc_id);
|
|
4350
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data.pgc_id, `文章发布成功!` + (proxyHttp.proxyInfo || ""));
|
|
4341
4351
|
};
|
|
4342
4352
|
const rpa_GenAB = __webpack_require__("./src/utils/ttABEncrypt.js");
|
|
4343
4353
|
const rpa_rpaAction = async (task, params)=>{
|
|
@@ -5290,10 +5300,10 @@ async function handleBaijiahaoData(params) {
|
|
|
5290
5300
|
}
|
|
5291
5301
|
const final = filtered.slice(0, pageSize);
|
|
5292
5302
|
const articleCell = final.map((item)=>({
|
|
5293
|
-
title: item.title,
|
|
5294
|
-
imageUrl: JSON.parse(item.cover_images)[0]
|
|
5303
|
+
title: item?.is_transfer ?? false ? item.content || "" : item.title,
|
|
5304
|
+
imageUrl: JSON.parse(item.cover_images)[0]?.src || "",
|
|
5295
5305
|
createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
|
|
5296
|
-
redirectUrl: item.url,
|
|
5306
|
+
redirectUrl: item.url || item.share_url,
|
|
5297
5307
|
recommendNum: item.rec_amount | item.forward_num,
|
|
5298
5308
|
collectNum: item.collection_amount,
|
|
5299
5309
|
readNum: item.read_amount | item.read_num,
|
|
@@ -6195,9 +6205,6 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
6195
6205
|
};
|
|
6196
6206
|
const uuid = getUuidResult.uuid;
|
|
6197
6207
|
await (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.sleep)(1000);
|
|
6198
|
-
new Http({
|
|
6199
|
-
headers
|
|
6200
|
-
}, params.proxyLoc);
|
|
6201
6208
|
const qrcodeResult = await http.api({
|
|
6202
6209
|
method: "get",
|
|
6203
6210
|
url: "https://mp.weixin.qq.com/safe/safeqrcode",
|
|
@@ -6272,7 +6279,10 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
6272
6279
|
uuid
|
|
6273
6280
|
})
|
|
6274
6281
|
});
|
|
6275
|
-
|
|
6282
|
+
const proxyHttp = task?.isBeta ?? false ? new Http({
|
|
6283
|
+
headers
|
|
6284
|
+
}, params.proxyLoc, params.huiwenToken) : http;
|
|
6285
|
+
await proxyHttp.api({
|
|
6276
6286
|
method: "post",
|
|
6277
6287
|
url: "https://mp.weixin.qq.com/cgi-bin/masssend",
|
|
6278
6288
|
params: {
|
|
@@ -6321,7 +6331,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
6321
6331
|
}),
|
|
6322
6332
|
defaultErrorMsg: params.masssend ? "文章群发异常,请尝试关闭群发或稍后重试。" : "文章发布异常,请稍后重试。"
|
|
6323
6333
|
});
|
|
6324
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId,
|
|
6334
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId, `微信公众号发布完成!` + (proxyHttp.proxyInfo || ""));
|
|
6325
6335
|
};
|
|
6326
6336
|
const waitQrcodeResultMaxTime = 2000 * scanRetryMaxCount;
|
|
6327
6337
|
const weixinPublish_rpa_rpaAction = async (task, params)=>{
|
|
@@ -7209,9 +7219,9 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
7209
7219
|
const publishXt = Date.now().toString();
|
|
7210
7220
|
const publishXs = mock_xsEncrypt.signXsPost("/web_api/sns/v2/note", a1Cookie, "xhs-pc-web", publishData);
|
|
7211
7221
|
const xscommon = GenXSCommon(a1Cookie, publishXt, publishXs);
|
|
7212
|
-
const proxyHttp = new Http({
|
|
7222
|
+
const proxyHttp = task?.isBeta ?? false ? new Http({
|
|
7213
7223
|
headers
|
|
7214
|
-
}, params.proxyLoc);
|
|
7224
|
+
}, params.proxyLoc, params.huiwenToken) : http;
|
|
7215
7225
|
task._timerRecord['PrePublish'] = Date.now();
|
|
7216
7226
|
const publishResult = await proxyHttp.api({
|
|
7217
7227
|
method: "post",
|
|
@@ -7224,7 +7234,7 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
7224
7234
|
},
|
|
7225
7235
|
defaultErrorMsg: "文章发布异常,请稍后重试。"
|
|
7226
7236
|
});
|
|
7227
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data?.id);
|
|
7237
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data?.id, `文章发布成功!` + (proxyHttp.proxyInfo || ""));
|
|
7228
7238
|
};
|
|
7229
7239
|
const rpa_GenXSCommon = __webpack_require__("./src/utils/XhsXsCommonEnc.js");
|
|
7230
7240
|
const rpa_xsEncrypt = new Xhshow();
|
|
@@ -7445,7 +7455,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
7445
7455
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
7446
7456
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
7447
7457
|
};
|
|
7448
|
-
var package_namespaceObject = JSON.parse('{"i8":"1.2.24-beta.
|
|
7458
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.24-beta.9"}');
|
|
7449
7459
|
const BetaFlag = "HuiwenCanary";
|
|
7450
7460
|
class Action {
|
|
7451
7461
|
constructor(task){
|
|
@@ -7453,13 +7463,13 @@ class Action {
|
|
|
7453
7463
|
}
|
|
7454
7464
|
async bindTask(func, params) {
|
|
7455
7465
|
let responseData;
|
|
7456
|
-
this.task.isBeta = this.task.isFeatOn(BetaFlag);
|
|
7466
|
+
this.task.isBeta = this.task?.isFeatOn ? this.task?.isFeatOn(BetaFlag) : false;
|
|
7457
7467
|
this.task._timerRecord = {
|
|
7458
7468
|
ActionStart: Date.now()
|
|
7459
7469
|
};
|
|
7460
|
-
if (this.task
|
|
7461
|
-
if (this.task
|
|
7462
|
-
if (
|
|
7470
|
+
if (this.task?.setArticleId) this.task.setArticleId(params.articleId ?? "");
|
|
7471
|
+
if (this.task?.setSaveType ?? false) this.task.setSaveType(params.saveType ?? "");
|
|
7472
|
+
if (this.task?.isInitializedGB !== void 0) this.task.setGbInitType(this.task.isInitializedGB);
|
|
7463
7473
|
if ("object" == typeof params) params.cookies = params?.cookies ?? [];
|
|
7464
7474
|
try {
|
|
7465
7475
|
responseData = await func(this.task, params);
|