From a5002fb9bb104013dd5094f0a32ae37d67107e03 Mon Sep 17 00:00:00 2001 From: liuweiqing Date: Thu, 5 Sep 2024 11:34:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=86?= =?UTF-8?q?=E6=89=B9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bypasscf_likeUser.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bypasscf_likeUser.js b/bypasscf_likeUser.js index b30f5300..d81c4949 100644 --- a/bypasscf_likeUser.js +++ b/bypasscf_likeUser.js @@ -14,10 +14,6 @@ const runTimeLimitMinutes = process.env.RUN_TIME_LIMIT_MINUTES || 15; // 将分钟转换为毫秒 const runTimeLimitMillis = runTimeLimitMinutes * 60 * 1000; -const maxConcurrentAccounts = 4; // 每批最多同时运行的账号数 -const totalAccounts = usernames.length; // 总的账号数 -const delayBetweenBatches = - runTimeLimitMillis / Math.ceil(totalAccounts / maxConcurrentAccounts); console.log( `运行时间限制为:${runTimeLimitMinutes} 分钟 (${runTimeLimitMillis} 毫秒)` @@ -51,6 +47,11 @@ if (fs.existsSync(".env.local")) { const token = process.env.TELEGRAM_BOT_TOKEN; const chatId = process.env.TELEGRAM_CHAT_ID; const specificUser = process.env.SPECIFIC_USER || "14790897"; +const maxConcurrentAccounts = 4; // 每批最多同时运行的账号数 +const totalAccounts = usernames.length; // 总的账号数 +const delayBetweenBatches = + runTimeLimitMillis / Math.ceil(totalAccounts / maxConcurrentAccounts); + let bot; if (token && chatId) { bot = new TelegramBot(token); @@ -82,7 +83,7 @@ function delayClick(time) { try { if (usernames.length !== passwords.length) { console.log(usernames.length, usernames, passwords.length, passwords); - throw new error("用户名和密码的数量不匹配!"); + throw new Error("用户名和密码的数量不匹配!"); } // 并发启动浏览器实例进行登录 @@ -256,7 +257,7 @@ async function launchBrowserForUser(username, password) { waitUntil: "domcontentloaded", }); } - return browser + return browser; } catch (err) { // throw new Error(err); console.log("Error:", err);