@iflyrpa/actions 4.0.4-beta.5 → 4.0.4-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/searchPublishInfo/types.d.ts +3 -0
- package/dist/bundle.js +132 -122
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +132 -122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +132 -122
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="108ecd30-8541-54e3-aef4-897782dc7b9b")}catch(e){}}();
|
|
3
1
|
import * as __WEBPACK_EXTERNAL_MODULE_crypto__ from "crypto";
|
|
4
2
|
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
5
3
|
import * as __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_package_json_58ae5f06__ from "@iflyrpa/share/package.json";
|
|
@@ -4352,7 +4350,7 @@ function __webpack_require__(moduleId) {
|
|
|
4352
4350
|
return module;
|
|
4353
4351
|
};
|
|
4354
4352
|
})();
|
|
4355
|
-
var package_namespaceObject = JSON.parse('{"i8":"4.0.4-beta.
|
|
4353
|
+
var package_namespaceObject = JSON.parse('{"i8":"4.0.4-beta.7"}');
|
|
4356
4354
|
const PROXY_CREDENTIALS = [
|
|
4357
4355
|
{
|
|
4358
4356
|
ip: "47.110.131.129",
|
|
@@ -13514,8 +13512,8 @@ const mock_mockAction = async (task, params)=>{
|
|
|
13514
13512
|
if (!response || !response.data) return;
|
|
13515
13513
|
const responseData = response.data;
|
|
13516
13514
|
if (response && responseData?.status_code && 0 !== responseData.status_code) {
|
|
13517
|
-
const errorCode = 4 === responseData.status_code ?
|
|
13518
|
-
if (4 === responseData.status_code) task.logger.warn(`[douyinPublish]
|
|
13515
|
+
const errorCode = 4 === responseData.status_code ? 590 : responseData.status_code;
|
|
13516
|
+
if (4 === responseData.status_code) task.logger.warn(`[douyinPublish] status_code:4(ticket-guard 伪装拒绝),映射为 590 触发重新签名重试。原始响应: ${JSON.stringify(responseData)}`);
|
|
13519
13517
|
return {
|
|
13520
13518
|
code: errorCode,
|
|
13521
13519
|
message: responseData.status_msg || "文章发布异常,请稍后重试。",
|
|
@@ -13582,132 +13580,141 @@ const mock_mockAction = async (task, params)=>{
|
|
|
13582
13580
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 certificate 解析失败,请重新获取后重试", "");
|
|
13583
13581
|
}
|
|
13584
13582
|
const ree_public_key = webProtectData.client_cert.replace("pub.", "");
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
|
|
13583
|
+
const MAX_SIGN_RETRIES = 3;
|
|
13584
|
+
const SIGN_RETRY_DELAY = 2000;
|
|
13585
|
+
const signAndPublish = async ()=>{
|
|
13586
|
+
let bdTicketGuardClientData;
|
|
13587
|
+
try {
|
|
13588
|
+
bdTicketGuardClientData = getBdV2({
|
|
13589
|
+
ticket,
|
|
13590
|
+
ts_sign: ts_sign,
|
|
13591
|
+
ec_privateKey: ec_privateKey,
|
|
13592
|
+
certificate: certificate,
|
|
13593
|
+
bd_ticket_guard_ree_public_key: ree_public_key
|
|
13594
|
+
});
|
|
13595
|
+
if (!bdTicketGuardClientData || !bdTicketGuardClientData["headers_bd_ticket_guard_client_data"]) {
|
|
13596
|
+
task.logger.error(`[douyinPublish] bdTicketGuardClientData 生成失败或不完整: ${JSON.stringify(bdTicketGuardClientData)}`);
|
|
13597
|
+
throw (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 bdTicketGuardClientData 生成失败,请重新获取后重试", "");
|
|
13598
|
+
}
|
|
13599
|
+
} catch (error) {
|
|
13600
|
+
if (error && "object" == typeof error && "code" in error) throw error;
|
|
13601
|
+
task.logger.error(`[douyinPublish] 生成 bdTicketGuardClientData 失败: ${error}`);
|
|
13602
|
+
throw (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 bdTicketGuardClientData 生成异常,请重新获取后重试", "");
|
|
13597
13603
|
}
|
|
13598
|
-
|
|
13599
|
-
|
|
13600
|
-
|
|
13601
|
-
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
13605
|
-
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13604
|
+
task.logger.info("[douyinPublish] bdTicketGuardClientData 生成成功");
|
|
13605
|
+
const publishQuery = {
|
|
13606
|
+
...publishParams,
|
|
13607
|
+
a_bogus: ""
|
|
13608
|
+
};
|
|
13609
|
+
const queryString = new URLSearchParams(publishQuery).toString();
|
|
13610
|
+
let aBogus;
|
|
13611
|
+
try {
|
|
13612
|
+
aBogus = mock_getABogus(`https://creator.douyin.com/web/api/media/aweme/create_v2/?${queryString}`, publishData, userAgent);
|
|
13613
|
+
if (!aBogus || aBogus.length < 10) {
|
|
13614
|
+
task.logger.error(`[douyinPublish] a_bogus 生成异常,长度过短: ${aBogus}`);
|
|
13615
|
+
throw (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 a_bogus 生成失败,请重试", "");
|
|
13616
|
+
}
|
|
13617
|
+
} catch (error) {
|
|
13618
|
+
if (error && "object" == typeof error && "code" in error) throw error;
|
|
13619
|
+
task.logger.error(`[douyinPublish] 生成 a_bogus 失败: ${error}`);
|
|
13620
|
+
throw (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 a_bogus 生成异常,请重试", "");
|
|
13614
13621
|
}
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13622
|
+
publishQuery.a_bogus = aBogus;
|
|
13623
|
+
const publishQueryParams = new URLSearchParams(publishQuery).toString();
|
|
13624
|
+
let csrfToken;
|
|
13625
|
+
try {
|
|
13626
|
+
csrfToken = mock_generateCsrfTokenAdvanced({
|
|
13627
|
+
cookies: params.cookies,
|
|
13628
|
+
url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
|
|
13629
|
+
method: "POST",
|
|
13630
|
+
userAgent
|
|
13631
|
+
});
|
|
13632
|
+
if (!csrfToken || csrfToken.length < 10) {
|
|
13633
|
+
task.logger.error(`[douyinPublish] csrfToken 生成异常,长度过短: ${csrfToken}`);
|
|
13634
|
+
throw (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 csrfToken 生成失败,请重试", "");
|
|
13635
|
+
}
|
|
13636
|
+
task.logger.info(`[douyinPublish] csrfToken 生成成功: ${csrfToken.substring(0, 20)}...`);
|
|
13637
|
+
} catch (error) {
|
|
13638
|
+
if (error && "object" == typeof error && "code" in error) throw error;
|
|
13639
|
+
task.logger.error(`[douyinPublish] 生成 csrfToken 失败: ${error}`);
|
|
13640
|
+
throw (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 csrfToken 生成异常,请重试", "");
|
|
13632
13641
|
}
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
|
|
13657
|
-
"x-tt-session-dtrait": sessionDtrait || ""
|
|
13658
|
-
})}`);
|
|
13659
|
-
task.logger.info(`[douyinPublish] url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
|
|
13660
|
-
let publishResult;
|
|
13661
|
-
try {
|
|
13662
|
-
publishResult = await proxyHttp.api({
|
|
13642
|
+
let sessionDtrait;
|
|
13643
|
+
try {
|
|
13644
|
+
sessionDtrait = mock_generateDtrait("/web/api/media/aweme/create_v2/");
|
|
13645
|
+
task.logger.info(`[douyinPublish] sessionDtrait 生成成功: ${sessionDtrait || "(空)"}`);
|
|
13646
|
+
} catch (error) {
|
|
13647
|
+
task.logger.error(`[douyinPublish] 生成 sessionDtrait 失败: ${error}`);
|
|
13648
|
+
throw (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 sessionDtrait 生成异常,请重试", "");
|
|
13649
|
+
}
|
|
13650
|
+
const requestHeaders = {
|
|
13651
|
+
...headers,
|
|
13652
|
+
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
13653
|
+
"Content-Type": "application/json",
|
|
13654
|
+
Accept: "application/json, text/plain, */*",
|
|
13655
|
+
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
13656
|
+
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
13657
|
+
"bd-ticket-guard-version": "2",
|
|
13658
|
+
"bd-ticket-guard-web-sign-type": "1",
|
|
13659
|
+
"bd-ticket-guard-web-version": "2",
|
|
13660
|
+
"x-secsdk-csrf-token": csrfToken,
|
|
13661
|
+
"x-tt-session-dtrait": sessionDtrait || ""
|
|
13662
|
+
};
|
|
13663
|
+
task.logger.info(`[douyinPublish] headers: ${JSON.stringify(requestHeaders)}`);
|
|
13664
|
+
task.logger.info(`[douyinPublish] url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
|
|
13665
|
+
return proxyHttp.api({
|
|
13663
13666
|
method: "post",
|
|
13664
13667
|
url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
|
|
13665
13668
|
data: publishData,
|
|
13666
13669
|
defaultErrorMsg: "发布异常,请稍后重试。",
|
|
13667
|
-
headers:
|
|
13668
|
-
...headers,
|
|
13669
|
-
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
13670
|
-
"Content-Type": "application/json",
|
|
13671
|
-
Accept: "application/json, text/plain, */*",
|
|
13672
|
-
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
13673
|
-
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
13674
|
-
"bd-ticket-guard-version": "2",
|
|
13675
|
-
"bd-ticket-guard-web-sign-type": "1",
|
|
13676
|
-
"bd-ticket-guard-web-version": "2",
|
|
13677
|
-
"x-secsdk-csrf-token": csrfToken,
|
|
13678
|
-
"x-tt-session-dtrait": sessionDtrait || ""
|
|
13679
|
-
}
|
|
13670
|
+
headers: requestHeaders
|
|
13680
13671
|
}, {
|
|
13681
13672
|
timeout: 60000,
|
|
13682
|
-
retries:
|
|
13683
|
-
retryDelay: 2000
|
|
13673
|
+
retries: 0
|
|
13684
13674
|
});
|
|
13685
|
-
}
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
|
|
13691
|
-
|
|
13692
|
-
|
|
13693
|
-
|
|
13694
|
-
|
|
13695
|
-
|
|
13696
|
-
const
|
|
13697
|
-
|
|
13698
|
-
|
|
13699
|
-
|
|
13700
|
-
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13704
|
-
|
|
13705
|
-
|
|
13706
|
-
|
|
13707
|
-
|
|
13675
|
+
};
|
|
13676
|
+
let publishResult;
|
|
13677
|
+
for(let attempt = 0; attempt < MAX_SIGN_RETRIES; attempt++){
|
|
13678
|
+
if (attempt > 0) {
|
|
13679
|
+
task.logger.warn(`[douyinPublish] 第 ${attempt} 次重新签名后重试(上次为 ticket-guard 拒绝)`);
|
|
13680
|
+
await new Promise((resolve)=>setTimeout(resolve, SIGN_RETRY_DELAY));
|
|
13681
|
+
}
|
|
13682
|
+
try {
|
|
13683
|
+
publishResult = await signAndPublish();
|
|
13684
|
+
break;
|
|
13685
|
+
} catch (error) {
|
|
13686
|
+
const handledError = Http.handleApiError(error);
|
|
13687
|
+
if (590 === handledError.code) {
|
|
13688
|
+
if (attempt < MAX_SIGN_RETRIES - 1) continue;
|
|
13689
|
+
task.logger.error(`[douyinPublish] ticket-guard 拒绝重试已用尽(${MAX_SIGN_RETRIES} 次),走兜底`);
|
|
13690
|
+
throw error;
|
|
13691
|
+
}
|
|
13692
|
+
const isProxyOrNetworkError = [
|
|
13693
|
+
599,
|
|
13694
|
+
500,
|
|
13695
|
+
502,
|
|
13696
|
+
503,
|
|
13697
|
+
504
|
|
13698
|
+
].includes(handledError.code);
|
|
13699
|
+
if (isProxyOrNetworkError) {
|
|
13700
|
+
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
13701
|
+
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
13702
|
+
const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13703
|
+
task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
13704
|
+
await updateTaskState?.({
|
|
13705
|
+
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
|
|
13706
|
+
error: message
|
|
13707
|
+
});
|
|
13708
|
+
return {
|
|
13709
|
+
code: 414,
|
|
13710
|
+
data: "",
|
|
13711
|
+
message
|
|
13712
|
+
};
|
|
13713
|
+
}
|
|
13714
|
+
throw error;
|
|
13708
13715
|
}
|
|
13709
|
-
throw error;
|
|
13710
13716
|
}
|
|
13717
|
+
if (!publishResult) throw (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "发布异常,请稍后重试。", "");
|
|
13711
13718
|
task.logger.info(`[douyinPublish] decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
|
|
13712
13719
|
if (needsVerification(decision)) {
|
|
13713
13720
|
const details = [
|
|
@@ -15852,7 +15859,8 @@ const ShipinhaoArticleSchema = BaseArticleSchema.extend({
|
|
|
15852
15859
|
favNum: schemas_number(),
|
|
15853
15860
|
objectId: schemas_string(),
|
|
15854
15861
|
postType: schemas_string(),
|
|
15855
|
-
postStatus: schemas_number()
|
|
15862
|
+
postStatus: schemas_number(),
|
|
15863
|
+
effectiveTime: schemas_number().optional()
|
|
15856
15864
|
});
|
|
15857
15865
|
const FetchArticlesDataSchema = schemas_object({
|
|
15858
15866
|
articleCell: schemas_array(union([
|
|
@@ -16188,6 +16196,9 @@ async function handleShipinhaoData(_task, params) {
|
|
|
16188
16196
|
objectId: item.exportId || item.objectId || "",
|
|
16189
16197
|
postType: forcePostType,
|
|
16190
16198
|
postStatus: item.status || item.post_status || 0,
|
|
16199
|
+
...item.effectiveTime ? {
|
|
16200
|
+
effectiveTime: item.effectiveTime
|
|
16201
|
+
} : {},
|
|
16191
16202
|
...showOriginalData ? {
|
|
16192
16203
|
originalData: item
|
|
16193
16204
|
} : {}
|
|
@@ -25590,5 +25601,4 @@ class Action {
|
|
|
25590
25601
|
var __webpack_exports__version = package_namespaceObject.i8;
|
|
25591
25602
|
export { Action, ActionCommonParamsSchema, BaijiahaoPublishParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, DouyinCheckVerifyQrCodeParamsSchema, DouyinCreateCommentReplyParamsSchema, DouyinGetCollectionParamsSchema, DouyinGetCommentListParamsSchema, DouyinGetCommentReplyListParamsSchema, DouyinGetHotParamsSchema, DouyinGetLocationParamsSchema, DouyinGetMusicByCategoryParamsSchema, DouyinGetMusicCategoryParamsSchema, DouyinGetMusicParamsSchema, DouyinGetTopicsParamsSchema, DouyinGetVerifyQrCodeParamsSchema, DouyinGetWorkListParamsSchema, DouyinPublishParamsSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, ShipinhaoCheckLinkValidateParamsSchema, ShipinhaoGetLocationParamsSchema, ShipinhaoGetMsgParamsSchema, ShipinhaoPublishParamsSchema, ShipinhaoSendMsgParamsSchema, ToutiaoPublishParamsSchema, UnreadCountSchema, WeixinPublishParamsSchema, WxBjhSessionParamsSchema, XhsWebSearchParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, douyinConfigDataSchema, getFileState, reportLogger, rpaAction_Server_Mock, shipinhaoConfigDataSchema, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
|
|
25592
25603
|
|
|
25593
|
-
//# sourceMappingURL=index.mjs.map
|
|
25594
|
-
//# debugId=108ecd30-8541-54e3-aef4-897782dc7b9b
|
|
25604
|
+
//# sourceMappingURL=index.mjs.map
|