@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.mjs
CHANGED
|
@@ -4946,9 +4946,9 @@ function __webpack_require__(moduleId) {
|
|
|
4946
4946
|
return module;
|
|
4947
4947
|
};
|
|
4948
4948
|
})();
|
|
4949
|
-
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.
|
|
4949
|
+
var package_namespaceObject = JSON.parse('{"i8":"2.0.0-beta.2"}');
|
|
4950
4950
|
var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
|
|
4951
|
-
async function ProxyAgent(ip, adr, accountId, refresh) {
|
|
4951
|
+
async function ProxyAgent(task, ip, adr, accountId, refresh) {
|
|
4952
4952
|
const http = new Http({
|
|
4953
4953
|
headers: {
|
|
4954
4954
|
"content-type": "application/json"
|
|
@@ -4974,7 +4974,7 @@ async function ProxyAgent(ip, adr, accountId, refresh) {
|
|
|
4974
4974
|
data: ProxyInfo.data
|
|
4975
4975
|
}
|
|
4976
4976
|
};
|
|
4977
|
-
|
|
4977
|
+
task.logger?.info(`请求代理:区域:${params.addr}, IP:${params.ip}, AccountId:${params.accountId}, 返回代理信息: ${ProxyInfo.data ? `${ProxyInfo.data.proxyIp}:${ProxyInfo.data.proxyPort}` : "无可用代理"}`, loggerInfo);
|
|
4978
4978
|
return "000000" === ProxyInfo.code && ProxyInfo.data ? {
|
|
4979
4979
|
ip: ProxyInfo.data.proxyIp,
|
|
4980
4980
|
port: ProxyInfo.data.proxyPort,
|
|
@@ -4996,7 +4996,7 @@ class Http {
|
|
|
4996
4996
|
...config
|
|
4997
4997
|
});
|
|
4998
4998
|
this.logger = logger;
|
|
4999
|
-
if (ip) this.agentPromise = ProxyAgent
|
|
4999
|
+
if (ip) this.agentPromise = ProxyAgent({
|
|
5000
5000
|
logger
|
|
5001
5001
|
}, ip, adr, accountId);
|
|
5002
5002
|
this.addResponseInterceptor(()=>void 0);
|
|
@@ -9072,10 +9072,9 @@ const rpaServer = async (task, params)=>{
|
|
|
9072
9072
|
params.accountId
|
|
9073
9073
|
];
|
|
9074
9074
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
9075
|
-
const
|
|
9075
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
9076
9076
|
logger: task.logger
|
|
9077
|
-
});
|
|
9078
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
9077
|
+
}, ...args);
|
|
9079
9078
|
task.logger?.info("==> 代理信息获取成功!");
|
|
9080
9079
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
9081
9080
|
}
|
|
@@ -11229,7 +11228,7 @@ const douyinGetHot = async (_task, params)=>{
|
|
|
11229
11228
|
const http = new Http(...args);
|
|
11230
11229
|
const hotParams = {
|
|
11231
11230
|
query: params.query || "",
|
|
11232
|
-
count: "
|
|
11231
|
+
count: params.count?.toString() || "20",
|
|
11233
11232
|
aid: "1128",
|
|
11234
11233
|
cookie_enabled: "0",
|
|
11235
11234
|
screen_width: "1920",
|
|
@@ -11246,11 +11245,17 @@ const douyinGetHot = async (_task, params)=>{
|
|
|
11246
11245
|
};
|
|
11247
11246
|
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");
|
|
11248
11247
|
hotParams.a_bogus = aBogus;
|
|
11248
|
+
if (!params.query) {
|
|
11249
|
+
delete hotParams.query;
|
|
11250
|
+
delete hotParams.count;
|
|
11251
|
+
}
|
|
11249
11252
|
const queryString = new URLSearchParams(hotParams).toString();
|
|
11250
11253
|
console.log("抖音获取热点参数:", queryString);
|
|
11254
|
+
const url = `https://creator.douyin.com/aweme/v1/hotspot/${params.query ? "search" : "recommend"}/?${queryString}`;
|
|
11255
|
+
console.log("抖音获取热点URL:", url);
|
|
11251
11256
|
const res = await http.api({
|
|
11252
11257
|
method: "get",
|
|
11253
|
-
url
|
|
11258
|
+
url,
|
|
11254
11259
|
headers: {
|
|
11255
11260
|
...headers,
|
|
11256
11261
|
"Content-Type": "application/json"
|
|
@@ -11263,8 +11268,8 @@ const douyinGetHot = async (_task, params)=>{
|
|
|
11263
11268
|
const isSuccess = 0 === res.status_code;
|
|
11264
11269
|
const message = `抖音获取热点${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11265
11270
|
const data = isSuccess ? {
|
|
11266
|
-
hot: res?.sentences || [],
|
|
11267
|
-
total: res?.sentences?.length || 0
|
|
11271
|
+
hot: res?.sentences || res?.all_sentences || [],
|
|
11272
|
+
total: (res?.sentences || res?.all_sentences)?.length || 0
|
|
11268
11273
|
} : {
|
|
11269
11274
|
hot: [],
|
|
11270
11275
|
total: 0
|
|
@@ -11449,8 +11454,8 @@ const douyinGetMusic = async (_task, params)=>{
|
|
|
11449
11454
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
|
|
11450
11455
|
};
|
|
11451
11456
|
const DouyinGetMusicByCategoryParamsSchema = ActionCommonParamsSchema.extend({
|
|
11452
|
-
category_id: schemas_string()
|
|
11453
|
-
type: schemas_string()
|
|
11457
|
+
category_id: schemas_string(),
|
|
11458
|
+
type: schemas_string(),
|
|
11454
11459
|
count: schemas_number().optional()
|
|
11455
11460
|
});
|
|
11456
11461
|
const { sign_datail: douyinGetMusicByCategory_sign_datail, sign_reply: douyinGetMusicByCategory_sign_reply } = __webpack_require__("./src/utils/douyin/douyin.js");
|
|
@@ -11597,7 +11602,7 @@ const douyinGetTopics = async (_task, params)=>{
|
|
|
11597
11602
|
params.accountId
|
|
11598
11603
|
];
|
|
11599
11604
|
const http = new Http(...args);
|
|
11600
|
-
const keyword = params.keyword || "";
|
|
11605
|
+
const keyword = params.keyword || "热点";
|
|
11601
11606
|
const topicParams = {
|
|
11602
11607
|
keyword: keyword,
|
|
11603
11608
|
source: "challenge_create",
|
|
@@ -11643,6 +11648,272 @@ const douyinGetTopics = async (_task, params)=>{
|
|
|
11643
11648
|
};
|
|
11644
11649
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
|
|
11645
11650
|
};
|
|
11651
|
+
const rpa_scanRetryMaxCount = 60;
|
|
11652
|
+
const rpa_waitQrcodeResultMaxTime = 2000 * rpa_scanRetryMaxCount;
|
|
11653
|
+
const douyinLogin_rpa_rpaAction = async (task, params)=>{
|
|
11654
|
+
const reporter = task.reportService?.reportLoginStatus ?? (()=>Promise.resolve());
|
|
11655
|
+
let page;
|
|
11656
|
+
let statusMachine = "new";
|
|
11657
|
+
let isSelfClosing = false;
|
|
11658
|
+
try {
|
|
11659
|
+
page = await task.createPage({
|
|
11660
|
+
url: "https://creator.douyin.com/"
|
|
11661
|
+
});
|
|
11662
|
+
if (!task._session?.id) throw new Error("Session ID 不存在");
|
|
11663
|
+
task._steelBrowser?.on("disconnected", ()=>{
|
|
11664
|
+
if (task.debug && isSelfClosing) task.logger.info("执行结束,关闭浏览器!");
|
|
11665
|
+
else task.logger.info("浏览器被手动释放或意外关闭!");
|
|
11666
|
+
});
|
|
11667
|
+
} catch (e) {
|
|
11668
|
+
task.logger.error("浏览器启动失败", e);
|
|
11669
|
+
return {
|
|
11670
|
+
code: 500,
|
|
11671
|
+
message: `浏览器启动失败: ${e}`,
|
|
11672
|
+
data: {}
|
|
11673
|
+
};
|
|
11674
|
+
}
|
|
11675
|
+
await page.route("**/*.mp4", (route)=>route.abort());
|
|
11676
|
+
await page.route("**/*.png", (route)=>route.abort());
|
|
11677
|
+
await page.route("**/*.ttf", (route)=>route.abort());
|
|
11678
|
+
await page.addInitScript(()=>{
|
|
11679
|
+
window.requestAnimationFrame = ()=>0;
|
|
11680
|
+
});
|
|
11681
|
+
await page.addInitScript(()=>{
|
|
11682
|
+
const removeEventBlockers = ()=>{
|
|
11683
|
+
try {
|
|
11684
|
+
const blockers = document.querySelectorAll('[style*="pointer-events: none"]');
|
|
11685
|
+
blockers.forEach((el)=>{
|
|
11686
|
+
el.style.pointerEvents = "auto";
|
|
11687
|
+
});
|
|
11688
|
+
document.body.style.pointerEvents = "auto";
|
|
11689
|
+
if (window.__DOUYIN_ANTI_DEBUG__) delete window.__DOUYIN_ANTI_DEBUG__;
|
|
11690
|
+
} catch (e) {}
|
|
11691
|
+
};
|
|
11692
|
+
removeEventBlockers();
|
|
11693
|
+
setInterval(removeEventBlockers, 1000);
|
|
11694
|
+
if ("undefined" != typeof MutationObserver) {
|
|
11695
|
+
const observer = new MutationObserver(removeEventBlockers);
|
|
11696
|
+
observer.observe(document.documentElement, {
|
|
11697
|
+
childList: true,
|
|
11698
|
+
subtree: true,
|
|
11699
|
+
attributes: true,
|
|
11700
|
+
attributeFilter: [
|
|
11701
|
+
"style"
|
|
11702
|
+
]
|
|
11703
|
+
});
|
|
11704
|
+
}
|
|
11705
|
+
});
|
|
11706
|
+
task.logger.info("页面创建成功,开始Bypass页面事件屏蔽...");
|
|
11707
|
+
try {
|
|
11708
|
+
await page.waitForResponse((response)=>response.url().includes("/272.6591d0af.js") && 200 === response.status(), {
|
|
11709
|
+
timeout: 15000
|
|
11710
|
+
});
|
|
11711
|
+
await page.waitForLoadState("networkidle");
|
|
11712
|
+
await page.goto("about:blank");
|
|
11713
|
+
await page.goBack({
|
|
11714
|
+
waitUntil: "domcontentloaded"
|
|
11715
|
+
});
|
|
11716
|
+
task.logger.info("已返回登录页面,页面事件屏蔽Bypass完成...");
|
|
11717
|
+
} catch (e) {
|
|
11718
|
+
task.logger.warn("Bypass 超时,继续执行...", {
|
|
11719
|
+
error: e
|
|
11720
|
+
});
|
|
11721
|
+
}
|
|
11722
|
+
await page.waitForTimeout(2000);
|
|
11723
|
+
try {
|
|
11724
|
+
const loginButtonSelector = ".douyin-creator-master-icon-default.douyin-creator-master-icon-user_circle";
|
|
11725
|
+
await page.waitForSelector(loginButtonSelector, {
|
|
11726
|
+
state: "visible",
|
|
11727
|
+
timeout: 10000
|
|
11728
|
+
});
|
|
11729
|
+
const clicked = await page.evaluate((selector)=>{
|
|
11730
|
+
const btn = document.querySelector(selector);
|
|
11731
|
+
if (btn) {
|
|
11732
|
+
btn.click();
|
|
11733
|
+
return true;
|
|
11734
|
+
}
|
|
11735
|
+
return false;
|
|
11736
|
+
}, loginButtonSelector);
|
|
11737
|
+
if (clicked) task.logger.info("✅ 登录按钮点击成功(使用 JavaScript)");
|
|
11738
|
+
else {
|
|
11739
|
+
await page.locator(loginButtonSelector).click({
|
|
11740
|
+
force: true,
|
|
11741
|
+
timeout: 5000
|
|
11742
|
+
});
|
|
11743
|
+
task.logger.info("✅ 登录按钮点击成功(使用 Playwright force)");
|
|
11744
|
+
}
|
|
11745
|
+
} catch (e) {
|
|
11746
|
+
task.logger.error("❌ 点击登录按钮失败", e);
|
|
11747
|
+
return {
|
|
11748
|
+
code: 500,
|
|
11749
|
+
message: "无法点击登录按钮,页面可能已被屏蔽",
|
|
11750
|
+
data: {}
|
|
11751
|
+
};
|
|
11752
|
+
}
|
|
11753
|
+
await page.waitForTimeout(3000);
|
|
11754
|
+
const pageInfo = await task._client?.sessions.liveDetails(task._session.id);
|
|
11755
|
+
const pageId = pageInfo?.pages[0].id ?? "";
|
|
11756
|
+
const baseHost = task._session.websocketUrl?.replace(/^wss?:\/\//, "") ?? "";
|
|
11757
|
+
const debugParams = new URLSearchParams({
|
|
11758
|
+
baseHost,
|
|
11759
|
+
pageId
|
|
11760
|
+
});
|
|
11761
|
+
const connectAddress = debugParams.toString();
|
|
11762
|
+
task.reportService?.settingSessionID?.(task._session?.id || "");
|
|
11763
|
+
task.logger.info("🔗 远程调试地址已生成,现在可以安全访问远程页面");
|
|
11764
|
+
await reporter(0, "浏览器启动成功,请使用抖音App扫码登录......", {
|
|
11765
|
+
connectAddress
|
|
11766
|
+
});
|
|
11767
|
+
const userInfo = {
|
|
11768
|
+
uniqueId: "",
|
|
11769
|
+
avatar: "",
|
|
11770
|
+
name: ""
|
|
11771
|
+
};
|
|
11772
|
+
try {
|
|
11773
|
+
await new Promise((resolve, reject)=>{
|
|
11774
|
+
let finished = false;
|
|
11775
|
+
const timer = setTimeout(()=>{
|
|
11776
|
+
cleanup(statusMachine);
|
|
11777
|
+
}, rpa_waitQrcodeResultMaxTime);
|
|
11778
|
+
const cleanup = (status)=>{
|
|
11779
|
+
if (finished) return;
|
|
11780
|
+
finished = true;
|
|
11781
|
+
clearTimeout(timer);
|
|
11782
|
+
page.off("response", handleWebCommon);
|
|
11783
|
+
page.off("response", handleCheckQR);
|
|
11784
|
+
if (void 0 !== status) reject(status);
|
|
11785
|
+
};
|
|
11786
|
+
const handleWebCommon = async (resp)=>{
|
|
11787
|
+
try {
|
|
11788
|
+
const url = resp.url();
|
|
11789
|
+
if (url.includes("/web/common")) {
|
|
11790
|
+
cleanup();
|
|
11791
|
+
const headers = resp.headers();
|
|
11792
|
+
const xmst = headers["x-ms-token"];
|
|
11793
|
+
const date = headers["x-tt-timestamp"];
|
|
11794
|
+
if (xmst && date) {
|
|
11795
|
+
const mstExpirDate = new Date(1000 * Number(date) + 604800000);
|
|
11796
|
+
const msToken = {
|
|
11797
|
+
name: "msToken",
|
|
11798
|
+
value: xmst,
|
|
11799
|
+
domain: ".bytedance.com",
|
|
11800
|
+
expires: mstExpirDate.getTime() / 1000,
|
|
11801
|
+
httpOnly: true,
|
|
11802
|
+
path: "/",
|
|
11803
|
+
sameSite: "None",
|
|
11804
|
+
secure: true
|
|
11805
|
+
};
|
|
11806
|
+
await page.context().addCookies([
|
|
11807
|
+
msToken
|
|
11808
|
+
]);
|
|
11809
|
+
task.debug && task.logger.info("msToken 添加成功");
|
|
11810
|
+
task.debug && task.logger.info("msToken 检测成功:", {
|
|
11811
|
+
token: xmst.substring(0, 20) + "...",
|
|
11812
|
+
timestamp: date
|
|
11813
|
+
});
|
|
11814
|
+
}
|
|
11815
|
+
await reporter(0, "扫码成功!", {
|
|
11816
|
+
stage: "scanQrcode",
|
|
11817
|
+
connectAddress
|
|
11818
|
+
});
|
|
11819
|
+
resolve();
|
|
11820
|
+
} else if (url.includes("aweme/v1/creator/user/info")) try {
|
|
11821
|
+
const jsonUserInfo = await resp.json();
|
|
11822
|
+
userInfo.name = jsonUserInfo.user_profile.nick_name ?? "";
|
|
11823
|
+
userInfo.avatar = jsonUserInfo.user_profile.avatar_url ?? "";
|
|
11824
|
+
task.debug && task.logger.info("用户信息获取成功", userInfo);
|
|
11825
|
+
} catch (e) {
|
|
11826
|
+
task.logger.warn("无法解析用户信息:", {
|
|
11827
|
+
url,
|
|
11828
|
+
error: e
|
|
11829
|
+
});
|
|
11830
|
+
}
|
|
11831
|
+
} catch (err) {
|
|
11832
|
+
task.logger.error("监听登录结果出现异常", err);
|
|
11833
|
+
cleanup(err);
|
|
11834
|
+
}
|
|
11835
|
+
};
|
|
11836
|
+
const handleCheckQR = async (response)=>{
|
|
11837
|
+
try {
|
|
11838
|
+
const url = response.url();
|
|
11839
|
+
if (!url.includes("/check_qrconnect")) return;
|
|
11840
|
+
let jsonResponse;
|
|
11841
|
+
try {
|
|
11842
|
+
jsonResponse = await response.json();
|
|
11843
|
+
} catch (e) {
|
|
11844
|
+
task.logger.warn("Response body unavailable (likely navigation happened)", {
|
|
11845
|
+
url
|
|
11846
|
+
});
|
|
11847
|
+
return;
|
|
11848
|
+
}
|
|
11849
|
+
const status = jsonResponse?.data?.status;
|
|
11850
|
+
task.logger.info("check_qrconnect 状态:", {
|
|
11851
|
+
status
|
|
11852
|
+
});
|
|
11853
|
+
if ("scanned" === status) {
|
|
11854
|
+
task.logger.info("用户已扫码,等待确认...");
|
|
11855
|
+
page.on("response", handleWebCommon);
|
|
11856
|
+
}
|
|
11857
|
+
if ("confirmed" === status) {
|
|
11858
|
+
userInfo.uniqueId = jsonResponse.data?.user_data?.user_id_str || "";
|
|
11859
|
+
task.logger.info("扫码确认,开始监听登录完成...");
|
|
11860
|
+
page.off("response", handleCheckQR);
|
|
11861
|
+
}
|
|
11862
|
+
statusMachine = status || "new";
|
|
11863
|
+
if ("expired" === status) {
|
|
11864
|
+
task.logger.warn("二维码已过期");
|
|
11865
|
+
cleanup("expired");
|
|
11866
|
+
}
|
|
11867
|
+
} catch (err) {
|
|
11868
|
+
task.logger.error("handleCheckQR 异常:", err);
|
|
11869
|
+
}
|
|
11870
|
+
};
|
|
11871
|
+
page.on("response", handleCheckQR);
|
|
11872
|
+
});
|
|
11873
|
+
} catch (e) {
|
|
11874
|
+
const errMap = {
|
|
11875
|
+
new: "用户扫码已超时,请重试!",
|
|
11876
|
+
scanned: "用户扫码后未点击确认,请重试!",
|
|
11877
|
+
expired: "二维码已过期,请重试!"
|
|
11878
|
+
};
|
|
11879
|
+
isSelfClosing = true;
|
|
11880
|
+
const errorMessage = "string" == typeof e && errMap[e] ? errMap[e] : e instanceof Error ? e.message : String(e);
|
|
11881
|
+
return {
|
|
11882
|
+
code: 500,
|
|
11883
|
+
message: errorMessage,
|
|
11884
|
+
data: {
|
|
11885
|
+
stage: "scanQrcode",
|
|
11886
|
+
connectAddress
|
|
11887
|
+
}
|
|
11888
|
+
};
|
|
11889
|
+
}
|
|
11890
|
+
let securityData = {};
|
|
11891
|
+
try {
|
|
11892
|
+
securityData = await page.evaluate(()=>({
|
|
11893
|
+
"security-sdk/s_sdk_pri_key": localStorage.getItem("security-sdk/s_sdk_pri_key") || "",
|
|
11894
|
+
"security-sdk/s_sdk_pub_key": localStorage.getItem("security-sdk/s_sdk_pub_key") || "",
|
|
11895
|
+
"security-sdk/s_sdk_sign_data_key": localStorage.getItem("security-sdk/s_sdk_sign_data_key/web_protect") || ""
|
|
11896
|
+
}));
|
|
11897
|
+
task.debug && task.logger.info("Security SDK 数据提取成功:", {
|
|
11898
|
+
"security-sdk/s_sdk_pri_key": !!securityData["security-sdk/s_sdk_pri_key"],
|
|
11899
|
+
"security-sdk/s_sdk_pub_key": !!securityData["security-sdk/s_sdk_pub_key"],
|
|
11900
|
+
"security-sdk/s_sdk_sign_data_key": !!securityData["security-sdk/s_sdk_sign_data_key"]
|
|
11901
|
+
});
|
|
11902
|
+
} catch (error) {
|
|
11903
|
+
task.logger.warn("提取 Security SDK 数据失败:", {
|
|
11904
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11905
|
+
});
|
|
11906
|
+
}
|
|
11907
|
+
const cookie = JSON.stringify(await task._steelBrowserContext?.cookies());
|
|
11908
|
+
isSelfClosing = true;
|
|
11909
|
+
await page.close();
|
|
11910
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
11911
|
+
connectAddress,
|
|
11912
|
+
cookie,
|
|
11913
|
+
userInfo,
|
|
11914
|
+
...securityData
|
|
11915
|
+
}, "登陆成功!");
|
|
11916
|
+
};
|
|
11646
11917
|
const douyinLogin_rpa_server_scanRetryMaxCount = 60;
|
|
11647
11918
|
const douyinLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * douyinLogin_rpa_server_scanRetryMaxCount;
|
|
11648
11919
|
const rpa_server_rpaServer = async (task, params)=>{
|
|
@@ -11656,10 +11927,9 @@ const rpa_server_rpaServer = async (task, params)=>{
|
|
|
11656
11927
|
params.accountId
|
|
11657
11928
|
];
|
|
11658
11929
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
11659
|
-
const
|
|
11930
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
11660
11931
|
logger: task.logger
|
|
11661
|
-
});
|
|
11662
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
11932
|
+
}, ...args);
|
|
11663
11933
|
task.logger?.info("==> 代理信息获取成功!");
|
|
11664
11934
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
11665
11935
|
}
|
|
@@ -11789,13 +12059,15 @@ const rpa_server_rpaServer = async (task, params)=>{
|
|
|
11789
12059
|
return;
|
|
11790
12060
|
}
|
|
11791
12061
|
const status = jsonResponse?.data?.status;
|
|
11792
|
-
if ("scanned" === status)
|
|
11793
|
-
|
|
11794
|
-
|
|
12062
|
+
if ("scanned" === status) {
|
|
12063
|
+
await updateTaskState?.({
|
|
12064
|
+
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SCANNED
|
|
12065
|
+
});
|
|
12066
|
+
page.on("response", handleWebCommon);
|
|
12067
|
+
}
|
|
11795
12068
|
if ("confirmed" === status) {
|
|
11796
12069
|
userInfo.uniqueId = jsonResponse.data?.user_data?.user_id_str || "";
|
|
11797
12070
|
page.off("response", handleCheckQR);
|
|
11798
|
-
page.on("response", handleWebCommon);
|
|
11799
12071
|
}
|
|
11800
12072
|
} catch (err) {
|
|
11801
12073
|
cleanup();
|
|
@@ -11887,6 +12159,7 @@ const rpa_server_rpaServer = async (task, params)=>{
|
|
|
11887
12159
|
}
|
|
11888
12160
|
};
|
|
11889
12161
|
const douyinLogin = async (task, params)=>{
|
|
12162
|
+
if ("rpa" === params.actionType) return douyinLogin_rpa_rpaAction(task, params);
|
|
11890
12163
|
if ("mockApi" === params.actionType) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({}, "暂不支持mockApi");
|
|
11891
12164
|
if ("server" === params.actionType) return rpa_server_rpaServer(task, params);
|
|
11892
12165
|
return executeAction(rpa_server_rpaServer)(task, params);
|
|
@@ -11960,32 +12233,28 @@ const mock_mockAction = async (task, params)=>{
|
|
|
11960
12233
|
const publishData = {
|
|
11961
12234
|
item: {
|
|
11962
12235
|
common: {
|
|
11963
|
-
text: params.title
|
|
11964
|
-
text_extra:
|
|
12236
|
+
text: `${params.title}。${params.content}`,
|
|
12237
|
+
text_extra: params.textExtra,
|
|
11965
12238
|
activity: "[]",
|
|
11966
|
-
challenges:
|
|
11967
|
-
hashtag_source: "",
|
|
12239
|
+
challenges: params.challengeIds,
|
|
12240
|
+
hashtag_source: params.hashtagSource || "",
|
|
11968
12241
|
mentions: "[]",
|
|
11969
|
-
music_id:
|
|
11970
|
-
music_end_time: 0,
|
|
11971
|
-
hot_sentence: "",
|
|
11972
|
-
visibility_type: 0,
|
|
11973
|
-
download: 0,
|
|
11974
|
-
timing: -1,
|
|
11975
|
-
media_type: 2,
|
|
12242
|
+
music_id: params.musicId,
|
|
12243
|
+
music_end_time: 1000 * (params.musicDuration || 0),
|
|
12244
|
+
hot_sentence: params.hotSentence || "",
|
|
12245
|
+
visibility_type: params.visibleRange || 0,
|
|
12246
|
+
download: params.allowSave ? 1 : 0,
|
|
12247
|
+
timing: params.isImmediatelyPublish ? -1 : params.scheduledPublish,
|
|
12248
|
+
media_type: params.publishType || 2,
|
|
11976
12249
|
images: []
|
|
11977
12250
|
},
|
|
11978
12251
|
cover: {
|
|
11979
12252
|
poster: ""
|
|
11980
12253
|
},
|
|
11981
|
-
mix: {},
|
|
11982
|
-
anchor: {
|
|
11983
|
-
poi_name: "",
|
|
11984
|
-
poi_id: "",
|
|
11985
|
-
anchor_content: "{}"
|
|
11986
|
-
},
|
|
12254
|
+
mix: params.mix || {},
|
|
12255
|
+
anchor: {},
|
|
11987
12256
|
declare: {
|
|
11988
|
-
user_declare_info: "{}"
|
|
12257
|
+
user_declare_info: params.selfDeclaration || "{}"
|
|
11989
12258
|
}
|
|
11990
12259
|
}
|
|
11991
12260
|
};
|
|
@@ -12316,6 +12585,13 @@ const DouyinPublishParamsSchema = ActionCommonParamsSchema.extend({
|
|
|
12316
12585
|
content: schemas_string(),
|
|
12317
12586
|
coverImage: schemas_string().optional(),
|
|
12318
12587
|
videoFile: schemas_string().optional(),
|
|
12588
|
+
musicId: schemas_string(),
|
|
12589
|
+
musicDuration: schemas_number().optional(),
|
|
12590
|
+
textExtra: schemas_string(),
|
|
12591
|
+
challengeIds: schemas_string(),
|
|
12592
|
+
hashtagSource: schemas_string(),
|
|
12593
|
+
hotSentence: schemas_string(),
|
|
12594
|
+
mix: custom().optional(),
|
|
12319
12595
|
address: schemas_object({
|
|
12320
12596
|
id: schemas_string(),
|
|
12321
12597
|
name: schemas_string(),
|
|
@@ -12337,8 +12613,7 @@ const DouyinPublishParamsSchema = ActionCommonParamsSchema.extend({
|
|
|
12337
12613
|
isImmediatelyPublish: schemas_boolean().optional(),
|
|
12338
12614
|
scheduledPublish: schemas_string().optional(),
|
|
12339
12615
|
isOriginal: schemas_boolean().optional(),
|
|
12340
|
-
|
|
12341
|
-
allowCopy: schemas_boolean().optional(),
|
|
12616
|
+
allowSave: schemas_boolean().optional(),
|
|
12342
12617
|
publishType: schemas_enum([
|
|
12343
12618
|
"1",
|
|
12344
12619
|
"2",
|
|
@@ -14121,8 +14396,8 @@ const searchXiaohongshuUserArticle = async (_task, params)=>{
|
|
|
14121
14396
|
const message = `用户文章信息获取${isSuccess ? "成功!" : "失败,请检查!"}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
14122
14397
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, INITIAL_STATE);
|
|
14123
14398
|
};
|
|
14124
|
-
const
|
|
14125
|
-
const
|
|
14399
|
+
const toutiaoLogin_rpa_scanRetryMaxCount = 60;
|
|
14400
|
+
const toutiaoLogin_rpa_waitQrcodeResultMaxTime = 2000 * toutiaoLogin_rpa_scanRetryMaxCount;
|
|
14126
14401
|
const toutiaoLogin_rpa_rpaAction = async (task, _params)=>{
|
|
14127
14402
|
const reporter = task.reportService?.reportLoginStatus ?? (()=>Promise.resolve());
|
|
14128
14403
|
let page;
|
|
@@ -14167,7 +14442,7 @@ const toutiaoLogin_rpa_rpaAction = async (task, _params)=>{
|
|
|
14167
14442
|
let finished = false;
|
|
14168
14443
|
const timer = setTimeout(()=>{
|
|
14169
14444
|
cleanup(statusMachine);
|
|
14170
|
-
},
|
|
14445
|
+
}, toutiaoLogin_rpa_waitQrcodeResultMaxTime);
|
|
14171
14446
|
const cleanup = (status)=>{
|
|
14172
14447
|
if (finished) return;
|
|
14173
14448
|
finished = true;
|
|
@@ -14266,10 +14541,9 @@ const toutiaoLogin_rpa_server_rpaServer = async (task, params)=>{
|
|
|
14266
14541
|
params.accountId
|
|
14267
14542
|
];
|
|
14268
14543
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
14269
|
-
const
|
|
14544
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
14270
14545
|
logger: task.logger
|
|
14271
|
-
});
|
|
14272
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
14546
|
+
}, ...args);
|
|
14273
14547
|
task.logger?.info("==> 代理信息获取成功!");
|
|
14274
14548
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
14275
14549
|
}
|
|
@@ -15309,10 +15583,9 @@ const weixinLogin_rpa_server_rpaServer = async (task, params)=>{
|
|
|
15309
15583
|
params.accountId
|
|
15310
15584
|
];
|
|
15311
15585
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
15312
|
-
const
|
|
15586
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
15313
15587
|
logger: task.logger
|
|
15314
|
-
});
|
|
15315
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
15588
|
+
}, ...args);
|
|
15316
15589
|
task.logger?.info("==> 代理信息获取成功!");
|
|
15317
15590
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
15318
15591
|
}
|
|
@@ -17225,10 +17498,9 @@ const xiaohongshuLogin_rpa_server_rpaServer = async (task, params)=>{
|
|
|
17225
17498
|
params.accountId
|
|
17226
17499
|
];
|
|
17227
17500
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
17228
|
-
const
|
|
17501
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
17229
17502
|
logger: task.logger
|
|
17230
|
-
});
|
|
17231
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
17503
|
+
}, ...args);
|
|
17232
17504
|
task.logger?.info("==> 代理信息获取成功!");
|
|
17233
17505
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
17234
17506
|
}
|
|
@@ -18061,10 +18333,9 @@ const rpaAction_Server = async (task, params)=>{
|
|
|
18061
18333
|
params.accountId
|
|
18062
18334
|
];
|
|
18063
18335
|
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
18064
|
-
const
|
|
18336
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
18065
18337
|
logger: task.logger
|
|
18066
|
-
});
|
|
18067
|
-
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
18338
|
+
}, ...args);
|
|
18068
18339
|
task.logger?.info("==> 代理信息获取成功!");
|
|
18069
18340
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
18070
18341
|
}
|