@iflyrpa/actions 2.0.0-beta.2 → 2.0.0-beta.3
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/douyinGetHot/index.d.ts +1 -0
- package/dist/actions/douyinGetMusicByCategory/schema.d.ts +2 -2
- package/dist/actions/douyinGetMusicCategory/schema.d.ts +1 -1
- package/dist/actions/douyinLogin/rpa.d.ts +2 -0
- package/dist/actions/douyinPublish/index.d.ts +9 -2
- package/dist/bundle.js +327 -56
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +327 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +327 -56
- package/dist/index.mjs.map +1 -1
- package/dist/utils/proxy.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4993,7 +4993,7 @@ var __webpack_exports__ = {};
|
|
|
4993
4993
|
});
|
|
4994
4994
|
const package_json_namespaceObject = require("@iflyrpa/share/package.json");
|
|
4995
4995
|
var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
|
|
4996
|
-
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.
|
|
4996
|
+
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.2"}');
|
|
4997
4997
|
const share_namespaceObject = require("@iflyrpa/share");
|
|
4998
4998
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
4999
4999
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -5010,7 +5010,7 @@ var __webpack_exports__ = {};
|
|
|
5010
5010
|
const external_axios_namespaceObject = require("axios");
|
|
5011
5011
|
var external_axios_default = /*#__PURE__*/ __webpack_require__.n(external_axios_namespaceObject);
|
|
5012
5012
|
var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
|
|
5013
|
-
async function ProxyAgent(ip, adr, accountId, refresh) {
|
|
5013
|
+
async function ProxyAgent(task, ip, adr, accountId, refresh) {
|
|
5014
5014
|
const http = new Http({
|
|
5015
5015
|
headers: {
|
|
5016
5016
|
"content-type": "application/json"
|
|
@@ -5036,7 +5036,7 @@ var __webpack_exports__ = {};
|
|
|
5036
5036
|
data: ProxyInfo.data
|
|
5037
5037
|
}
|
|
5038
5038
|
};
|
|
5039
|
-
|
|
5039
|
+
task.logger?.info(`请求代理:区域:${params.addr}, IP:${params.ip}, AccountId:${params.accountId}, 返回代理信息: ${ProxyInfo.data ? `${ProxyInfo.data.proxyIp}:${ProxyInfo.data.proxyPort}` : "无可用代理"}`, loggerInfo);
|
|
5040
5040
|
return "000000" === ProxyInfo.code && ProxyInfo.data ? {
|
|
5041
5041
|
ip: ProxyInfo.data.proxyIp,
|
|
5042
5042
|
port: ProxyInfo.data.proxyPort,
|
|
@@ -5058,7 +5058,7 @@ var __webpack_exports__ = {};
|
|
|
5058
5058
|
...config
|
|
5059
5059
|
});
|
|
5060
5060
|
this.logger = logger;
|
|
5061
|
-
if (ip) this.agentPromise = ProxyAgent
|
|
5061
|
+
if (ip) this.agentPromise = ProxyAgent({
|
|
5062
5062
|
logger
|
|
5063
5063
|
}, ip, adr, accountId);
|
|
5064
5064
|
this.addResponseInterceptor(()=>void 0);
|
|
@@ -9136,10 +9136,9 @@ var __webpack_exports__ = {};
|
|
|
9136
9136
|
params.accountId
|
|
9137
9137
|
];
|
|
9138
9138
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
9139
|
-
const
|
|
9139
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
9140
9140
|
logger: task.logger
|
|
9141
|
-
});
|
|
9142
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
9141
|
+
}, ...args);
|
|
9143
9142
|
task.logger?.info("==> 代理信息获取成功!");
|
|
9144
9143
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
9145
9144
|
}
|
|
@@ -11297,7 +11296,7 @@ var __webpack_exports__ = {};
|
|
|
11297
11296
|
const http = new Http(...args);
|
|
11298
11297
|
const hotParams = {
|
|
11299
11298
|
query: params.query || "",
|
|
11300
|
-
count: "
|
|
11299
|
+
count: params.count?.toString() || "20",
|
|
11301
11300
|
aid: "1128",
|
|
11302
11301
|
cookie_enabled: "0",
|
|
11303
11302
|
screen_width: "1920",
|
|
@@ -11314,11 +11313,17 @@ var __webpack_exports__ = {};
|
|
|
11314
11313
|
};
|
|
11315
11314
|
const aBogus = douyinGetHot_sign_reply(hotParams, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36");
|
|
11316
11315
|
hotParams.a_bogus = aBogus;
|
|
11316
|
+
if (!params.query) {
|
|
11317
|
+
delete hotParams.query;
|
|
11318
|
+
delete hotParams.count;
|
|
11319
|
+
}
|
|
11317
11320
|
const queryString = new URLSearchParams(hotParams).toString();
|
|
11318
11321
|
console.log("抖音获取热点参数:", queryString);
|
|
11322
|
+
const url = `https://creator.douyin.com/aweme/v1/hotspot/${params.query ? "search" : "recommend"}/?${queryString}`;
|
|
11323
|
+
console.log("抖音获取热点URL:", url);
|
|
11319
11324
|
const res = await http.api({
|
|
11320
11325
|
method: "get",
|
|
11321
|
-
url
|
|
11326
|
+
url,
|
|
11322
11327
|
headers: {
|
|
11323
11328
|
...headers,
|
|
11324
11329
|
"Content-Type": "application/json"
|
|
@@ -11331,8 +11336,8 @@ var __webpack_exports__ = {};
|
|
|
11331
11336
|
const isSuccess = 0 === res.status_code;
|
|
11332
11337
|
const message = `抖音获取热点${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11333
11338
|
const data = isSuccess ? {
|
|
11334
|
-
hot: res?.sentences || [],
|
|
11335
|
-
total: res?.sentences?.length || 0
|
|
11339
|
+
hot: res?.sentences || res?.all_sentences || [],
|
|
11340
|
+
total: (res?.sentences || res?.all_sentences)?.length || 0
|
|
11336
11341
|
} : {
|
|
11337
11342
|
hot: [],
|
|
11338
11343
|
total: 0
|
|
@@ -11517,8 +11522,8 @@ var __webpack_exports__ = {};
|
|
|
11517
11522
|
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
11518
11523
|
};
|
|
11519
11524
|
const DouyinGetMusicByCategoryParamsSchema = ActionCommonParamsSchema.extend({
|
|
11520
|
-
category_id: schemas_string()
|
|
11521
|
-
type: schemas_string()
|
|
11525
|
+
category_id: schemas_string(),
|
|
11526
|
+
type: schemas_string(),
|
|
11522
11527
|
count: schemas_number().optional()
|
|
11523
11528
|
});
|
|
11524
11529
|
const { sign_datail: douyinGetMusicByCategory_sign_datail, sign_reply: douyinGetMusicByCategory_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
|
|
@@ -11665,7 +11670,7 @@ var __webpack_exports__ = {};
|
|
|
11665
11670
|
params.accountId
|
|
11666
11671
|
];
|
|
11667
11672
|
const http = new Http(...args);
|
|
11668
|
-
const keyword = params.keyword || "";
|
|
11673
|
+
const keyword = params.keyword || "热点";
|
|
11669
11674
|
const topicParams = {
|
|
11670
11675
|
keyword: keyword,
|
|
11671
11676
|
source: "challenge_create",
|
|
@@ -11711,6 +11716,272 @@ var __webpack_exports__ = {};
|
|
|
11711
11716
|
};
|
|
11712
11717
|
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
11713
11718
|
};
|
|
11719
|
+
const rpa_scanRetryMaxCount = 60;
|
|
11720
|
+
const rpa_waitQrcodeResultMaxTime = 2000 * rpa_scanRetryMaxCount;
|
|
11721
|
+
const douyinLogin_rpa_rpaAction = async (task, params)=>{
|
|
11722
|
+
const reporter = task.reportService?.reportLoginStatus ?? (()=>Promise.resolve());
|
|
11723
|
+
let page;
|
|
11724
|
+
let statusMachine = "new";
|
|
11725
|
+
let isSelfClosing = false;
|
|
11726
|
+
try {
|
|
11727
|
+
page = await task.createPage({
|
|
11728
|
+
url: "https://creator.douyin.com/"
|
|
11729
|
+
});
|
|
11730
|
+
if (!task._session?.id) throw new Error("Session ID 不存在");
|
|
11731
|
+
task._steelBrowser?.on("disconnected", ()=>{
|
|
11732
|
+
if (task.debug && isSelfClosing) task.logger.info("执行结束,关闭浏览器!");
|
|
11733
|
+
else task.logger.info("浏览器被手动释放或意外关闭!");
|
|
11734
|
+
});
|
|
11735
|
+
} catch (e) {
|
|
11736
|
+
task.logger.error("浏览器启动失败", e);
|
|
11737
|
+
return {
|
|
11738
|
+
code: 500,
|
|
11739
|
+
message: `浏览器启动失败: ${e}`,
|
|
11740
|
+
data: {}
|
|
11741
|
+
};
|
|
11742
|
+
}
|
|
11743
|
+
await page.route("**/*.mp4", (route)=>route.abort());
|
|
11744
|
+
await page.route("**/*.png", (route)=>route.abort());
|
|
11745
|
+
await page.route("**/*.ttf", (route)=>route.abort());
|
|
11746
|
+
await page.addInitScript(()=>{
|
|
11747
|
+
window.requestAnimationFrame = ()=>0;
|
|
11748
|
+
});
|
|
11749
|
+
await page.addInitScript(()=>{
|
|
11750
|
+
const removeEventBlockers = ()=>{
|
|
11751
|
+
try {
|
|
11752
|
+
const blockers = document.querySelectorAll('[style*="pointer-events: none"]');
|
|
11753
|
+
blockers.forEach((el)=>{
|
|
11754
|
+
el.style.pointerEvents = "auto";
|
|
11755
|
+
});
|
|
11756
|
+
document.body.style.pointerEvents = "auto";
|
|
11757
|
+
if (window.__DOUYIN_ANTI_DEBUG__) delete window.__DOUYIN_ANTI_DEBUG__;
|
|
11758
|
+
} catch (e) {}
|
|
11759
|
+
};
|
|
11760
|
+
removeEventBlockers();
|
|
11761
|
+
setInterval(removeEventBlockers, 1000);
|
|
11762
|
+
if ("undefined" != typeof MutationObserver) {
|
|
11763
|
+
const observer = new MutationObserver(removeEventBlockers);
|
|
11764
|
+
observer.observe(document.documentElement, {
|
|
11765
|
+
childList: true,
|
|
11766
|
+
subtree: true,
|
|
11767
|
+
attributes: true,
|
|
11768
|
+
attributeFilter: [
|
|
11769
|
+
"style"
|
|
11770
|
+
]
|
|
11771
|
+
});
|
|
11772
|
+
}
|
|
11773
|
+
});
|
|
11774
|
+
task.logger.info("页面创建成功,开始Bypass页面事件屏蔽...");
|
|
11775
|
+
try {
|
|
11776
|
+
await page.waitForResponse((response)=>response.url().includes("/272.6591d0af.js") && 200 === response.status(), {
|
|
11777
|
+
timeout: 15000
|
|
11778
|
+
});
|
|
11779
|
+
await page.waitForLoadState("networkidle");
|
|
11780
|
+
await page.goto("about:blank");
|
|
11781
|
+
await page.goBack({
|
|
11782
|
+
waitUntil: "domcontentloaded"
|
|
11783
|
+
});
|
|
11784
|
+
task.logger.info("已返回登录页面,页面事件屏蔽Bypass完成...");
|
|
11785
|
+
} catch (e) {
|
|
11786
|
+
task.logger.warn("Bypass 超时,继续执行...", {
|
|
11787
|
+
error: e
|
|
11788
|
+
});
|
|
11789
|
+
}
|
|
11790
|
+
await page.waitForTimeout(2000);
|
|
11791
|
+
try {
|
|
11792
|
+
const loginButtonSelector = ".douyin-creator-master-icon-default.douyin-creator-master-icon-user_circle";
|
|
11793
|
+
await page.waitForSelector(loginButtonSelector, {
|
|
11794
|
+
state: "visible",
|
|
11795
|
+
timeout: 10000
|
|
11796
|
+
});
|
|
11797
|
+
const clicked = await page.evaluate((selector)=>{
|
|
11798
|
+
const btn = document.querySelector(selector);
|
|
11799
|
+
if (btn) {
|
|
11800
|
+
btn.click();
|
|
11801
|
+
return true;
|
|
11802
|
+
}
|
|
11803
|
+
return false;
|
|
11804
|
+
}, loginButtonSelector);
|
|
11805
|
+
if (clicked) task.logger.info("✅ 登录按钮点击成功(使用 JavaScript)");
|
|
11806
|
+
else {
|
|
11807
|
+
await page.locator(loginButtonSelector).click({
|
|
11808
|
+
force: true,
|
|
11809
|
+
timeout: 5000
|
|
11810
|
+
});
|
|
11811
|
+
task.logger.info("✅ 登录按钮点击成功(使用 Playwright force)");
|
|
11812
|
+
}
|
|
11813
|
+
} catch (e) {
|
|
11814
|
+
task.logger.error("❌ 点击登录按钮失败", e);
|
|
11815
|
+
return {
|
|
11816
|
+
code: 500,
|
|
11817
|
+
message: "无法点击登录按钮,页面可能已被屏蔽",
|
|
11818
|
+
data: {}
|
|
11819
|
+
};
|
|
11820
|
+
}
|
|
11821
|
+
await page.waitForTimeout(3000);
|
|
11822
|
+
const pageInfo = await task._client?.sessions.liveDetails(task._session.id);
|
|
11823
|
+
const pageId = pageInfo?.pages[0].id ?? "";
|
|
11824
|
+
const baseHost = task._session.websocketUrl?.replace(/^wss?:\/\//, "") ?? "";
|
|
11825
|
+
const debugParams = new URLSearchParams({
|
|
11826
|
+
baseHost,
|
|
11827
|
+
pageId
|
|
11828
|
+
});
|
|
11829
|
+
const connectAddress = debugParams.toString();
|
|
11830
|
+
task.reportService?.settingSessionID?.(task._session?.id || "");
|
|
11831
|
+
task.logger.info("🔗 远程调试地址已生成,现在可以安全访问远程页面");
|
|
11832
|
+
await reporter(0, "浏览器启动成功,请使用抖音App扫码登录......", {
|
|
11833
|
+
connectAddress
|
|
11834
|
+
});
|
|
11835
|
+
const userInfo = {
|
|
11836
|
+
uniqueId: "",
|
|
11837
|
+
avatar: "",
|
|
11838
|
+
name: ""
|
|
11839
|
+
};
|
|
11840
|
+
try {
|
|
11841
|
+
await new Promise((resolve, reject)=>{
|
|
11842
|
+
let finished = false;
|
|
11843
|
+
const timer = setTimeout(()=>{
|
|
11844
|
+
cleanup(statusMachine);
|
|
11845
|
+
}, rpa_waitQrcodeResultMaxTime);
|
|
11846
|
+
const cleanup = (status)=>{
|
|
11847
|
+
if (finished) return;
|
|
11848
|
+
finished = true;
|
|
11849
|
+
clearTimeout(timer);
|
|
11850
|
+
page.off("response", handleWebCommon);
|
|
11851
|
+
page.off("response", handleCheckQR);
|
|
11852
|
+
if (void 0 !== status) reject(status);
|
|
11853
|
+
};
|
|
11854
|
+
const handleWebCommon = async (resp)=>{
|
|
11855
|
+
try {
|
|
11856
|
+
const url = resp.url();
|
|
11857
|
+
if (url.includes("/web/common")) {
|
|
11858
|
+
cleanup();
|
|
11859
|
+
const headers = resp.headers();
|
|
11860
|
+
const xmst = headers["x-ms-token"];
|
|
11861
|
+
const date = headers["x-tt-timestamp"];
|
|
11862
|
+
if (xmst && date) {
|
|
11863
|
+
const mstExpirDate = new Date(1000 * Number(date) + 604800000);
|
|
11864
|
+
const msToken = {
|
|
11865
|
+
name: "msToken",
|
|
11866
|
+
value: xmst,
|
|
11867
|
+
domain: ".bytedance.com",
|
|
11868
|
+
expires: mstExpirDate.getTime() / 1000,
|
|
11869
|
+
httpOnly: true,
|
|
11870
|
+
path: "/",
|
|
11871
|
+
sameSite: "None",
|
|
11872
|
+
secure: true
|
|
11873
|
+
};
|
|
11874
|
+
await page.context().addCookies([
|
|
11875
|
+
msToken
|
|
11876
|
+
]);
|
|
11877
|
+
task.debug && task.logger.info("msToken 添加成功");
|
|
11878
|
+
task.debug && task.logger.info("msToken 检测成功:", {
|
|
11879
|
+
token: xmst.substring(0, 20) + "...",
|
|
11880
|
+
timestamp: date
|
|
11881
|
+
});
|
|
11882
|
+
}
|
|
11883
|
+
await reporter(0, "扫码成功!", {
|
|
11884
|
+
stage: "scanQrcode",
|
|
11885
|
+
connectAddress
|
|
11886
|
+
});
|
|
11887
|
+
resolve();
|
|
11888
|
+
} else if (url.includes("aweme/v1/creator/user/info")) try {
|
|
11889
|
+
const jsonUserInfo = await resp.json();
|
|
11890
|
+
userInfo.name = jsonUserInfo.user_profile.nick_name ?? "";
|
|
11891
|
+
userInfo.avatar = jsonUserInfo.user_profile.avatar_url ?? "";
|
|
11892
|
+
task.debug && task.logger.info("用户信息获取成功", userInfo);
|
|
11893
|
+
} catch (e) {
|
|
11894
|
+
task.logger.warn("无法解析用户信息:", {
|
|
11895
|
+
url,
|
|
11896
|
+
error: e
|
|
11897
|
+
});
|
|
11898
|
+
}
|
|
11899
|
+
} catch (err) {
|
|
11900
|
+
task.logger.error("监听登录结果出现异常", err);
|
|
11901
|
+
cleanup(err);
|
|
11902
|
+
}
|
|
11903
|
+
};
|
|
11904
|
+
const handleCheckQR = async (response)=>{
|
|
11905
|
+
try {
|
|
11906
|
+
const url = response.url();
|
|
11907
|
+
if (!url.includes("/check_qrconnect")) return;
|
|
11908
|
+
let jsonResponse;
|
|
11909
|
+
try {
|
|
11910
|
+
jsonResponse = await response.json();
|
|
11911
|
+
} catch (e) {
|
|
11912
|
+
task.logger.warn("Response body unavailable (likely navigation happened)", {
|
|
11913
|
+
url
|
|
11914
|
+
});
|
|
11915
|
+
return;
|
|
11916
|
+
}
|
|
11917
|
+
const status = jsonResponse?.data?.status;
|
|
11918
|
+
task.logger.info("check_qrconnect 状态:", {
|
|
11919
|
+
status
|
|
11920
|
+
});
|
|
11921
|
+
if ("scanned" === status) {
|
|
11922
|
+
task.logger.info("用户已扫码,等待确认...");
|
|
11923
|
+
page.on("response", handleWebCommon);
|
|
11924
|
+
}
|
|
11925
|
+
if ("confirmed" === status) {
|
|
11926
|
+
userInfo.uniqueId = jsonResponse.data?.user_data?.user_id_str || "";
|
|
11927
|
+
task.logger.info("扫码确认,开始监听登录完成...");
|
|
11928
|
+
page.off("response", handleCheckQR);
|
|
11929
|
+
}
|
|
11930
|
+
statusMachine = status || "new";
|
|
11931
|
+
if ("expired" === status) {
|
|
11932
|
+
task.logger.warn("二维码已过期");
|
|
11933
|
+
cleanup("expired");
|
|
11934
|
+
}
|
|
11935
|
+
} catch (err) {
|
|
11936
|
+
task.logger.error("handleCheckQR 异常:", err);
|
|
11937
|
+
}
|
|
11938
|
+
};
|
|
11939
|
+
page.on("response", handleCheckQR);
|
|
11940
|
+
});
|
|
11941
|
+
} catch (e) {
|
|
11942
|
+
const errMap = {
|
|
11943
|
+
new: "用户扫码已超时,请重试!",
|
|
11944
|
+
scanned: "用户扫码后未点击确认,请重试!",
|
|
11945
|
+
expired: "二维码已过期,请重试!"
|
|
11946
|
+
};
|
|
11947
|
+
isSelfClosing = true;
|
|
11948
|
+
const errorMessage = "string" == typeof e && errMap[e] ? errMap[e] : e instanceof Error ? e.message : String(e);
|
|
11949
|
+
return {
|
|
11950
|
+
code: 500,
|
|
11951
|
+
message: errorMessage,
|
|
11952
|
+
data: {
|
|
11953
|
+
stage: "scanQrcode",
|
|
11954
|
+
connectAddress
|
|
11955
|
+
}
|
|
11956
|
+
};
|
|
11957
|
+
}
|
|
11958
|
+
let securityData = {};
|
|
11959
|
+
try {
|
|
11960
|
+
securityData = await page.evaluate(()=>({
|
|
11961
|
+
"security-sdk/s_sdk_pri_key": localStorage.getItem("security-sdk/s_sdk_pri_key") || "",
|
|
11962
|
+
"security-sdk/s_sdk_pub_key": localStorage.getItem("security-sdk/s_sdk_pub_key") || "",
|
|
11963
|
+
"security-sdk/s_sdk_sign_data_key": localStorage.getItem("security-sdk/s_sdk_sign_data_key/web_protect") || ""
|
|
11964
|
+
}));
|
|
11965
|
+
task.debug && task.logger.info("Security SDK 数据提取成功:", {
|
|
11966
|
+
"security-sdk/s_sdk_pri_key": !!securityData["security-sdk/s_sdk_pri_key"],
|
|
11967
|
+
"security-sdk/s_sdk_pub_key": !!securityData["security-sdk/s_sdk_pub_key"],
|
|
11968
|
+
"security-sdk/s_sdk_sign_data_key": !!securityData["security-sdk/s_sdk_sign_data_key"]
|
|
11969
|
+
});
|
|
11970
|
+
} catch (error) {
|
|
11971
|
+
task.logger.warn("提取 Security SDK 数据失败:", {
|
|
11972
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11973
|
+
});
|
|
11974
|
+
}
|
|
11975
|
+
const cookie = JSON.stringify(await task._steelBrowserContext?.cookies());
|
|
11976
|
+
isSelfClosing = true;
|
|
11977
|
+
await page.close();
|
|
11978
|
+
return (0, share_namespaceObject.success)({
|
|
11979
|
+
connectAddress,
|
|
11980
|
+
cookie,
|
|
11981
|
+
userInfo,
|
|
11982
|
+
...securityData
|
|
11983
|
+
}, "登陆成功!");
|
|
11984
|
+
};
|
|
11714
11985
|
const douyinLogin_rpa_server_scanRetryMaxCount = 60;
|
|
11715
11986
|
const douyinLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * douyinLogin_rpa_server_scanRetryMaxCount;
|
|
11716
11987
|
const rpa_server_rpaServer = async (task, params)=>{
|
|
@@ -11724,10 +11995,9 @@ var __webpack_exports__ = {};
|
|
|
11724
11995
|
params.accountId
|
|
11725
11996
|
];
|
|
11726
11997
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
11727
|
-
const
|
|
11998
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
11728
11999
|
logger: task.logger
|
|
11729
|
-
});
|
|
11730
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
12000
|
+
}, ...args);
|
|
11731
12001
|
task.logger?.info("==> 代理信息获取成功!");
|
|
11732
12002
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
11733
12003
|
}
|
|
@@ -11857,13 +12127,15 @@ var __webpack_exports__ = {};
|
|
|
11857
12127
|
return;
|
|
11858
12128
|
}
|
|
11859
12129
|
const status = jsonResponse?.data?.status;
|
|
11860
|
-
if ("scanned" === status)
|
|
11861
|
-
|
|
11862
|
-
|
|
12130
|
+
if ("scanned" === status) {
|
|
12131
|
+
await updateTaskState?.({
|
|
12132
|
+
state: share_namespaceObject.TaskState.SCANNED
|
|
12133
|
+
});
|
|
12134
|
+
page.on("response", handleWebCommon);
|
|
12135
|
+
}
|
|
11863
12136
|
if ("confirmed" === status) {
|
|
11864
12137
|
userInfo.uniqueId = jsonResponse.data?.user_data?.user_id_str || "";
|
|
11865
12138
|
page.off("response", handleCheckQR);
|
|
11866
|
-
page.on("response", handleWebCommon);
|
|
11867
12139
|
}
|
|
11868
12140
|
} catch (err) {
|
|
11869
12141
|
cleanup();
|
|
@@ -11955,6 +12227,7 @@ var __webpack_exports__ = {};
|
|
|
11955
12227
|
}
|
|
11956
12228
|
};
|
|
11957
12229
|
const douyinLogin = async (task, params)=>{
|
|
12230
|
+
if ("rpa" === params.actionType) return douyinLogin_rpa_rpaAction(task, params);
|
|
11958
12231
|
if ("mockApi" === params.actionType) return (0, share_namespaceObject.success)({}, "暂不支持mockApi");
|
|
11959
12232
|
if ("server" === params.actionType) return rpa_server_rpaServer(task, params);
|
|
11960
12233
|
return executeAction(rpa_server_rpaServer)(task, params);
|
|
@@ -12028,32 +12301,28 @@ var __webpack_exports__ = {};
|
|
|
12028
12301
|
const publishData = {
|
|
12029
12302
|
item: {
|
|
12030
12303
|
common: {
|
|
12031
|
-
text: params.title
|
|
12032
|
-
text_extra:
|
|
12304
|
+
text: `${params.title}。${params.content}`,
|
|
12305
|
+
text_extra: params.textExtra,
|
|
12033
12306
|
activity: "[]",
|
|
12034
|
-
challenges:
|
|
12035
|
-
hashtag_source: "",
|
|
12307
|
+
challenges: params.challengeIds,
|
|
12308
|
+
hashtag_source: params.hashtagSource || "",
|
|
12036
12309
|
mentions: "[]",
|
|
12037
|
-
music_id:
|
|
12038
|
-
music_end_time: 0,
|
|
12039
|
-
hot_sentence: "",
|
|
12040
|
-
visibility_type: 0,
|
|
12041
|
-
download: 0,
|
|
12042
|
-
timing: -1,
|
|
12043
|
-
media_type: 2,
|
|
12310
|
+
music_id: params.musicId,
|
|
12311
|
+
music_end_time: 1000 * (params.musicDuration || 0),
|
|
12312
|
+
hot_sentence: params.hotSentence || "",
|
|
12313
|
+
visibility_type: params.visibleRange || 0,
|
|
12314
|
+
download: params.allowSave ? 1 : 0,
|
|
12315
|
+
timing: params.isImmediatelyPublish ? -1 : params.scheduledPublish,
|
|
12316
|
+
media_type: params.publishType || 2,
|
|
12044
12317
|
images: []
|
|
12045
12318
|
},
|
|
12046
12319
|
cover: {
|
|
12047
12320
|
poster: ""
|
|
12048
12321
|
},
|
|
12049
|
-
mix: {},
|
|
12050
|
-
anchor: {
|
|
12051
|
-
poi_name: "",
|
|
12052
|
-
poi_id: "",
|
|
12053
|
-
anchor_content: "{}"
|
|
12054
|
-
},
|
|
12322
|
+
mix: params.mix || {},
|
|
12323
|
+
anchor: {},
|
|
12055
12324
|
declare: {
|
|
12056
|
-
user_declare_info: "{}"
|
|
12325
|
+
user_declare_info: params.selfDeclaration || "{}"
|
|
12057
12326
|
}
|
|
12058
12327
|
}
|
|
12059
12328
|
};
|
|
@@ -12384,6 +12653,13 @@ var __webpack_exports__ = {};
|
|
|
12384
12653
|
content: schemas_string(),
|
|
12385
12654
|
coverImage: schemas_string().optional(),
|
|
12386
12655
|
videoFile: schemas_string().optional(),
|
|
12656
|
+
musicId: schemas_string(),
|
|
12657
|
+
musicDuration: schemas_number().optional(),
|
|
12658
|
+
textExtra: schemas_string(),
|
|
12659
|
+
challengeIds: schemas_string(),
|
|
12660
|
+
hashtagSource: schemas_string(),
|
|
12661
|
+
hotSentence: schemas_string(),
|
|
12662
|
+
mix: custom().optional(),
|
|
12387
12663
|
address: schemas_object({
|
|
12388
12664
|
id: schemas_string(),
|
|
12389
12665
|
name: schemas_string(),
|
|
@@ -12405,8 +12681,7 @@ var __webpack_exports__ = {};
|
|
|
12405
12681
|
isImmediatelyPublish: schemas_boolean().optional(),
|
|
12406
12682
|
scheduledPublish: schemas_string().optional(),
|
|
12407
12683
|
isOriginal: schemas_boolean().optional(),
|
|
12408
|
-
|
|
12409
|
-
allowCopy: schemas_boolean().optional(),
|
|
12684
|
+
allowSave: schemas_boolean().optional(),
|
|
12410
12685
|
publishType: schemas_enum([
|
|
12411
12686
|
"1",
|
|
12412
12687
|
"2",
|
|
@@ -14193,8 +14468,8 @@ var __webpack_exports__ = {};
|
|
|
14193
14468
|
const message = `用户文章信息获取${isSuccess ? "成功!" : "失败,请检查!"}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
14194
14469
|
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, INITIAL_STATE);
|
|
14195
14470
|
};
|
|
14196
|
-
const
|
|
14197
|
-
const
|
|
14471
|
+
const toutiaoLogin_rpa_scanRetryMaxCount = 60;
|
|
14472
|
+
const toutiaoLogin_rpa_waitQrcodeResultMaxTime = 2000 * toutiaoLogin_rpa_scanRetryMaxCount;
|
|
14198
14473
|
const toutiaoLogin_rpa_rpaAction = async (task, _params)=>{
|
|
14199
14474
|
const reporter = task.reportService?.reportLoginStatus ?? (()=>Promise.resolve());
|
|
14200
14475
|
let page;
|
|
@@ -14239,7 +14514,7 @@ var __webpack_exports__ = {};
|
|
|
14239
14514
|
let finished = false;
|
|
14240
14515
|
const timer = setTimeout(()=>{
|
|
14241
14516
|
cleanup(statusMachine);
|
|
14242
|
-
},
|
|
14517
|
+
}, toutiaoLogin_rpa_waitQrcodeResultMaxTime);
|
|
14243
14518
|
const cleanup = (status)=>{
|
|
14244
14519
|
if (finished) return;
|
|
14245
14520
|
finished = true;
|
|
@@ -14338,10 +14613,9 @@ var __webpack_exports__ = {};
|
|
|
14338
14613
|
params.accountId
|
|
14339
14614
|
];
|
|
14340
14615
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
14341
|
-
const
|
|
14616
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
14342
14617
|
logger: task.logger
|
|
14343
|
-
});
|
|
14344
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
14618
|
+
}, ...args);
|
|
14345
14619
|
task.logger?.info("==> 代理信息获取成功!");
|
|
14346
14620
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
14347
14621
|
}
|
|
@@ -15381,10 +15655,9 @@ var __webpack_exports__ = {};
|
|
|
15381
15655
|
params.accountId
|
|
15382
15656
|
];
|
|
15383
15657
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
15384
|
-
const
|
|
15658
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
15385
15659
|
logger: task.logger
|
|
15386
|
-
});
|
|
15387
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
15660
|
+
}, ...args);
|
|
15388
15661
|
task.logger?.info("==> 代理信息获取成功!");
|
|
15389
15662
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
15390
15663
|
}
|
|
@@ -17297,10 +17570,9 @@ var __webpack_exports__ = {};
|
|
|
17297
17570
|
params.accountId
|
|
17298
17571
|
];
|
|
17299
17572
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
17300
|
-
const
|
|
17573
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
17301
17574
|
logger: task.logger
|
|
17302
|
-
});
|
|
17303
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
17575
|
+
}, ...args);
|
|
17304
17576
|
task.logger?.info("==> 代理信息获取成功!");
|
|
17305
17577
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
17306
17578
|
}
|
|
@@ -18133,10 +18405,9 @@ var __webpack_exports__ = {};
|
|
|
18133
18405
|
params.accountId
|
|
18134
18406
|
];
|
|
18135
18407
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
18136
|
-
const
|
|
18408
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
18137
18409
|
logger: task.logger
|
|
18138
|
-
});
|
|
18139
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
18410
|
+
}, ...args);
|
|
18140
18411
|
task.logger?.info("==> 代理信息获取成功!");
|
|
18141
18412
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
18142
18413
|
}
|