From ddca560681fe328ecc797cbd0cdf6283335b0f2d Mon Sep 17 00:00:00 2001 From: hmz Date: Wed, 28 Oct 2026 16:51:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E4=BC=98=E5=8C=96=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=8A=96=E9=9F=B3=E6=9E=81?= =?UTF-8?q?=E9=80=9F=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 106 -- douyin_auto/douyin-lite.js | 945 ++++++++++++++++++ douyin_auto/repair-notes.md | 20 + douyin_auto/tests/earning-navigation.test.js | 85 ++ .../tests/fixtures/vivo-home-native.json | 68 ++ douyin_auto/tests/fixtures/vivo-home-ocr.json | 172 ++++ .../tests/fixtures/vivo-task-overlay.json | 73 ++ .../tests/fixtures/vivo-thirty-day-card.json | 278 ++++++ .../fixtures/vivo-thirty-day-verification.log | 9 + douyin_auto/tests/thirty-day-video.test.js | 83 ++ fanqie_auto/fanqie-daily.auto.js | 6 +- fanqie_auto/fanqie-flow.md | 6 + .../fixtures/vivo-invite-cash-popup.json | 1 - .../tests/fixtures/vivo-raffle-popup.json | 1 - .../fixtures/vivo-recommendation-popup.json | 1 - fanqie_auto/tests/invite-cash.test.js | 66 -- hongguo_auto/README.md | 6 + hongguo_auto/hongguo-daily.auto.js | 37 +- hongguo_auto/tests/drama-choice.test.js | 6 - .../tests/fixtures/oppo-drama-choice.json | 1 - huolong_auto/README.md | 15 + huolong_auto/huolong-daily.auto.js | 208 +++- kuaishou_auto/kuaishou-daily.auto.js | 40 +- kuaishou_auto/repair-notes.md | 14 + .../tests/fixtures/vivo-ad-reward.json | 1 - .../tests/fixtures/vivo-continuous-video.json | 1 - .../tests/fixtures/vivo-search-list.json | 1 - kuaishou_auto/tests/native-snapshot.test.js | 54 - 28 files changed, 2035 insertions(+), 269 deletions(-) delete mode 100644 .idea/workspace.xml create mode 100644 douyin_auto/douyin-lite.js create mode 100644 douyin_auto/repair-notes.md create mode 100644 douyin_auto/tests/earning-navigation.test.js create mode 100644 douyin_auto/tests/fixtures/vivo-home-native.json create mode 100644 douyin_auto/tests/fixtures/vivo-home-ocr.json create mode 100644 douyin_auto/tests/fixtures/vivo-task-overlay.json create mode 100644 douyin_auto/tests/fixtures/vivo-thirty-day-card.json create mode 100644 douyin_auto/tests/fixtures/vivo-thirty-day-verification.log create mode 100644 douyin_auto/tests/thirty-day-video.test.js delete mode 100644 fanqie_auto/tests/fixtures/vivo-invite-cash-popup.json delete mode 100644 fanqie_auto/tests/fixtures/vivo-raffle-popup.json delete mode 100644 fanqie_auto/tests/fixtures/vivo-recommendation-popup.json delete mode 100644 fanqie_auto/tests/invite-cash.test.js delete mode 100644 hongguo_auto/tests/drama-choice.test.js delete mode 100644 hongguo_auto/tests/fixtures/oppo-drama-choice.json delete mode 100644 kuaishou_auto/tests/fixtures/vivo-ad-reward.json delete mode 100644 kuaishou_auto/tests/fixtures/vivo-continuous-video.json delete mode 100644 kuaishou_auto/tests/fixtures/vivo-search-list.json delete mode 100644 kuaishou_auto/tests/native-snapshot.test.js diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index d084d03..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1792990798633 - - - - - - - - - - - \ No newline at end of file diff --git a/douyin_auto/douyin-lite.js b/douyin_auto/douyin-lite.js new file mode 100644 index 0000000..4686ca8 --- /dev/null +++ b/douyin_auto/douyin-lite.js @@ -0,0 +1,945 @@ +"auto"; +// AutoJs6 抖音极速版初版;参考用户提供的快手脚本。仅本地 OCR,不上传图片。 +// 无实机已跑通声明;未知状态停止,预约、商城、购买、邀请等不执行。 +var CONFIG = { + version: "2026-10-28-douyin-lite-v3-thirty-day-video", + packageName: "com.ss.android.ugc.aweme.lite", + pollMs: 1200, recognitionTimeoutMs: 30000, capturePermissionTimeoutMs: 60000, + captureRecoveryLimit: 2, useLocalOcr: true, roundTimeoutMs: 300000, + taskSearchScrolls: 16, noProgressLimit: 3, sessionTimeoutMs: 5400000, + minRewardCoins: 1, inspectOnly: false, + logPath: "/sdcard/Download/douyin-lite-run.log", + pageTextPath: "/sdcard/Download/douyin-lite-page.json", + resultPath: "/sdcard/Download/douyin-lite-result.json" +}; +var localOcrEnabled = false; +var captureQueue = null, captureWorker = null, captureRecoveries = 0; +var rejection = null, rewardSerial = 0, currentRoundRewardCoins = null; +var nextScreenKeepAliveAt = 0; + +function writeRunLog(message) { + var line = new Date().toISOString() + " " + message; + log(line); + files.append(CONFIG.logPath, line + "\n"); +} + +// 各脚本保持可单独复制运行;共同启动行为由跨脚本回归测试验证。 +var nextScreenKeepAliveAt = 0; + +function keepScreenAwake() { + if (typeof device === "undefined" || typeof device.keepScreenOn !== "function" || Date.now() < nextScreenKeepAliveAt) return; + device.keepScreenOn(3600000); + nextScreenKeepAliveAt = Date.now() + 60000; +} + +function releaseScreenAwake() { + nextScreenKeepAliveAt = 0; + if (typeof device !== "undefined" && typeof device.cancelKeepingAwake === "function") device.cancelKeepingAwake(); +} + +function waitStartupPackage(packageName, timeoutMs) { + var deadline = Date.now() + timeoutMs; + while (Date.now() < deadline) { + keepScreenAwake(); + if (foregroundPackage() === packageName) return; + sleep(200); + } + throw new Error("等待应用进入前台超时:" + packageName); +} + +function clickStartupNode(node) { + for (var depth = 0; node && depth < 4; depth++, node = node.parent()) { + if (!node.enabled()) return false; + if (node.clickable()) return node.click(); + } + return false; +} + +function prepareCaptureForeground() { + keepScreenAwake(); + auto.waitFor(); + var staleTitle = textMatches(/.*AutoJs6.*(?:录制|投放|投射|截取|共享|分享|screen|capture).*/i).packageName("com.android.systemui").findOnce(); + var cancel = staleTitle && textMatches(/^(?:取消|Cancel)$/i).packageName("com.android.systemui").findOnce(); + if (cancel && clickStartupNode(cancel)) sleep(400); + var hostPackage = String(context.getPackageName()); + if (foregroundPackage() !== hostPackage && !app.launchPackage(hostPackage)) throw new Error("无法将 AutoJs6 切到前台申请截屏授权"); + waitStartupPackage(hostPackage, 8000); + sleep(400); +} +// 仅处理系统的 AutoJs6 录屏对话框,不处理应用里的“允许”等按钮。 + +function approveCaptureDialog(state) { + var verified = false; + var deadline = Date.now() + CONFIG.capturePermissionTimeoutMs; + while (state.pending && Date.now() < deadline) { + if (foregroundPackage() === "com.android.systemui") { + var title = textMatches(/.*AutoJs6.*(?:录制|投放|投射|截取|共享|分享|screen|capture).*/i).packageName("com.android.systemui").findOnce(); + if (title) verified = true; + if (verified) { + var whole = textMatches(/^(?:整个屏幕|Entire screen|Full screen)$/i).packageName("com.android.systemui").findOnce(); + var single = textMatches(/^(?:单个应用|单个应用程序|A single app|Single app)$/i).packageName("com.android.systemui").findOnce(); + if (single && !whole) clickStartupNode(single); + else if (whole && !title) clickStartupNode(whole); // 展开的范围菜单 + else if (title && !single) { + var allow = textMatches(/^(?:开始|立即开始|允许|Start now|Start|Allow)$/i).packageName("com.android.systemui").findOnce(); + if (allow && clickStartupNode(allow)) writeRunLog("CAPTURE APPROVE: 已确认 AutoJs6 系统截屏授权。"); + } + } + } else verified = false; + sleep(200); + } +} + +function requestLocalCapture() { + prepareCaptureForeground(); + var state = {pending: true}; + var approver = threads.start(function () { approveCaptureDialog(state); }); + try { + return requestScreenCapture(false); + } finally { + state.pending = false; + approver.interrupt(); + approver.join(1500); + if (approver.isAlive()) { + var error = new Error("截屏授权辅助线程未退出,不能继续操作页面"); + error.unsafeWorker = true; + throw error; + } + } +} + +function boundedCall(name, timeoutMs, action) { + var result; + var failure; + var worker = threads.start(function () { + try { result = action(); } catch (error) { failure = error; } + }); + var deadline = Date.now() + timeoutMs; + try { + while (worker.isAlive() && Date.now() < deadline) sleep(100); + if (worker.isAlive()) { + worker.interrupt(); + worker.join(1500); + var timeout = new Error(name + "超时(" + timeoutMs + "ms)"); + if (worker.isAlive()) timeout.unsafeWorker = true; + throw timeout; + } + if (failure) throw failure; + return result; + } finally { + if (worker.isAlive()) { + worker.interrupt(); + worker.join(1500); + if (worker.isAlive()) { + var unsafe = new Error(name + "的线程无法终止,不能让旧任务与下一任务同时点击"); + unsafe.unsafeWorker = true; + throw unsafe; + } + } + } +} + +function compact(value) { + var text = String(value || "").replace(/[\s\u200b-\u200d\uFEFF]+/g, "").replace(/領/g, "领").replace(/貼/g, "贴").replace(/朴贴/g, "补贴") + .replace(/視/g, "视").replace(/頻/g, "频").replace(/賺/g, "赚").replace(/贏/g, "赢").replace(/^[||「『]+|[||]+$/g, ""); + return /^(?:close[_-]?button|关闭按钮)$/i.test(text) ? "关闭" : text; +} + +function rectOf(bounds) { + if (!bounds) return null; + function numberAt(name) { + return Number(typeof bounds[name] === "function" ? bounds[name]() : bounds[name]); + } + var rect = {left: numberAt("left"), top: numberAt("top"), + right: numberAt("right"), bottom: numberAt("bottom")}; + if (!isFinite(rect.left) || !isFinite(rect.top) || !isFinite(rect.right) || + !isFinite(rect.bottom) || rect.right <= rect.left || rect.bottom <= rect.top) return null; + if (rect.left < 0 || rect.top < 0 || rect.right > device.width || rect.bottom > device.height) return null; + return rect; +} + +// 整次运行复用同一截图线程,避免每次识别创建新的投影显示。 + +function captureCall(name, timeoutMs, action) { + if (!captureWorker || !captureWorker.isAlive()) { + captureQueue = new java.util.concurrent.LinkedBlockingQueue(); + captureWorker = threads.start(function () { + while (!java.lang.Thread.currentThread().isInterrupted()) { + var job = captureQueue.take(); + try { job.value.set({value: job.action()}); } + catch (error) { job.value.set({error: error}); } + } + }); + } + var result = new java.util.concurrent.atomic.AtomicReference(); + captureQueue.put({action: action, value: result}); + var deadline = Date.now() + timeoutMs; + while (result.get() === null && Date.now() < deadline) sleep(100); + var done = result.get(); + if (done === null) { + captureWorker.interrupt(); + captureWorker.join(1500); + var timeout = new Error(name + "超时,页面读取或截图通道不可用"); + timeout.unsafeWorker = true; + throw timeout; + } + if (done.error) throw done.error; + return done.value; +} + +function initLocalOcr() { + if (!CONFIG.useLocalOcr || typeof $ocr === "undefined" || typeof $ocr.detect !== "function") { + log("未检测到本地 $ocr.detect,仅使用无障碍文字;识别不到时停止,不按旧坐标点击。"); + return; + } + captureCall("申请截图", CONFIG.capturePermissionTimeoutMs, function () { + // Android 14+ 不允许复用同一个授权令牌创建第二个显示。 + // 本任务为竖屏,固定方向可避免 AUTO 模式在页面切换后重建显示。 + if (!requestLocalCapture()) stopWith("未获得本机截屏权限;无需上传图片。"); + localOcrEnabled = true; + }); +} + +function isProjectionFailure(error) { + return /MediaProjection|VirtualDisplay|resultData|projection instance|Failed to capture screen|截图通道不可用/.test(String(error)); +} + +function readPage(name) { + try { + return captureCall(name, CONFIG.recognitionTimeoutMs, readSnapshot); + } catch (error) { + if (error.unsafeWorker || !isProjectionFailure(error)) throw error; + if (captureRecoveries >= CONFIG.captureRecoveryLimit) { + error.captureFatal = true; + writeRunLog("截图通道连续失效,结束本次运行;不能将识别故障当作类目缺失。"); + throw error; + } + captureRecoveries++; + writeRunLog("CAPTURE RECOVER: " + captureRecoveries + "/" + CONFIG.captureRecoveryLimit + ";释放失效投影并重新申请本机截屏。"); + try { + captureCall("恢复截图授权", CONFIG.capturePermissionTimeoutMs, function () { + images.stopScreenCapture(); + if (!requestLocalCapture()) throw new Error("恢复截图授权未获允许"); + if (!app.launchPackage(CONFIG.packageName)) throw new Error("截图恢复后无法返回目标应用"); + waitStartupPackage(CONFIG.packageName, 10000); + sleep(500); + }); + var page = captureCall("恢复后重新识别", CONFIG.recognitionTimeoutMs, readSnapshot); + writeRunLog("CAPTURE RECOVERED: 本机页面识别已恢复。"); + return page; + } catch (recoveryError) { + recoveryError.captureFatal = true; + throw recoveryError; + } + } +} + +function foregroundPackage() { + var root = auto.service ? auto.service.getRootInActiveWindow() : auto.rootInActiveWindow; + return root ? String(root.getPackageName()) : ""; +} + +function stopWith(message) { throw new Error(message); } + +function first(page, pattern, predicate) { + for (var i = 0; i < page.length; i++) { + if (pattern.test(page[i].text) && (!predicate || predicate(page[i]))) return page[i]; + } + return null; +} +// 只取明确到账文案,不能把“最高1金币”、余额或任务说明当成本轮收益。 + +function recordRewardCoins(value) { + var match = /^(?:已成功领取|成功领取|恭喜获得|已获得|获得|领取成功[::]?)(\d+(?:,\d{3})*)金币$/.exec(compact(value)); + if (!match) return; + var amount = Number(match[1].replace(/,/g, "")); + if (currentRoundRewardCoins !== 1) currentRoundRewardCoins = amount; +} + +function checkRejection(page) { + var item = first(page, /设备异常|账号异常|操作异常|存在风险|风险行为|领取失败|操作过于频繁|操作频繁|任务失败/); + if (rejection || item) throw new Error("[NO_RETRY] 平台拒绝:" + (rejection || item.text)); +} + +function readSnapshot() { + keepScreenAwake(); + var foreground = foregroundPackage(), deadline = Date.now() + 1500; + // 切页时无障碍窗口可能短暂为空,确认后再判断是否真的离开应用。 + while (foreground !== CONFIG.packageName && Date.now() < deadline) { + sleep(150); + foreground = foregroundPackage(); + } + if (foreground !== CONFIG.packageName) throw new Error("页面离开抖音极速版(" + foreground + "),停止本轮操作"); + // 一次读取目标应用节点,避免分别按文字、描述、ID重复扫描整棵窗口树。 + // vivo 上切页期间重复全窗口查询可能累积超过识别期限。 + var items = []; + var nodes = packageName(CONFIG.packageName).find(); + for (var i = 0; i < nodes.size(); i++) { + var node = nodes.get(i), box = rectOf(node.bounds()); + if (!box || !node.visibleToUser()) continue; + var resourceId = String(node.id() || ""), enabled = node.enabled(); + var values = [compact(node.text()), compact(node.desc())]; + // vivo 的赚钱入口是无文字图片,保留实际控件,后续结合底部导航验证。 + if (!values[0] && !values[1] && resourceId === CONFIG.packageName + ":id/ki3") { + values.push("@douyin_earning_tab"); + } + if (!values[0] && /:id\/(?:video_countdown|video_countdown_end_icon|tt_video_ad_close|tt_reward_ad_close|tt_reward_full_video_close_btn|.*close.*)$/.test(resourceId)) { + values.push("@" + resourceId.split("/").pop()); + } + for (var v = 0; v < values.length; v++) { + if (values[v] && values[v].length < 120) { + items.push({text: values[v], rect: box, node: node, id: resourceId, enabled: enabled}); + } + } + } + if (localOcrEnabled && needsLocalOcr(items)) { + var frame = null; + try { + frame = images.copy(captureScreen()); + var results = $ocr.detect(frame); + if (!Array.isArray(results)) throw new Error("本地 OCR 格式不兼容"); + results.forEach(function (result) { + var box = rectOf(result.bounds), value = compact(result.text); + if (box && value && value.length < 120) items.push({text: value, rect: box, node: null}); + }); + } finally { if (frame) frame.recycle(); } + } + var unique = []; + items.forEach(function (item) { + if (!unique.some(function (other) { + return other.text === item.text && Math.abs(other.rect.top - item.rect.top) < 35 && + Math.abs(other.rect.left - item.rect.left) < 35; + })) unique.push(item); + }); + files.write(CONFIG.pageTextPath, JSON.stringify(unique.map(function (item) { + return {text: item.text, rect: item.rect, id: item.id, enabled: item.enabled}; + }))); + unique.forEach(function (item) {recordRewardCoins(item.text);}); + checkRejection(unique); + return unique; +} + +function clickItem(item) { + if (!item || item.enabled === false) throw new Error("目标按钮不存在或不可点击"); + if (foregroundPackage() !== CONFIG.packageName) throw new Error("点击前已离开抖音"); + var ok = false; + if (item.node) { + try { + if (item.node.clickable()) ok = item.node.click(); + else { + var parent = item.node.parent(), bounds = parent && rectOf(parent.bounds()); + // 只向上一层点击紧贴文字的小按钮,不能点击整行任务或整页容器。 + if (bounds && parent.enabled() && parent.clickable() && + bounds.left <= item.rect.left && bounds.right >= item.rect.right && + bounds.top <= item.rect.top && bounds.bottom >= item.rect.bottom && + bounds.right - bounds.left < device.width * 0.5 && + bounds.bottom - bounds.top < device.height * 0.12) ok = parent.click(); + } + } catch (ignore) {} + } + if (!ok) ok = press(Math.round((item.rect.left + item.rect.right) / 2), + Math.round((item.rect.top + item.rect.bottom) / 2), 80); + if (!ok) throw new Error("点击未响应:" + item.text); + writeRunLog("CLICK: " + item.text); + sleep(CONFIG.pollMs); +} + +function sameItem(page, old) { + return first(page, {test: function (value) { return value === old.text; }}, function (item) { + return Math.abs(item.rect.top - old.rect.top) < 45 && Math.abs(item.rect.left - old.rect.left) < 45; + }); +} + +function tapFresh(item, resolveFresh) { + var page = snapshot(), fresh = resolveFresh ? resolveFresh(page) : sameItem(page, item); + // 弹窗自行消失时重新识别页面,不追点旧叉号。 + if (!fresh && resolveFresh) return false; + clickItem(fresh); + return true; +} + +function scrollList(down) { + if (foregroundPackage() !== CONFIG.packageName) throw new Error("滑动前已离开抖音"); + var x = Math.round(device.width * 0.37); + if (!swipe(x, device.height * (down ? 0.79 : 0.32), x, + device.height * (down ? 0.34 : 0.77), 800)) throw new Error("任务列表滑动失败"); + sleep(CONFIG.pollMs); +} + +function pageSignature(page) { + var nativeItems = page.filter(function (item) {return !!item.node;}); + var stable = nativeItems.length ? nativeItems : page; + return stable.filter(function (item) { + return taskTitle(item) && !/^\d/.test(item.text) && !/\d+[::]\d+/.test(item.text); + }).map(function (item) {return item.text;}).sort().join("|"); +} + +function scanTask(pattern, excluded) { + ensureTaskCenter(); + // 先向上扫描,再由顶部向下完整扫描;未找到的任务必须复查第二遍。 + for (var direction = 0; direction < 2; direction++) { + var prior = "", stationary = 0; + for (var i = 0; i <= CONFIG.taskSearchScrolls; i++) { + var page = snapshot(); + if (dismissModal(page)) {page = snapshot();} + if (!isTaskCenter(page)) { + writeRunLog("TASK PAGE RECHECK: 浮层或加载遮挡,重新确认任务中心"); + page = ensureTaskCenter(); + } + var rows = rowsOnPage(page, pattern).filter(function (row) {return !excluded || !excluded[row.title];}); + if (rows.length) return rows[0]; + var signature = pageSignature(page); + stationary = signature === prior ? stationary + 1 : 0; + if (stationary >= 2) break; + prior = signature; + if (i === CONFIG.taskSearchScrolls) throw new Error("列表超过扫描范围,不能判断任务已消失"); + scrollList(direction === 1); + } + } + return null; +} + +function locateTask(pattern, excluded) { + var row = scanTask(pattern, excluded); + return row || scanTask(pattern, excluded); +} + +function exactTitle(title) { return {test: function (value) {return value === title;}}; } + +function prepareRow(row) { + for (var i = 0; i < 5; i++) { + var fresh = rowsOnPage(snapshot(), exactTitle(row.title))[0]; + if (!fresh) return null; + if (fresh.unavailable) return fresh; + if (fresh.action && fresh.action.rect.top > device.height * 0.18 && + fresh.action.rect.bottom < device.height * 0.70) return fresh; + // 避免右下悬浮宝箱遮挡;移动后必须重新识别同一行。 + var low = fresh.label.rect.top > device.height * 0.55; + var x = device.width * 0.37, start = device.height * (low ? 0.70 : 0.40); + swipe(x, start, x, start + device.height * (low ? -0.20 : 0.20), 800); + sleep(CONFIG.pollMs); + } + throw new Error("任务按钮无法移入安全区域:" + row.title); +} + +function installToastObserver() { + events.observeToast(); + events.onToast(function (event) { + if (String(event.getPackageName()) !== CONFIG.packageName) return; + var value = compact(event.getText()); + recordRewardCoins(value); + if (/设备异常|账号异常|操作异常|领取失败|操作频繁|操作过于频繁|存在风险/.test(value)) rejection = value; + if (/领取成功|已获得\d+金币|金币已到账|成功领取\d+金币/.test(value)) rewardSerial++; + writeRunLog("APP TOAST: " + value); + }); +} + +var TASK_TITLE = /^(?:每日签到|每日签到领金币|签到|签到领金币|开宝箱|开宝箱得金币|开宝箱领金币|开宝箱赚金币|看广告赚金币|看广告得金币|看视频赚金币|看视频得金币|看广告领金币|看视频领金币|吃饭补贴|吃饭领金币|到饭点领饭补|领饭补|搜索赚金币|搜索得金币|搜索领金币|搜索看广告|逛街赚金币|逛街领金币|逛街得金币|浏览赚金币|浏览领金币|看视频阶段奖励|看视频领大奖|连续看视频领金币|连续看视频\d+天)$/; +var BLOCKED_TASK = /预约|明日0点|商城|购物|下单|购买|支付|充值|提现|邀请|好友|分享|授权|安装|下载|开通|抽奖|转盘|直播|关注|点赞|评论/; +var STAGES = [ + {name:"每日签到", title:/^(?:每日签到(?:领金币)?|签到(?:领金币)?)$/, kind:"signin", maxRounds:1}, + {name:"开宝箱", title:/^开宝箱(?:[得领赚]金币)?$/, kind:"chest", maxRounds:1}, + {name:"看广告/视频赚金币", title:/^看(?:广告|视频)[赚得领]金币$/, kind:"ad", maxRounds:30}, + {name:"吃饭补贴", title:/^(?:吃饭补贴|吃饭领金币|到饭点领饭补|领饭补)$/, kind:"meal", maxRounds:3}, + {name:"搜索赚金币", title:/^(?:搜索[赚得领]金币|搜索看广告)$/, kind:"search", maxRounds:10}, + {name:"逛街/浏览金币", title:/^(?:逛街[赚领得]金币|浏览[赚领]金币)$/, kind:"browse", maxRounds:10}, + {name:"连续看视频30天", kind:"feed30"} +]; +var earningPattern = /^[((]?(?:赚钱|去赚钱|赚金币|赚钱中心)[))]?$/; +var sessionStartedAt = 0, adContext = false, observedTasks = {}, results = []; +function checkBudget() { + if (Date.now() - sessionStartedAt > CONFIG.sessionTimeoutMs) throw new Error("[STOP] 达到整次运行时间上限,未完成项保留为待验证"); +} +function snapshot() { checkBudget(); return readPage("识别抖音极速版页面"); } +function needsLocalOcr(page) { + // 抖音 WebView 的任务按钮可能未完整暴露,不套用快手的免 OCR 判断。 + return true; +} +function bottomNavigation(page, pattern) { + return first(page, pattern, function (item) { + return item.rect.top > device.height * 0.80 && item.rect.bottom < device.height * 0.995 && + item.rect.bottom - item.rect.top < device.height * 0.10; + }); +} +function earningNavigation(page) { + var text = bottomNavigation(page, earningPattern); + if (text) return text; + if (!bottomNavigation(page, /^首页$/) || !bottomNavigation(page, /^我$/)) return null; + return first(page, /^@douyin_earning_tab$/, function (item) { + return item.enabled !== false && item.id === CONFIG.packageName + ":id/ki3" && + item.rect.left > device.width * 0.30 && item.rect.right < device.width * 0.70 && + item.rect.top > device.height * 0.85 && item.rect.bottom <= device.height && + item.rect.bottom - item.rect.top < device.height * 0.10; + }); +} +function canonicalTaskTitle(value) { + return compact(value).replace(/(?:全币|金市)/g,"金币") + .replace(/(?:[參参]?最高|可得|奖励)?[++]?\d+(?:,\d{3})*(?:金币)?$/, ""); +} +function isTaskCenter(page) { + var labels = page.filter(function (item) { return TASK_TITLE.test(canonicalTaskTitle(item.text)); }); + var heading = first(page,/^(?:任务中心|赚钱中心|日常任务|每日任务|金币任务|赚金币)$/, function(item){return item.rect.top < device.height*0.55 && item.rect.bottom < device.height*0.75;}); + var wallet = first(page,/^(?:我的金币|现金收益|金币收益|现金余额|我的收益|金币余额)$/); + var mergedWallet = first(page, /^[く<〈]?金币收益[\d,]+现金收益[\d.,]+$/, function (item) { + return item.rect.top < device.height * 0.15; + }); + var nav = earningNavigation(page); + var taskRow = labels.some(function(label){return !!first(page,ACTION_PATTERN,function(item){ + return item.rect.left>device.width*0.63 && Math.abs(item.rect.top-label.rect.top)= 2) || !!(mergedWallet && taskRow); +} +function isHome(page) { + return !!bottomNavigation(page,/^首页$/) && !!earningNavigation(page) && + !!first(page,/^(?:推荐|关注|朋友|精选|同城)$/) && !isTaskCenter(page); +} +function adCountdown(page) { + return first(page,/(?:\d+(?:秒|s)后(?:可)?(?:领取|获得|领奖|关闭|跳过)|(?:再看|观看|剩余)\d+(?:秒|s).*(?:奖励|金币)|奖励将在\d+)/i, + function (item) { return item.rect.top < device.height * 0.40; }) || + first(page,/.+/,function(item) { return /:id\/(?:tt_reward_countdown|tt_video_reward_time|video_countdown|ksad_video_count_down)/.test(item.id||""); }); +} +function adReward(page) { + return !!first(page,/^(?:已成功领取奖励|奖励已到账|已获得奖励|奖励领取成功|已领取奖励|已领取\d+金币|已获得\d+金币|恭喜获得\d+金币|奖励已发放)(?:[!!])?$/, + function(item) {return item.rect.top < device.height * 0.40;}); +} +function isAd(page) { + return !!adCountdown(page) || !!first(page,/.+/,function(item) { + return /:id\/(?:tt_reward_ad|tt_video_ad|tt_reward_root|ksad_reward|video_countdown_end_icon)/.test(item.id||""); + }) || !!(first(page,/^广告$/,function(item){return item.rect.top < device.height*0.20;}) && adReward(page)); +} +function adClose(page) { + if (!adReward(page)) return null; + return first(page,/^(?:关闭广告|关闭|[xX×✕]|@video_countdown_end_icon|@tt_video_ad_close|@tt_reward_ad_close|@tt_reward_full_video_close_btn)$/, + function(item) {return item.rect.top < device.height * 0.25 && item.rect.right-item.rect.left < device.width*0.20;}); +} +function modalClose(page) { + if (isAd(page) || adContext) return null; + var heading = first(page,/^(?:签到成功|任务奖励|任务完成奖励|恭喜获得\d+金币|领取成功|金币已到账)$/); + if (!heading) return null; + return first(page,/^(?:关闭弹窗|关闭|[xX×✕]|开心收下|收下金币|我知道了|好的)$/, + function(item){return item.enabled !== false && item.rect.top > device.height*0.15;}); +} +function dismissModal(page) { + var close = modalClose(page); + return close ? tapFresh(close,modalClose) : false; +} +function ensureTaskCenter() { + var deadline = Date.now()+45000; + for (var attempt=0;attempt<10 && Date.now() device.height*0.08 && item.rect.bottom < device.height*0.91 && + item.rect.left < device.width*0.65; +} +function quota(value) { + var m=String(value).match(/(?:已完成)?(\d+)\s*\/\s*(\d+)/); + return m ? {done:Number(m[1]),total:Number(m[2])} : null; +} +var ACTION_PATTERN=/^(?:去完成|去观看|去领取|去查看|去搜索|去浏览|立即领取|看广告|看视频|去看看|去逛逛|去逛街|领金币|领取|签到|立即签到|去签到|开宝箱|立即打开|领取奖励|继续观看|已完成|已领取|明日再来|明天再来|待领取|领取\d+金币)$/; +function rowsOnPage(page, pattern) { + var labels=page.filter(function(item) {return taskTitle(item) && TASK_TITLE.test(canonicalTaskTitle(item.text)) && !BLOCKED_TASK.test(item.text);}); + var rows=[]; + labels.forEach(function(label) { + var title=canonicalTaskTitle(label.text); + if (!pattern.test(title) || rows.some(function(row){return row.title===title;})) return; + var bottom=Math.min(label.rect.top+device.height*0.11,device.height*0.915); + // 被排除的任务也必须作为行边界,否则可能借用预约/商城行的按钮。 + var boundaries=page.filter(function(item){return taskTitle(item) && + (TASK_TITLE.test(canonicalTaskTitle(item.text)) || BLOCKED_TASK.test(item.text));}); + boundaries.forEach(function(other){if(other.rect.top>label.rect.top+device.height*0.025) bottom=Math.min(bottom,other.rect.top-2);}); + var nearby=page.filter(function(item){return item.rect.top>=label.rect.top-device.height*0.018 && item.rect.topdevice.width*0.63 && + Math.abs(item.rect.top-label.rect.top)0 && progress.done>=progress.total) || /今日(?:任务)?已完成|次数已用完|已达上限/.test(detail) || + !!(action && /^(?:已完成|已领取)$/.test(action.text)); + var wait=!complete && (/\d+[::]\d+.*(?:后|开)|(?:后|距离).*\d+[::]\d+|\d+(?:分钟|小时)后|未到领取时间|明日再来|明天再来/.test(detail) || !!(action && action.enabled===false)); + rows.push({title:title,label:label,action:action,detail:detail,quota:progress,unavailable:complete||wait,complete:complete,waiting:wait}); + observedTasks[title]={title:title,detail:detail,hasAction:!!action}; + }); + return rows; +} +function coinBalance(page) { + var label=first(page,/^(?:我的金币|金币余额|金币收益)$/); + if (!label) return null; + var value=first(page,/^\d+(?:,\d{3})*$/,function(item){ + return item.rect.top>=label.rect.top-device.height*0.06 && item.rect.bottom<=label.rect.bottom+device.height*0.08 && + Math.abs(item.rect.left-label.rect.left)2500)) { + adContext=false;return rewardConfirmed; + } + var close=adClose(page); + if (close) { + if (closeAt && Date.now()-closeAt<3000) {sleep(CONFIG.pollMs);continue;} + tapFresh(close,adClose);closeAt=Date.now();continue; + } + // 广告自动返回任务中心也必须先观察到奖励;否则保留未知状态。 + if (!closeAt && rewardConfirmed && isTaskCenter(page)) {adContext=false;return true;} + // 不点击“再看一个”“继续观看”“立即下载”等广告动作。 + sleep(CONFIG.pollMs); + } + throw new Error("[STOP] 广告结束或关闭未确认,停止并保留页面,不用返回键提前退出"); +} +function browseTimer(page) { + return !!first(page,/(?:浏览|搜索|滑动).*(?:\d+(?:秒|s)|倒计时)|(?:剩余|还需)\d+(?:秒|s)|浏览中|计时中/i); +} +function roundUnavailable(page) { + return first(page,/今日(?:任务)?已完成|今日次数已用完|次数已用完|今日已达上限|暂无广告|暂无可用广告|广告加载失败|当前暂无任务|未到领取时间/); +} +function taskClaim(page,kind) { + if (isAd(page) || adContext) return null; + var context=taskReceipt(page) || first(page,/任务奖励|浏览.*金币|搜索.*金币|宝箱奖励|吃饭补贴|签到奖励|领取饭补/); + if (!context) return null; + return first(page,/^(?:领取\d+金币|领取金币|领取奖励|点击领取|开心收下|收下金币|立即收下|立即签到|签到|立即领取饭补|领取饭补|领取补贴)$/, + function(item){return item.enabled!==false && item.rect.top>device.height*0.25 && item.rect.bottom=heading.rect.top && item.rect.bottomdevice.height*.08;}); + if(!heading) return null; + var end=heading.rect.bottom+device.height*.22; + page.forEach(function(i){if(/^(?:日常任务|每日任务)$/.test(i.text)&&i.rect.top>heading.rect.bottom) end=Math.min(end,i.rect.top);}); + if(end>device.height*.94) return null; // 卡片下半截未显示,先滚动再判断。 + var region=page.filter(function(i){return i.rect.top>=heading.rect.top&&i.rect.bottomdevice.width*.05;}); + var today=[]; + days.forEach(function(day,n){ + if(!/^(?:今天|今日)$/.test(day.text)) return; + var center=(day.rect.left+day.rect.right)/2; + var left=n?(center+(days[n-1].rect.left+days[n-1].rect.right)/2)/2:heading.rect.left; + var right=n+1=left&&x=day.rect.top;}); + var claim=first(items,/^(?:领金币|领取|立即领取|领取奖励|待领取|可领取|点击领取|领取\d+金币)$/,function(i){return i.enabled!==false;}); + today.push({items:items,claim:claim,progress:quota(items.map(function(i){return i.text;}).join(" ")), + claimed:!!first(items,/^(?:已领|已领取|已领完|领取成功)$/)}); + }); + var future=days.filter(function(i){return !/^(?:今天|今日)$/.test(i.text);}); + var explicitDone=first(region,/^(?:今日(?:奖励|阶段奖励|任务)?(?:已全部领取|全部领完|已领完|已完成|已达上限)|今日无可领奖励|明日再来|明天再来|明日可领|明天可领|今日奖励暂不可领取)$/,function(i){ + var x=(i.rect.left+i.rect.right)/2; + return !future.some(function(day){return i.rect.top>=day.rect.top&&Math.abs(x-(day.rect.left+day.rect.right)/2)device.width*.65&&i.rect.top=4&&today.every(function(day){return day.claimed;}))), + reason:explicitDone?explicitDone.text:"今天各阶段均显示已领取", + signature:today.map(function(day){return day.items.map(function(i){return i.text;}).filter(function(t,n,a){return a.indexOf(t)===n&&/\d|领|解锁|明[天日]|完成/.test(t);}).sort().join(",");}).join("|")}; +} +function locateThirtyDayCard() { + ensureTaskCenter(); + for(var i=0;i<8;i++) { + var page=snapshot(); + if(dismissModal(page)) continue; + var card=thirtyDayCard(page); + if(card) return card; + var top=first(page,/^返回顶部$/); + if(top&&i===0) tapFresh(top);else scrollList(false); + } + return null; +} +function recommendationFeed(page) { + // 无障碍“视频”是实际 viewpager;直播预览同样有它,但实际直播间没有首页导航。 + return !isTaskCenter(page)&&!isAd(page)&&!!bottomNavigation(page,/^首页$/)&& + !!first(page,/^推荐$/)&&!!first(page,/^视频$/,function(i){return /:id\/viewpager$/.test(i.id||"");}); +} +function swipeNextVideo() { + if(foregroundPackage()!==CONFIG.packageName) throw new Error("观看期间离开抖音极速版"); + if(!swipe(device.width*.4,device.height*.74,device.width*.4,device.height*.3,650)) throw new Error("切换视频失败"); + sleep(CONFIG.pollMs); +} +function watchThirtyDayCycle() { + var deadline=Date.now()+90000, watched=0, skipped=0; + while(Date.now()8) throw new Error("连续遇到直播或图文,未确认有效视频"); + writeRunLog("VIDEO30: 划过直播预览或图文");swipeNextVideo();continue; + } + sleep(15000);keepScreenAwake(); + var latest=snapshot(); + if(!recommendationFeed(latest)) continue; + watched+=15000; + swipeNextVideo(); + } + if(!watched) throw new Error("本轮没有确认普通视频,不能计为完成"); + ensureTaskCenter(); +} +function drainThirtyDayVideo() { + var watched=0,claims=0,stalled=0; + while(true) { + checkBudget(); + var card=locateThirtyDayCard(); + if(!card) return {title:"连续看视频30天",status:"not_found",incomplete:true,reason:"未识别完整30天活动卡,未认定完成"}; + writeRunLog("VIDEO30: 观看轮次="+watched+";今日阶段="+card.signature); + if(card.done) return {title:"连续看视频30天",status:"complete",rounds:watched,claims:claims,reason:card.reason}; + if(!card.today.length) throw new Error("未识别今天奖励列,不点击未来日期奖励"); + var before=card.signature; + if(card.claim) { + var claimIndex=-1; + card.today.forEach(function(day,n){if(day.claim===card.claim) claimIndex=n;}); + if(!tapFresh(card.claim,function(p){var c=thirtyDayCard(p);return c&&c.today[claimIndex]&&c.today[claimIndex].claim;})) continue; + var deadline=Date.now()+15000; + while(Date.now()=5) return {title:"连续看视频30天",status:"unverified",rounds:watched,claims:claims,incomplete:true,reason:"连续5轮观看未确认今日奖励进度,未冒充奖励已领完"}; + } +} +function executeRound(row,kind,options) { + var fresh=kind==="feed" ? rowsOnPage(snapshot(),exactTitle(row.title))[0] : prepareRow(row); + if (!fresh) return {changed:true}; + if (fresh.unavailable) return {unavailable:true,complete:fresh.complete,reason:fresh.waiting?"尚未到时间":"已完成"}; + if (!fresh.action && kind!=="feed") return {incomplete:true,reason:"任务存在但同一行按钮未识别"}; + var toastStart=rewardSerial, deadline=Date.now()+CONFIG.roundTimeoutMs, entered=false; + var firstPageAt=Date.now(), rewardSeen=false, claimed={}, searchAttempts=0; + if (kind==="feed") { + var card=feedCard(snapshot()); + if (!card) return {incomplete:true,reason:"阶段卡片结构未匹配"}; + if(card.done) return {taskDone:true,reason:"今日阶段奖励已完成"}; + var entry=card.claim || card.watch; + if(!entry) return {incomplete:true,reason:"阶段卡片没有已识别的领取或观看入口"}; + tapFresh(entry,function(p){var c=feedCard(p);return c && (card.claim?c.claim:c.watch);}); + } else tapFresh(fresh.action); + while(Date.now()toastStart; + if(isAd(page)) { + rewardSeen=finishExistingAd() || rewardSeen; + // 奖励提示不等于已回到任务页;后续允许解析明确奖励弹窗。 + entered=true;continue; + } + var receipt=taskReceipt(page); + if(receipt) rewardSeen=true; + if(isTaskCenter(page)) { + if(rewardSeen || entered || Date.now()-firstPageAt>8000) return {rewardSeen:rewardSeen}; + sleep(CONFIG.pollMs);continue; + } + entered=true; + if(isLiveRoom(page)) throw new Error("[STOP] 进入直播推广页,停止并保留现场,不计完成"); + var unavailable=roundUnavailable(page); + if(unavailable) return {unavailable:true,rewardSeen:rewardSeen,reason:unavailable.text}; + var claim=taskClaim(page,kind); + if(claim) { + var key=claim.text+":"+Math.round(claim.rect.top/40); + if(!claimed[key]) {claimed[key]=true;tapFresh(claim,function(p){return taskClaim(p,kind);});continue;} + } + if(dismissModal(page)) continue; + if(rewardSeen) return {rewardSeen:true}; + if(kind==="search" && searchAttempts<3 && first(page,/搜索.*(?:金币|任务)|指定.*搜索|推荐搜索/)) { + var search=first(page,/^去搜索$/,function(item){return item.rect.left>device.width*0.60 && item.rect.top>device.height*0.25 && item.rect.bottom60000) return {watchCycle:true}; + swipe(device.width*0.40,device.height*0.74,device.width*0.40,device.height*0.30,600);continue; + } + if(kind==="feed" && first(page,/直播|图文|图片/) && bottomNavigation(page,/^首页$/)) { + return {incomplete:true,reason:"视频入口进入直播或图文,未计为观看完成"}; + } + sleep(CONFIG.pollMs); + } + throw new Error("[STOP] 本轮5分钟未确认完成,保留现场:"+row.title); +} +function drainTask(initial,kind,options) { + var rounds=0,noProgress=0,pattern=exactTitle(initial.title),feedCycles=0; + while(roundsbefore) earned=afterBalance-before; + var advanced=outcome.rewardSeen || !!(row.quota && after && after.quota && row.quota.total===after.quota.total && after.quota.done>row.quota.done) || + !!(after && after.complete && !row.complete); + if(advanced) {rounds++;noProgress=0;writeRunLog("ROUND CONFIRMED: "+row.title+";轮次="+rounds+";金币="+earned);} + else if(outcome.watchCycle) { + if(++feedCycles>=options.maxRounds) return {title:row.title,status:"limited",rounds:rounds,incomplete:true,reason:"观看检查次数达到上限,未确认全部奖励"}; + } else noProgress++; + if(outcome.unavailable) return {title:row.title,status:"unavailable",rounds:rounds,reason:outcome.reason||"当前不可做"}; + if(after && after.complete) return {title:row.title,status:"complete",rounds:rounds,reason:"页面确认任务完成"}; + if(after && after.waiting) return {title:row.title,status:"waiting",rounds:rounds,reason:"本轮结束,等待下一领取时间"}; + if(advanced && earned!==null && earned<=CONFIG.minRewardCoins && kind!=="feed") return {title:row.title,status:"threshold",rounds:rounds,lastRewardCoins:earned,reason:"单次实际收益过低,停止当前项,不代表全部完成"}; + if(noProgress>=CONFIG.noProgressLimit) return {title:row.title,status:"unverified",rounds:rounds,incomplete:true,reason:"连续3轮未确认奖励或任务进度"}; + if(advanced && (kind==="signin" || kind==="chest")) return {title:row.title,status:"rewarded",rounds:rounds,reason:"本次领取已确认"}; + } + return {title:initial.title,status:"limited",rounds:rounds,incomplete:true,reason:"达到轮次上限,未认定全部完成"}; +} +function saveResults() { + files.write(CONFIG.resultPath,JSON.stringify({version:CONFIG.version,finishedAt:new Date().toISOString(), + verification:"仅页面和奖励信号确认;未知或未适配项目不计完成",tasks:results,observedTasks:observedTasks},null,2)); +} +function runStages(startStage) { + if(startStage&&!STAGES.some(function(stage){return stage.name===startStage;})) throw new Error("未知续跑流程:"+startStage); + var started=!startStage; + STAGES.forEach(function(stage) { + if(!started) started=stage.name===startStage; + if(!started) return; + checkBudget();writeRunLog("STAGE START: "+stage.name); + if(stage.kind==="feed30") { + var videoResult=drainThirtyDayVideo(); + results.push(videoResult);saveResults();writeRunLog("TASK RESULT: "+JSON.stringify(videoResult)); + if(videoResult.incomplete) throw new Error("[STOP] "+videoResult.reason); + writeRunLog("STAGE END: "+stage.name);return; + } + var excluded={},found=false; + for(var variant=0;variant<8;variant++) { + var row=locateTask(stage.title,excluded); + if(!row) break; + found=true;excluded[row.title]=true; + var result=drainTask(row,stage.kind,stage); + results.push(result);saveResults();writeRunLog("TASK RESULT: "+JSON.stringify(result)); + if(result.incomplete) throw new Error("[STOP] 当前流程未确认完成:"+result.reason+";保留现场,请提供日志校准"); + } + if(!found) { + results.push({title:stage.name,status:"not_found",incomplete:true,reason:"白名单入口未找到,可能版本无此任务或文案待适配"}); + saveResults(); + } + writeRunLog("STAGE END: "+stage.name); + }); + return results; +} +function runDaily() { + sessionStartedAt=Date.now(); + var mine=engines.myEngine(),source=String(mine.getSource()); + engines.all().forEach(function(engine){if(engine.id!==mine.id && String(engine.getSource())===source) throw new Error("已有相同抖音脚本在运行");}); + files.ensureDir(CONFIG.logPath);files.write(CONFIG.logPath,""); + writeRunLog("START: "+CONFIG.version+";首次适配版,未声称实机已跑通"); + keepScreenAwake(); + writeRunLog("SCREEN: 运行期间保持亮屏,每分钟续期;结束或报错后恢复系统休眠策略"); + auto.waitFor();initLocalOcr(); + if(!app.launchPackage(CONFIG.packageName)) throw new Error("未安装抖音极速版:"+CONFIG.packageName); + waitStartupPackage(CONFIG.packageName,15000);sleep(1500);installToastObserver(); + if(mine.execArgv && mine.execArgv.inspectOnly) {snapshot();return "INSPECT DONE:仅导出当前页面文字,未执行导航及任务";} + finishExistingAd();enterHomeThenEarning(); + if(CONFIG.inspectOnly || (mine.execArgv && mine.execArgv.inspectTasksOnly)) { + var page=ensureTaskCenter();rowsOnPage(page,TASK_TITLE);saveResults(); + return "INSPECT DONE:已按首页→赚钱导航,仅导出当前可见任务文字,未领取或观看广告"; + } + runStages(mine.execArgv && mine.execArgv.startStage);saveResults(); + var pending=results.filter(function(item){return item.incomplete;}); + return (pending.length?"PARTIAL:存在未找到或待适配任务,未认定全流程完成;":"DONE:白名单内已找到任务执行结束;")+JSON.stringify(results); +} + +// MAIN:测试程序仅加载此标记前的函数,不执行手机操作。 +try { + var endMessage=runDaily();writeRunLog(endMessage);toastLog(endMessage.indexOf("PARTIAL")===0?"抖音任务部分完成,请查看日志":"抖音脚本运行结束"); +} catch(error) { + try {results.push({title:"运行中止",status:"error",incomplete:true,reason:String(error)});saveResults();}catch(saveError){} + writeRunLog("ERROR: "+error+"\n"+error.stack);toastLog("抖音任务停止:"+error);throw error; +} finally { + try {events.removeAllListeners();}catch(ignore){} + try {events.removeToastObserver();}catch(ignoreObserver){} + try {images.stopScreenCapture();}catch(ignoreCapture){} + if(captureWorker && captureWorker.isAlive()) {captureWorker.interrupt();captureWorker.join(1500);} + releaseScreenAwake(); +} diff --git a/douyin_auto/repair-notes.md b/douyin_auto/repair-notes.md new file mode 100644 index 0000000..09c2adc --- /dev/null +++ b/douyin_auto/repair-notes.md @@ -0,0 +1,20 @@ +# 抖音极速版修复记录(2026-10-28) + +版本:`2026-10-28-douyin-lite-v3-thirty-day-video`。 + +保留签到、宝箱、广告、饭补、搜索和浏览六个原流程及顺序;仅把末尾的“看视频阶段奖励”替换为“连续看视频30天”。没有加入翻卡,也没有修改其他应用。 + +进入活动卡后,先领取今天可领的阶段奖励,否则观看推荐视频,每轮返回活动卡回查。划过直播预览,不点击进入直播间。只处理“今天”四档,不领取“第2—30天”奖励;解锁中继续观看。今天各阶段均显示已领取,或活动卡明确提示今日领完、今日上限、明日再领等,才结束本阶段。入口丢失、领取未确认、连续五轮无进度及整次运行超时会保留未确认结果,不能当作已完成。 + +保留正常启动的完整流程。内部续跑参数 `startStage` 可从指定阶段恢复;本次真机验证仅从“连续看视频30天”恢复,避免重新执行前面的任务。 + +## 实际验证 + +- vivo V2072A(3109281664002GM)完成首页→无文字赚钱入口→任务浮层导航。 +- 16:40—16:42 正式脚本完成观看、划过直播预览、返回活动卡回查,今日首档进度从 `40/108` 增至 `43/108`,随后再次进入观看。 +- 19 项 Node 回归检查通过,覆盖原流程保留、真实页面解析、未来奖励排除、领奖优先、结束条件及无进度/领奖失败不冒充完成;语法检查通过。 +- 已同步至 vivo `/sdcard/脚本/抖音极速/douyin-lite.js`,电脑与手机 SHA-256 一致:`0a38a41c6db1c991c3aafdf8a4d1165b08d6593ec74b59bfb449264b2766ba2b`。 + +当前验证确认了观看与进度回查,尚未在真机观察到首档解锁后的领取弹窗,也未验证当日四档全部领完。脚本继续在手机运行;未知文案会保留现场,不猜点或宣称领取成功。 + +原先手机脚本及清理备份位于仓库外的 `../autojs-device-backups/vivo-20261028-162452/`。 diff --git a/douyin_auto/tests/earning-navigation.test.js b/douyin_auto/tests/earning-navigation.test.js new file mode 100644 index 0000000..8c79e7c --- /dev/null +++ b/douyin_auto/tests/earning-navigation.test.js @@ -0,0 +1,85 @@ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); + +const source = fs.readFileSync(path.join(__dirname, '../douyin-lite.js'), 'utf8').split('// MAIN:')[0]; +const fixture = name => JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures', name), 'utf8')); +function runtime() { + const ctx = vm.createContext({device: {width: 1080, height: 2400}, + files: {write() {}, append() {}}, sleep() {}, log() {}}); + vm.runInContext(source, ctx); + ctx.keepScreenAwake = () => {}; + ctx.foregroundPackage = () => ctx.CONFIG.packageName; + return ctx; +} +function nativePage(ctx) { + const nodes = fixture('vivo-home-native.json').map(item => ({ + bounds: () => item.box, visibleToUser: () => true, enabled: () => true, + id: () => item.id, text: () => item.text, desc: () => item.desc + })); + ctx.packageName = () => ({find: () => ({size: () => nodes.length, get: i => nodes[i]})}); + return ctx.readSnapshot(); +} +test('vivo 图片赚钱入口经过原生快照读取后可定位', () => { + const ctx = runtime(); + const page = nativePage(ctx); + assert.equal(ctx.earningNavigation(page).id, ctx.CONFIG.packageName + ':id/ki3'); + assert.equal(ctx.isHome(page), true); +}); +test('真实 OCR 的左括号不再阻断赚钱入口', () => { + const ctx = runtime(); + const page = fixture('vivo-home-ocr.json'); + assert.equal(ctx.earningNavigation(page).text, '(赚钱'); + assert.equal(ctx.isHome(page), true); +}); +test('vivo 控件实际延伸到屏幕底边时仍可定位', () => { + const ctx = runtime(); + const page = nativePage(ctx); + const button = ctx.earningNavigation(page); + button.rect.bottom = 2400; + assert.equal(ctx.earningNavigation(page), button); +}); +test('真实浮层任务页的合框收益和广告卡片优先于底下首页', () => { + const ctx = runtime(); + const page = fixture('vivo-task-overlay.json'); + assert.equal(ctx.isTaskCenter(page), true); + assert.equal(ctx.isHome(page), false); + assert.equal(ctx.rowsOnPage(page, ctx.STAGES[2].title)[0].action.text, '去观看'); + ctx.snapshot = () => page; + ctx.tapFresh = () => assert.fail('不应点击浮层背后的首页'); + assert.equal(ctx.enterHomeThenEarning(), page); +}); +test('图片入口必须同时具有底部导航证据,且位于底部中央', () => { + const ctx = runtime(); + const page = nativePage(ctx); + const button = ctx.earningNavigation(page); + assert.equal(ctx.earningNavigation([button]), null); + button.rect.top = 600; + button.rect.bottom = 730; + assert.equal(ctx.earningNavigation(page), null); +}); +test('正文中的赚钱文字和相似推广文案不能当作导航', () => { + const ctx = runtime(); + assert.equal(ctx.earningNavigation([{text: '赚钱', rect: {left: 450, top: 500, right: 600, bottom: 560}}]), null); + assert.equal(ctx.earningNavigation([{text: '赚钱领福利', rect: {left: 450, top: 2264, right: 620, bottom: 2329}}]), null); +}); +test('从真实无文字首页依次点击首页、赚钱并核实任务页', () => { + const ctx = runtime(); + const page = nativePage(ctx), clicks = []; + ctx.snapshot = () => page; + ctx.tapFresh = (item, resolve) => clicks.push((resolve ? resolve(page) : item).text); + ctx.ensureTaskCenter = () => 'task-center-confirmed'; + assert.equal(ctx.enterHomeThenEarning(), 'task-center-confirmed'); + assert.deepEqual(clicks, ['首页', '@douyin_earning_tab']); +}); +test('已确认任务页时直接恢复,不返回首页重走入口', () => { + const ctx = runtime(); + const page = [{text: '任务中心', rect: {left: 80, top: 200, right: 300, bottom: 260}}, + {text: '每日签到', rect: {left: 60, top: 650, right: 300, bottom: 700}}, + {text: '开宝箱', rect: {left: 60, top: 900, right: 300, bottom: 950}}]; + ctx.snapshot = () => page; + ctx.tapFresh = () => assert.fail('不应离开已确认的任务页'); + assert.equal(ctx.enterHomeThenEarning(), page); +}); diff --git a/douyin_auto/tests/fixtures/vivo-home-native.json b/douyin_auto/tests/fixtures/vivo-home-native.json new file mode 100644 index 0000000..ea707ea --- /dev/null +++ b/douyin_auto/tests/fixtures/vivo-home-native.json @@ -0,0 +1,68 @@ +[ + { + "text": "推荐", + "desc": "", + "id": "com.ss.android.ugc.aweme.lite:id/rnz", + "box": { + "left": 599, + "top": 145, + "right": 715, + "bottom": 222 + } + }, + { + "text": "首页", + "desc": "首页,按钮", + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "box": { + "left": 53, + "top": 2273, + "right": 175, + "bottom": 2320 + } + }, + { + "text": "朋友", + "desc": "朋友,按钮", + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "box": { + "left": 269, + "top": 2273, + "right": 391, + "bottom": 2320 + } + }, + { + "text": "消息", + "desc": "消息,按钮", + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "box": { + "left": 701, + "top": 2273, + "right": 823, + "bottom": 2320 + } + }, + { + "text": "我", + "desc": "我,按钮", + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "box": { + "left": 947, + "top": 2273, + "right": 1008, + "bottom": 2320 + } + }, + { + "text": "", + "desc": "", + "id": "com.ss.android.ugc.aweme.lite:id/ki3", + "box": { + "left": 405, + "top": 2184, + "right": 675, + "bottom": 2320 + } + } +] diff --git a/douyin_auto/tests/fixtures/vivo-home-ocr.json b/douyin_auto/tests/fixtures/vivo-home-ocr.json new file mode 100644 index 0000000..5b88e50 --- /dev/null +++ b/douyin_auto/tests/fixtures/vivo-home-ocr.json @@ -0,0 +1,172 @@ +[ + { + "text": "同城", + "rect": { + "left": 179, + "top": 144, + "right": 218, + "bottom": 221 + }, + "id": "com.ss.android.ugc.aweme.lite:id/rnz", + "enabled": true + }, + { + "text": "关注", + "rect": { + "left": 268, + "top": 144, + "right": 384, + "bottom": 221 + }, + "id": "com.ss.android.ugc.aweme.lite:id/rnz", + "enabled": true + }, + { + "text": "推荐", + "rect": { + "left": 600, + "top": 144, + "right": 716, + "bottom": 221 + }, + "id": "com.ss.android.ugc.aweme.lite:id/rnz", + "enabled": true + }, + { + "text": "首页", + "rect": { + "left": 45, + "top": 2271, + "right": 167, + "bottom": 2353 + }, + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "enabled": true + }, + { + "text": "首页,按钮", + "rect": { + "left": 45, + "top": 2271, + "right": 167, + "bottom": 2353 + }, + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "enabled": true + }, + { + "text": "朋友", + "rect": { + "left": 261, + "top": 2271, + "right": 383, + "bottom": 2353 + }, + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "enabled": true + }, + { + "text": "朋友,按钮", + "rect": { + "left": 261, + "top": 2271, + "right": 383, + "bottom": 2353 + }, + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "enabled": true + }, + { + "text": "3", + "rect": { + "left": 383, + "top": 2254, + "right": 427, + "bottom": 2319 + }, + "id": "com.ss.android.ugc.aweme.lite:id/pvs", + "enabled": true + }, + { + "text": "消息", + "rect": { + "left": 693, + "top": 2271, + "right": 815, + "bottom": 2353 + }, + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "enabled": true + }, + { + "text": "消息,按钮", + "rect": { + "left": 693, + "top": 2271, + "right": 815, + "bottom": 2353 + }, + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "enabled": true + }, + { + "text": "11", + "rect": { + "left": 815, + "top": 2254, + "right": 862, + "bottom": 2319 + }, + "id": "com.ss.android.ugc.aweme.lite:id/pvs", + "enabled": true + }, + { + "text": "我", + "rect": { + "left": 939, + "top": 2271, + "right": 1000, + "bottom": 2353 + }, + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "enabled": true + }, + { + "text": "我,按钮", + "rect": { + "left": 939, + "top": 2271, + "right": 1000, + "bottom": 2353 + }, + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "enabled": true + }, + { + "text": "首页+明友。", + "rect": { + "left": 48, + "top": 2274, + "right": 407, + "bottom": 2350 + } + }, + { + "text": "(赚钱", + "rect": { + "left": 456, + "top": 2264, + "right": 620, + "bottom": 2329 + } + }, + { + "text": "钱消意\"我", + "rect": { + "left": 538, + "top": 2263, + "right": 996, + "bottom": 2348 + } + } +] diff --git a/douyin_auto/tests/fixtures/vivo-task-overlay.json b/douyin_auto/tests/fixtures/vivo-task-overlay.json new file mode 100644 index 0000000..0281e38 --- /dev/null +++ b/douyin_auto/tests/fixtures/vivo-task-overlay.json @@ -0,0 +1,73 @@ +[ + { + "text": "推荐", + "rect": { + "left": 600, + "top": 142, + "right": 716, + "bottom": 219 + }, + "id": "com.ss.android.ugc.aweme.lite:id/rnz", + "enabled": true + }, + { + "text": "首页", + "rect": { + "left": 46, + "top": 2274, + "right": 168, + "bottom": 2356 + }, + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "enabled": true + }, + { + "text": "我", + "rect": { + "left": 940, + "top": 2274, + "right": 1001, + "bottom": 2356 + }, + "id": "com.ss.android.ugc.aweme.lite:id/l12", + "enabled": true + }, + { + "text": "@douyin_earning_tab", + "rect": { + "left": 405, + "top": 2184, + "right": 675, + "bottom": 2400 + }, + "id": "com.ss.android.ugc.aweme.lite:id/ki3", + "enabled": true + }, + { + "text": "く金币收益6917现金收益0", + "rect": { + "left": 49, + "top": 142, + "right": 644, + "bottom": 185 + } + }, + { + "text": "看广告赚金币參最高20000", + "rect": { + "left": 175, + "top": 415, + "right": 739, + "bottom": 458 + } + }, + { + "text": "去观看", + "rect": { + "left": 869, + "top": 449, + "right": 985, + "bottom": 485 + } + } +] diff --git a/douyin_auto/tests/fixtures/vivo-thirty-day-card.json b/douyin_auto/tests/fixtures/vivo-thirty-day-card.json new file mode 100644 index 0000000..036ac8e --- /dev/null +++ b/douyin_auto/tests/fixtures/vivo-thirty-day-card.json @@ -0,0 +1,278 @@ +[ + { + "text": "连续看视频30天赚", + "rect": { + "left": 81, + "top": 641, + "right": 497, + "bottom": 710 + }, + "id": "", + "enabled": true + }, + { + "text": "5", + "rect": { + "left": 503, + "top": 597, + "right": 532, + "bottom": 640 + }, + "id": "", + "enabled": true + }, + { + "text": "6", + "rect": { + "left": 503, + "top": 640, + "right": 532, + "bottom": 709 + }, + "id": "", + "enabled": true + }, + { + "text": "6", + "rect": { + "left": 533, + "top": 597, + "right": 562, + "bottom": 640 + }, + "id": "", + "enabled": true + }, + { + "text": "7", + "rect": { + "left": 534, + "top": 640, + "right": 560, + "bottom": 709 + }, + "id": "", + "enabled": true + }, + { + "text": "元", + "rect": { + "left": 568, + "top": 641, + "right": 619, + "bottom": 710 + }, + "id": "", + "enabled": true + }, + { + "text": "签到升级版", + "rect": { + "left": 643, + "top": 656, + "right": 758, + "bottom": 688 + }, + "id": "", + "enabled": true + }, + { + "text": "B", + "rect": { + "left": 148, + "top": 827, + "right": 198, + "bottom": 854 + }, + "id": "", + "enabled": true + }, + { + "text": "B", + "rect": { + "left": 329, + "top": 827, + "right": 379, + "bottom": 854 + }, + "id": "", + "enabled": true + }, + { + "text": "B", + "rect": { + "left": 510, + "top": 827, + "right": 560, + "bottom": 854 + }, + "id": "", + "enabled": true + }, + { + "text": "B", + "rect": { + "left": 691, + "top": 827, + "right": 741, + "bottom": 854 + }, + "id": "", + "enabled": true + }, + { + "text": "BBB", + "rect": { + "left": 854, + "top": 827, + "right": 967, + "bottom": 854 + }, + "id": "", + "enabled": true + }, + { + "text": "连续春视频30天赚67元", + "rect": { + "left": 60, + "top": 646, + "right": 639, + "bottom": 700 + } + }, + { + "text": "今天", + "rect": { + "left": 149, + "top": 828, + "right": 197, + "bottom": 852 + } + }, + { + "text": "40/108", + "rect": { + "left": 109, + "top": 864, + "right": 236, + "bottom": 905 + } + }, + { + "text": "已打卡1天今天可赚16511金币", + "rect": { + "left": 85, + "top": 718, + "right": 586, + "bottom": 752 + } + }, + { + "text": "解锁中", + "rect": { + "left": 132, + "top": 922, + "right": 214, + "bottom": 948 + } + }, + { + "text": "日常任务", + "rect": { + "left": 1, + "top": 1094, + "right": 252, + "bottom": 1146 + } + }, + { + "text": "今天", + "rect": { + "left": 317, + "top": 825, + "right": 389, + "bottom": 854 + } + }, + { + "text": "388", + "rect": { + "left": 320, + "top": 863, + "right": 387, + "bottom": 893 + } + }, + { + "text": "今天", + "rect": { + "left": 511, + "top": 828, + "right": 560, + "bottom": 852 + } + }, + { + "text": "588", + "rect": { + "left": 501, + "top": 863, + "right": 568, + "bottom": 893 + } + }, + { + "text": "釜到升级版", + "rect": { + "left": 642, + "top": 653, + "right": 759, + "bottom": 683 + } + }, + { + "text": "今天", + "rect": { + "left": 692, + "top": 828, + "right": 740, + "bottom": 852 + } + }, + { + "text": "888", + "rect": { + "left": 681, + "top": 863, + "right": 751, + "bottom": 894 + } + }, + { + "text": "去看视频", + "rect": { + "left": 834, + "top": 682, + "right": 966, + "bottom": 717 + } + }, + { + "text": "第2-30天", + "rect": { + "left": 855, + "top": 825, + "right": 964, + "bottom": 852 + } + }, + { + "text": "678749", + "rect": { + "left": 846, + "top": 863, + "right": 975, + "bottom": 894 + } + } +] diff --git a/douyin_auto/tests/fixtures/vivo-thirty-day-verification.log b/douyin_auto/tests/fixtures/vivo-thirty-day-verification.log new file mode 100644 index 0000000..63b3e84 --- /dev/null +++ b/douyin_auto/tests/fixtures/vivo-thirty-day-verification.log @@ -0,0 +1,9 @@ +2026-10-28T08:40:18.750Z START: 2026-10-28-douyin-lite-v3-thirty-day-video;首次适配版,未声称实机已跑通 +2026-10-28T08:40:25.678Z STAGE START: 连续看视频30天 +2026-10-28T08:40:27.327Z VIDEO30: 观看轮次=0;今日阶段=40/108,解锁中|388|588|888 +2026-10-28T08:40:28.132Z CLICK: 去看视频 +2026-10-28T08:41:26.114Z VIDEO30: 划过直播预览或图文 +2026-10-28T08:42:08.883Z CLICK: @douyin_earning_tab +2026-10-28T08:42:18.575Z VIDEO30: 观看轮次=1;今日阶段=43/108,解锁中|388|588|888 +2026-10-28T08:42:19.646Z CLICK: 去看视频 +2026-10-28T08:42:23.170Z VIDEO30: 划过直播预览或图文 diff --git a/douyin_auto/tests/thirty-day-video.test.js b/douyin_auto/tests/thirty-day-video.test.js new file mode 100644 index 0000000..4146456 --- /dev/null +++ b/douyin_auto/tests/thirty-day-video.test.js @@ -0,0 +1,83 @@ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); +const vm = require('node:vm'); +const source = fs.readFileSync(path.join(__dirname, '../douyin-lite.js'), 'utf8').split('// MAIN:')[0]; +function runtime() { + const ctx = vm.createContext({device:{width:1080,height:2400}, files:{write(){},append(){}}, sleep(){},log(){}}); + vm.runInContext(source, ctx); + ctx.sessionStartedAt=Date.now(); + return ctx; +} +function page() {return JSON.parse(fs.readFileSync(path.join(__dirname,'fixtures/vivo-thirty-day-card.json'),'utf8'));} +function item(text,x,y) {return {text,rect:{left:x,top:y,right:x+60,bottom:y+30}};} +test('仅替换原视频阶段,保留前六项流程及顺序',()=>{ + const c=runtime(); + assert.deepEqual(Array.from(c.STAGES,s=>s.kind),['signin','chest','ad','meal','search','browse','feed30']); +}); +test('真实30天卡片区分今天四档及第2到30天,解锁中不算结束',()=>{ + const c=runtime(),card=c.thirtyDayCard(page()); + assert.equal(card.today.length,4); + assert.equal(card.done,false); + assert.equal(card.claim,null); + assert.equal(card.watch.text,'去看视频'); + assert.equal(card.signature.includes('678749'),false); +}); +test('未来奖励的领取及明日再来不影响今日判断',()=>{ + const c=runtime(),p=page();p.push(item('领取',870,919),item('明日再来',850,960)); + const card=c.thirtyDayCard(p);assert.equal(card.claim,null);assert.equal(card.done,false); +}); +test('今天有可领阶段时优先领取,且不借用下一条日常任务按钮',()=>{ + const c=runtime(),p=page();p.push(item('领取奖励',310,920),item('领取奖励',860,1250)); + assert.equal(c.thirtyDayCard(p).claim.rect.left,310); +}); +test('四档均已领取才结束;只领一档或进度满仍继续',()=>{ + const c=runtime(),p=page();p.push(item('已领取',130,920)); + assert.equal(c.thirtyDayCard(p).done,false); + for(const x of [310,490,670])p.push(item('已领取',x,920)); + assert.equal(c.thirtyDayCard(p).done,true); +}); +test('文案明确今日已完成时结束,但入口消失和普通解锁不当完成',()=>{ + const c=runtime(),p=page();p.push(item('今日奖励已全部领取',100,1000)); + assert.equal(c.thirtyDayCard(p).done,true); + assert.equal(c.thirtyDayCard([]),null); +}); +test('直播预览可识别为可划过的推荐流,任务浮层不能当视频',()=>{ + const c=runtime(); + const p=[item('首页',40,2280),item('推荐',600,150),{...item('视频',0,0),id:'com.ss.android.ugc.aweme.lite:id/viewpager'},item('点击进入直播间',300,1500)]; + assert.equal(c.recommendationFeed(p),true); + c.isTaskCenter=()=>true;assert.equal(c.recommendationFeed(p),false); +}); +test('观看必须回查奖励状态,完成后返回阶段结果',()=>{ + const c=runtime(),p=page(),initial=c.thirtyDayCard(p); + const done={...initial,done:true,reason:'今日奖励已全部领取',signature:'done'}; + let count=0,watches=0; + c.locateThirtyDayCard=()=>++count===1?initial:done; + c.tapFresh=()=>true;c.watchThirtyDayCycle=()=>watches++; + const result=c.drainThirtyDayVideo(); + assert.equal(result.status,'complete');assert.equal(watches,1); +}); +test('连续观看没有进度应报告未确认,不冒充奖励已领完',()=>{ + const c=runtime(),initial=c.thirtyDayCard(page());let watches=0; + c.locateThirtyDayCard=()=>initial;c.tapFresh=()=>true;c.watchThirtyDayCycle=()=>watches++; + const result=c.drainThirtyDayVideo(); + assert.equal(result.incomplete,true);assert.equal(result.status,'unverified');assert.equal(watches,5); +}); + +test('点击领取无状态变化时停止并保留现场,不能算到账',()=>{ + const c=runtime(),p=page();p.push(item('领取奖励',310,920));const card=c.thirtyDayCard(p); + let now=Date.now();c.Date=class extends Date {static now(){return now+=5000;}};c.sessionStartedAt=now; + c.locateThirtyDayCard=()=>card;c.snapshot=()=>p;c.tapFresh=()=>true; + c.dismissModal=()=>false;c.isAd=()=>false; + assert.throws(()=>c.drainThirtyDayVideo(),/未确认该阶段已领取/); +}); +test('日常运行仍执行其他六阶段,视频结束后保存结果',()=>{ + const c=runtime(),calls=[]; + c.locateTask=()=>null; + c.drainThirtyDayVideo=()=>{calls.push('video30');return {title:'连续看视频30天',status:'complete'};}; + c.runStages(); + assert.equal(c.results.length,7); + assert.deepEqual(Array.from(c.results,r=>r.title),Array.from(c.STAGES,r=>r.name)); + assert.deepEqual(calls,['video30']); +}); diff --git a/fanqie_auto/fanqie-daily.auto.js b/fanqie_auto/fanqie-daily.auto.js index 9486350..1a8e038 100644 --- a/fanqie_auto/fanqie-daily.auto.js +++ b/fanqie_auto/fanqie-daily.auto.js @@ -4,7 +4,7 @@ // 页面识别:无障碍文字 + 可选的本地 $ocr.detect;图片不上传、不写入日志。 // 签到、翻卡循环、预约/现金签到、红包10连开、出版物阅读与挑战;通用弹窗优先。 var CONFIG = { - version: "2026-10-26-tasks-123-promo-cross", + version: "2026-10-27-tasks-124-common-progress", packageName: "com.dragon.read", rewardThreshold: 500, pollMs: 1200, @@ -872,8 +872,12 @@ function snapshot() { while (!commonHandling && needsCommonHandling(page)) { if (Date.now() >= deadline) stopWith("通用页面处理超时,保留当前页面"); writeRunLog("通用规则优先:暂停当前任务,先处理倒计时、关闭或额外奖励。"); + var beforeAction = actionSerial; handleVideos(/./); page = readPage("通用处理后重新识别"); + // 连续奖励可能跨越多个广告,操作已推进时按停滞时间计时,不能沿用第一轮的期限。 + // handleVideos仍独立约束单轮广告等待;无操作进展则保留原超时保护。 + if (actionSerial !== beforeAction) deadline = Date.now() + CONFIG.stepTimeoutMs; // 广告切换或弹窗动画中关闭按钮可能晚一帧出现;重新执行通用规则,不能全局退出。 } return page; diff --git a/fanqie_auto/fanqie-flow.md b/fanqie_auto/fanqie-flow.md index dde258b..0b5b004 100644 --- a/fanqie_auto/fanqie-flow.md +++ b/fanqie_auto/fanqie-flow.md @@ -532,3 +532,9 @@ vivo真机13:14:38自动点击中央关闭,13:14:42确认邀请弹窗已消失 版本 `2026-10-26-tasks-123-promo-cross`。新增“抽奖赢好礼/抽奖嘉好礼”与“前往抽奖/前住抽奖”的组合判定,优先关闭推广层。该弹窗原生树没有关闭控件,OCR受背景文字干扰漏掉白色叉号,因此在已确认推广按钮下方的中央区域检查白色X四条斜臂与暗色间隙,再点击识别结果;不点击推广按钮。 语法检查及10项针对性测试通过。vivo13:43:01识别白色叉号,13:43:02点击关闭,13:43:05复查确认弹窗消失。两个正式脚本路径均覆盖并校验SHA256:`0d24668c0314f1e82f1e2e78bee9d219a14e378e54bed42d78ea9f5cfd95ae54`。正式脚本重新运行,13:43:49重新进入番茄小说,13:43:58已进入赚钱页并执行签到搜索;未验证整轮任务完成。 + +## 2026-10-27 通用连续奖励累计超时 + +版本124修复snapshot将多轮广告累计时间当作停滞:handleVideos返回并重新识别后,若actionSerial表明有实际操作,则更新通用处理截止时间。无操作进展仍保持原期限,单轮广告等待仍由handleVideos独立约束。语法及12项针对性测试通过(包括跨期限有进展续期、无进展超时)。正式脚本两个手机路径SHA256均与电脑一致:`2cc10301151adb729c7d864195fb1bfef8715d775b27dfa986caf8adfe711ed4`。 + +vivo09:24:57实际关闭现场已成功领奖广告,并继续触发新的领奖及倒计时;随后出现活动繁忙提示并回到桌面。已停止临时恢复实例并下发正式脚本启动命令,等待读取新日志期间ADB断开,未确认正式实例启动完成,也未宣称全部任务完成。 diff --git a/fanqie_auto/tests/fixtures/vivo-invite-cash-popup.json b/fanqie_auto/tests/fixtures/vivo-invite-cash-popup.json deleted file mode 100644 index 3635f56..0000000 --- a/fanqie_auto/tests/fixtures/vivo-invite-cash-popup.json +++ /dev/null @@ -1 +0,0 @@ -[{"text":"121","rect":{"left":405,"top":868,"right":625,"bottom":1070}},{"text":"Q水浒传","rect":{"left":105,"top":144,"right":332,"bottom":193}},{"text":"听经典影视原著","rect":{"left":98,"top":421,"right":561,"bottom":466}},{"text":"列计中典","rect":{"left":73,"top":1244,"right":137,"bottom":1619}},{"text":"听书看剧经典短篇机频知识","rect":{"left":23,"top":285,"right":950,"bottom":346}},{"text":"孙引","rect":{"left":63,"top":1257,"right":160,"bottom":1306}},{"text":"书","rect":{"left":67,"top":1414,"right":161,"bottom":1458}},{"text":"奥藏1","rect":{"left":82,"top":1571,"right":335,"bottom":1619}},{"text":"[珍畫版","rect":{"left":232,"top":1705,"right":333,"bottom":1730}},{"text":"书城","rect":{"left":76,"top":2296,"right":179,"bottom":2345}},{"text":"|全集","rect":{"left":230,"top":1901,"right":338,"bottom":1951}},{"text":"DALECARNEGIE","rect":{"left":223,"top":2179,"right":347,"bottom":2191}},{"text":"人性的弱点","rect":{"left":68,"top":1796,"right":502,"bottom":1885}},{"text":"3番茄小小说","rect":{"left":443,"top":620,"right":644,"bottom":663}},{"text":"送你现金红包","rect":{"left":410,"top":767,"right":671,"bottom":809}},{"text":"AND","rect":{"left":365,"top":2059,"right":406,"bottom":2072}},{"text":"121元","rect":{"left":414,"top":902,"right":672,"bottom":1005}},{"text":"HOWTO","rect":{"left":365,"top":2002,"right":447,"bottom":2016}},{"text":"WIN","rect":{"left":365,"top":2021,"right":404,"bottom":2035}},{"text":"邀请好友立得","rect":{"left":416,"top":1443,"right":660,"bottom":1480}},{"text":"PRIENDs","rect":{"left":365,"top":2031,"right":448,"bottom":2059}},{"text":"短剧","rect":{"left":280,"top":2296,"right":386,"bottom":2345}},{"text":"PEOPLE","rect":{"left":365,"top":2094,"right":441,"bottom":2110}},{"text":"后**提现0.3元","rect":{"left":453,"top":1108,"right":705,"bottom":1143}},{"text":"INFLUENCE","rect":{"left":365,"top":2072,"right":477,"bottom":2093}},{"text":"メ","rect":{"left":522,"top":1720,"right":558,"bottom":1753}},{"text":"R460100","rect":{"left":704,"top":27,"right":974,"bottom":68}},{"text":"|他是浪漫达的時人","rect":{"left":589,"top":2157,"right":694,"bottom":2175}},{"text":"文学","rect":{"left":687,"top":421,"right":782,"bottom":466}},{"text":"赚钱","rect":{"left":478,"top":2294,"right":597,"bottom":2352}},{"text":"KB/S","rect":{"left":754,"top":53,"right":796,"bottom":67}},{"text":"也是奇思想的发明家","rect":{"left":589,"top":2181,"right":710,"bottom":2193}},{"text":"他是特立行的书画大师","rect":{"left":589,"top":2201,"right":723,"bottom":2213}},{"text":"中馬热學活的t货","rect":{"left":589,"top":2216,"right":721,"bottom":2232}},{"text":"88分类","rect":{"left":846,"top":144,"right":998,"bottom":191}},{"text":"书架","rect":{"left":691,"top":2296,"right":796,"bottom":2338}},{"text":"完盟再现苏东坡六十四年跌行起伏的传奇一","rect":{"left":873,"top":1659,"right":891,"bottom":1975}},{"text":"解","rect":{"left":983,"top":557,"right":1000,"bottom":576}},{"text":"苏东坡全传","rect":{"left":901,"top":1657,"right":992,"bottom":2080}},{"text":"我的","rect":{"left":894,"top":2296,"right":1002,"bottom":2345}}] \ No newline at end of file diff --git a/fanqie_auto/tests/fixtures/vivo-raffle-popup.json b/fanqie_auto/tests/fixtures/vivo-raffle-popup.json deleted file mode 100644 index eeaf142..0000000 --- a/fanqie_auto/tests/fixtures/vivo-raffle-popup.json +++ /dev/null @@ -1 +0,0 @@ -[{"text":"13:38のD","rect":{"left":61,"top":28,"right":283,"bottom":68}},{"text":"福利中心福利商城番茄柿堂","rect":{"left":72,"top":132,"right":968,"bottom":207}},{"text":"读书挑战賽3655金币","rect":{"left":74,"top":385,"right":584,"bottom":432}},{"text":"完成阅读任务,获得相应金币奖励","rect":{"left":91,"top":450,"right":580,"bottom":481}},{"text":"日","rect":{"left":85,"top":781,"right":137,"bottom":825}},{"text":"|去阅读","rect":{"left":165,"top":234,"right":288,"bottom":270}},{"text":"吃","rect":{"left":80,"top":1278,"right":137,"bottom":1320}},{"text":"|新","rect":{"left":86,"top":1350,"right":133,"bottom":1382}},{"text":"阅读1分钟","rect":{"left":136,"top":546,"right":279,"bottom":576}},{"text":"1589","rect":{"left":184,"top":599,"right":257,"bottom":627}},{"text":"主","rect":{"left":92,"top":1552,"right":116,"bottom":1577}},{"text":"|去听书","rect":{"left":488,"top":236,"right":584,"bottom":267}},{"text":"再看9章","rect":{"left":435,"top":544,"right":583,"bottom":578}},{"text":"1033","rect":{"left":484,"top":599,"right":558,"bottom":626}},{"text":"书城","rect":{"left":77,"top":2297,"right":187,"bottom":2349}},{"text":"短剧","rect":{"left":281,"top":2296,"right":382,"bottom":2345}},{"text":"抽奖嘉好礼","rect":{"left":275,"top":976,"right":802,"bottom":1116}},{"text":"AD","rect":{"left":505,"top":1294,"right":572,"bottom":1347}},{"text":"天天领金币最高484850","rect":{"left":92,"top":1680,"right":631,"bottom":1725}},{"text":"今日签到立即领30全币,做任x最高领","rect":{"left":91,"top":1740,"right":654,"bottom":1779}},{"text":"484820金币","rect":{"left":91,"top":1786,"right":274,"bottom":1815}},{"text":"RAFFLEPRIZES","rect":{"left":501,"top":952,"right":759,"bottom":997}},{"text":"前住抽奖","rect":{"left":428,"top":1457,"right":651,"bottom":1510}},{"text":"金币红包雨●最高2000","rect":{"left":78,"top":1913,"right":588,"bottom":1961}},{"text":"KB/S","rect":{"left":754,"top":53,"right":796,"bottom":67}},{"text":"|新玩法一大波红包来袭,先到先得","rect":{"left":86,"top":1989,"right":604,"bottom":2025}},{"text":"刷视频领取双重奖成最高1514","rect":{"left":77,"top":2125,"right":755,"bottom":2173}},{"text":"累计观看多个视频或观看指定视频,均可获得","rect":{"left":92,"top":2190,"right":748,"bottom":2223}},{"text":"看短剧","rect":{"left":783,"top":236,"right":878,"bottom":267}},{"text":"再看29章节","rect":{"left":737,"top":546,"right":905,"bottom":577}},{"text":"1033","rect":{"left":786,"top":599,"right":859,"bottom":626}},{"text":"升级","rect":{"left":887,"top":128,"right":979,"bottom":167}},{"text":"去阅读","rect":{"left":844,"top":419,"right":940,"bottom":449}},{"text":"賺线|书架","rect":{"left":478,"top":2294,"right":796,"bottom":2352}},{"text":"去领取","rect":{"left":841,"top":1734,"right":938,"bottom":1764}},{"text":"点击领领10","rect":{"left":794,"top":2067,"right":934,"bottom":2097}},{"text":"冒5","rect":{"left":951,"top":1155,"right":1006,"bottom":1180}},{"text":"立即领取","rect":{"left":825,"top":2178,"right":954,"bottom":2210}},{"text":"我的","rect":{"left":897,"top":2296,"right":1002,"bottom":2347}},{"text":"开","rect":{"left":1014,"top":1266,"right":1073,"bottom":1303}}] \ No newline at end of file diff --git a/fanqie_auto/tests/fixtures/vivo-recommendation-popup.json b/fanqie_auto/tests/fixtures/vivo-recommendation-popup.json deleted file mode 100644 index 98e0cb2..0000000 --- a/fanqie_auto/tests/fixtures/vivo-recommendation-popup.json +++ /dev/null @@ -1 +0,0 @@ -[{"text":"13:229T","rect":{"left":83,"top":29,"right":345,"bottom":71}},{"text":"福利中心福利商城","rect":{"left":74,"top":146,"right":626,"bottom":204}},{"text":"日","rect":{"left":98,"top":784,"right":130,"bottom":824}},{"text":"读书挑战赛3655金币","rect":{"left":91,"top":386,"right":570,"bottom":430}},{"text":"完成阅读任务,获得相应金币奖励","rect":{"left":91,"top":453,"right":581,"bottom":486}},{"text":"阅读1分钟","rect":{"left":135,"top":547,"right":277,"bottom":579}},{"text":"看1","rect":{"left":78,"top":881,"right":160,"bottom":929}},{"text":"00","rect":{"left":123,"top":943,"right":152,"bottom":992}},{"text":"吃","rect":{"left":79,"top":1289,"right":160,"bottom":1332}},{"text":"去阅读","rect":{"left":181,"top":239,"right":276,"bottom":269}},{"text":"新可","rect":{"left":87,"top":1367,"right":153,"bottom":1396}},{"text":"抽1","rect":{"left":77,"top":1500,"right":160,"bottom":1548}},{"text":"恭喜你戍为","rect":{"left":241,"top":664,"right":444,"bottom":703}},{"text":"去听书","rect":{"left":488,"top":237,"right":582,"bottom":268}},{"text":"再看9章节","rect":{"left":435,"top":546,"right":581,"bottom":581}},{"text":"小说推荐官","rect":{"left":243,"top":720,"right":514,"bottom":771}},{"text":"书城","rect":{"left":77,"top":2296,"right":182,"bottom":2343}},{"text":"使用专属特权","rect":{"left":390,"top":882,"right":684,"bottom":931}},{"text":"赠送好友VIP会员","rect":{"left":353,"top":945,"right":724,"bottom":992}},{"text":"VIP会员30天","rect":{"left":280,"top":1335,"right":469,"bottom":1364}},{"text":"你可以获得以下权益","rect":{"left":393,"top":1063,"right":688,"bottom":1094}},{"text":"天夭领金币最高484850","rect":{"left":92,"top":1694,"right":630,"bottom":1740}},{"text":"短剧","rect":{"left":280,"top":2296,"right":386,"bottom":2345}},{"text":"查看权益","rect":{"left":454,"top":1467,"right":626,"bottom":1508}},{"text":"今日签到立即领30金币,個文最高领","rect":{"left":91,"top":1753,"right":656,"bottom":1793}},{"text":"484820金币","rect":{"left":91,"top":1799,"right":274,"bottom":1828}},{"text":"金币红包雨最高2000","rect":{"left":92,"top":1930,"right":575,"bottom":1971}},{"text":"|新玩法一大波红包来袭,先到先得","rect":{"left":102,"top":2005,"right":596,"bottom":2038}},{"text":"N100","rect":{"left":734,"top":29,"right":997,"bottom":69}},{"text":"番前柿業","rect":{"left":695,"top":149,"right":942,"bottom":205}},{"text":"最高金币13万","rect":{"left":601,"top":1334,"right":799,"bottom":1364}},{"text":"13万","rect":{"left":711,"top":1162,"right":766,"bottom":1184}},{"text":"刷视频领取双重奖励最高1514","rect":{"left":77,"top":2137,"right":755,"bottom":2184}},{"text":"累计观看多个视频或观看指定视频,均可获得","rect":{"left":92,"top":2203,"right":748,"bottom":2235}},{"text":"看短剧","rect":{"left":783,"top":239,"right":878,"bottom":270}},{"text":"(升级","rect":{"left":887,"top":130,"right":979,"bottom":166}},{"text":"再看29章节","rect":{"left":736,"top":549,"right":906,"bottom":580}},{"text":"去阅读","rect":{"left":844,"top":422,"right":940,"bottom":452}},{"text":"|再送","rect":{"left":912,"top":1038,"right":1011,"bottom":1075}},{"text":"去领取","rect":{"left":841,"top":1747,"right":938,"bottom":1778}},{"text":"点击领10","rect":{"left":794,"top":2067,"right":934,"bottom":2098}},{"text":"看5","rect":{"left":946,"top":1163,"right":993,"bottom":1191}},{"text":"立即领取","rect":{"left":826,"top":2192,"right":955,"bottom":2223}},{"text":"赚钱架我的","rect":{"left":477,"top":2293,"right":1002,"bottom":2353}}] \ No newline at end of file diff --git a/fanqie_auto/tests/invite-cash.test.js b/fanqie_auto/tests/invite-cash.test.js deleted file mode 100644 index 94527f4..0000000 --- a/fanqie_auto/tests/invite-cash.test.js +++ /dev/null @@ -1,66 +0,0 @@ -const test=require('node:test'),assert=require('node:assert/strict'); -const fs=require('node:fs'),vm=require('node:vm'),path=require('node:path'); -const source=fs.readFileSync(path.join(__dirname,'../fanqie-daily.auto.js'),'utf8'); -function load(){let now=0;const c=vm.createContext({Date:{now:()=>now},Math,JSON,Error,isFinite}); -vm.runInContext(source.slice(0,source.lastIndexOf('\ntry {\n runDaily();')),c); -c.device={width:1080,height:2400};c.sleep=ms=>now+=ms;c.writeRunLog=()=>{}; -const page=JSON.parse(fs.readFileSync(path.join(__dirname,'fixtures/vivo-invite-cash-popup.json'),'utf8'));return {c,page};} -test('vivo邀请现金红包识别メ为中央关闭,优先通用处理',()=>{const {c,page}=load(); -assert.ok(c.inviteCashPopupHeading(page));assert.equal(c.findInviteCashPopupClose(page).text,'メ');assert.equal(c.needsCommonHandling(page),true);}); -test('缺少邀请组合特征不关闭普通现金签到或背景叉号',()=>{const {c,page}=load(); -for(const text of ['送你现金红包','邀请好友立得']){const p=page.filter(i=>i.text!==text);assert.equal(c.inviteCashPopupHeading(p),null);assert.equal(c.findInviteCashPopupClose(p),null);}}); -test('处理邀请弹窗先关闭,不进入背景金币或导航流程',()=>{const {c,page}=load();let current=page,closed=0; -c.snapshot=()=>current;c.tap=(button)=>{assert.equal(button.text,'メ');closed++;current=[];}; -c.completedTaskPopupHeading=()=>{throw Error('背景规则不得先执行');}; -c.sleep=()=>{if(!current.length)throw Error('验证结束');}; -assert.throws(()=>c.handleVideosLoop(/./),/背景规则不得先执行/);assert.equal(closed,1);}); -test('中央关闭坐标约束,不用顶部背景X作为邀请关闭',()=>{const {c,page}=load(); -const p=page.filter(i=>i.text!=='メ');p.push({text:'X',rect:{left:990,right:1030,top:100,bottom:140}}); -assert.equal(c.findInviteCashPopupClose(p),null);}); - -test('vivo小说推荐官推广弹窗只关闭,不点查看权益',()=>{ - const {c}=load();const page=JSON.parse(fs.readFileSync(path.join(__dirname,'fixtures/vivo-recommendation-popup.json'),'utf8')); - assert.equal(c.dismissOnlyPromoPopupHeading(page).text,'小说推荐官');assert.equal(c.needsCommonHandling(page),true); - assert.equal(c.findInviteCashPopupClose(page),null,'现场没有可识别关闭叉号,走返回复查'); - for(const text of ['赠送好友VIP会员','查看权益'])assert.equal(c.dismissOnlyPromoPopupHeading(page.filter(x=>x.text!==text)),null); -}); -test('无叉号的推荐官弹窗返回一次关闭,确认消失后交还后续处理',()=>{ - const {c}=load();const page=JSON.parse(fs.readFileSync(path.join(__dirname,'fixtures/vivo-recommendation-popup.json'),'utf8')); - let current=page,backs=0;c.snapshot=()=>current;c.back=()=>{backs++;current=[];return true;}; - c.tap=()=>{throw Error('不得点击权益或背景按钮');}; - c.completedTaskPopupHeading=()=>{throw Error('后续处理已接管');}; - assert.throws(()=>c.handleVideosLoop(/./),/后续处理已接管/);assert.equal(backs,1); -}); -test('原生无文字推广关闭图标按弹窗父容器及位置识别,不点击权益',()=>{ - const {c}=load();const page=JSON.parse(fs.readFileSync(path.join(__dirname,'fixtures/vivo-recommendation-popup.json'),'utf8')); - const close={bounds:()=>({left:485,top:1726,right:596,bottom:1837}),visibleToUser:()=>true, - parent:()=>({bounds:()=>({left:152,top:563,right:928,bottom:1837})})}; - c.className=name=>{assert.equal(name,'android.widget.ImageView');return {packageName:()=>({find:()=>({size:()=>1,get:()=>close})})};}; - c.appendNativePromoClose(page);assert.equal(c.findInviteCashPopupClose(page).text,'关闭推广弹窗'); - const noHeading=page.filter(x=>x.text!=='小说推荐官'&&x.text!=='关闭推广弹窗');c.appendNativePromoClose(noHeading); - assert.equal(c.findInviteCashPopupClose(noHeading),null); -}); -test('抽奖推广标题与前往按钮同时存在才触发关闭,不把普通抽奖任务当弹窗',()=>{ - const {c}=load();const page=JSON.parse(fs.readFileSync(path.join(__dirname,'fixtures/vivo-raffle-popup.json'),'utf8')); - assert.equal(c.dismissOnlyPromoPopupHeading(page).text,'抽奖嘉好礼');assert.equal(c.needsCommonHandling(page),true); - assert.equal(c.dismissOnlyPromoPopupHeading(page.filter(x=>x.text!=='前住抽奖')),null); -}); -test('抽奖推广叉号局部OCR仅扫描操作按钮下方中央区域',()=>{ - const {c}=load();const page=JSON.parse(fs.readFileSync(path.join(__dirname,'fixtures/vivo-raffle-popup.json'),'utf8'));let calls=0; - c.readPromoCross=()=>{}; - c.readCloseRegion=(frame,items,region)=>{calls++;assert.ok(region.top>1510);assert.ok(region.left>=1080*.4); - items.push({text:'X',rect:{left:522,top:1740,right:558,bottom:1790}});}; - c.readReceiptCloseRegion({},page);assert.equal(calls,1);assert.equal(c.findInviteCashPopupClose(page).text,'X'); -}); - - test('白色叉号图形检测定位四条斜臂,拒绝实心白块和区域外悬浮叉号',()=>{ - const {c}=load();const action={rect:{bottom:1510}}; - function pixels(cx,cy,solid){return {pixel:(_frame,x,y)=>{ - const dx=x-cx,dy=y-cy;const white=solid?Math.abs(dx)<18&&Math.abs(dy)<18: - Math.abs(dx)<=14&&Math.abs(dy)<=14&&Math.abs(Math.abs(dx)-Math.abs(dy))<=2; - return white?0xffffffff:0xff444444;}};} - for(const [cx,cy,solid,expected] of [[540,1766,false,true],[540,1766,true,false],[990,1766,false,false]]){ - c.images=pixels(cx,cy,solid);const items=[];c.readPromoCross({},items,action); - assert.equal(items.length>0,expected);if(expected){const r=items[0].rect;assert.ok(Math.abs((r.left+r.right)/2-cx)<=2);} - } - }); diff --git a/hongguo_auto/README.md b/hongguo_auto/README.md index cae8c66..d6d33c0 100644 --- a/hongguo_auto/README.md +++ b/hongguo_auto/README.md @@ -90,3 +90,9 @@ OPPO 真机 hongguo-12:12:41:16 命中“领午饭补补贴90金币”,12:41 每次启动先保持亮屏,将 AutoJs6 切到前台并自动确认系统“整个屏幕”截屏授权,再到目标应用详情执行强行停止和重开。亮屏保持整个流程,退出时释放;截图授权恢复只回到当前应用,不重新关闭应用。管理器原 10 分钟超时会主动结束正常任务,本次 OPPO 已改为 120 分钟。启动与调度验证见 `../task_manager/README.md`。 2026-10-26:版本22修复OPPO“恭喜获得追剧奖励”上下排列的双金额弹窗。原规则仅比较同一行,导致漏掉“看视频领3220金币”和“直接领取939金币”,并在弹窗上空滑搜索任务。新增标题与成对中央按钮的组合判定,沿用金额阈值规则(存在>=500时选较大,否则选较小)。3项针对性测试及语法检查通过。OPPO14:40:22实际点击3220金币按钮,广告倒计时结束后14:40:56识别领取成功并关闭广告。正式文件已同步至`/sdcard/脚本/红果/hongguo-daily.auto.js`,电脑与手机SHA256一致:`7012247625511ded2e284a4cbab61b84d9af011c8fe67a60fe9e01cdc8c7ddd4`。 + +2026-10-27:版本23修复OPPO翻卡结算标题变为“当前已翻出”后的漏识别。以中央标题、下方“开心收下”及更下方关闭叉号的组合确认结算弹窗,不依赖OCR能否正确读出4298金币数字。保留原“一共赢取…”规则。语法检查及4项测试通过。OPPO09:19:38自动点击开心收下,弹窗消失后恢复红包10连开入口搜索,09:20:29点击对应立即领取。正式文件同步SHA256:`0a36dd5aba76c05ed4360c611be9b5e512dd99034c7502ff370ba4066772bd4b`。使用同版恢复脚本继续红包及后续视频、追剧流程;未宣称整轮完成。 + +2026-10-27:版本24修复海量金币广告倒计时结束的空帧导致误退出。空OCR/原生页面继续等待,不把它当成广告结束;经历倒计时后须连续三次非广告识别才交还流程,保留单轮超时保护。语法及5项测试通过(含倒计时→多个空帧→领奖关闭的回归用例)。OPPO09:37:49已实际点击“领取成功X”关闭卡住广告,恢复福利任务复查,09:38:46进入追剧挑战流程。正式文件已覆盖并校验一致:`3be7c2c74a2d90086c9042d35df68f4a92c8ddc96d73f3a57e1497433cf432ab`;尚未验证整轮任务完成。 + +2026-10-27:版本25修复追剧间插“极限飞车”推广卡片导致连续播放器识别失败退出。仅在无奖励倒计时、非奖励广告、底部明确提示“上滑继续看短剧”时上滑跳过,最多连续3次;随后重新识别播放器继续观看,不以推广卡片认定任务完成。语法及7项测试通过。OPPO09:53:09实际上滑跳过卡片,09:53:11确认恢复播放第5集。正式脚本已覆盖,SHA256一致:`3dd8a1e987d35156e3d46c951012f81719f8c844522e3b1b03838abb9de449ba`。当前继续追剧及奖励复查,未宣称全部奖励完成。 diff --git a/hongguo_auto/hongguo-daily.auto.js b/hongguo_auto/hongguo-daily.auto.js index 61198cb..cefc969 100644 --- a/hongguo_auto/hongguo-daily.auto.js +++ b/hongguo_auto/hongguo-daily.auto.js @@ -4,7 +4,7 @@ // 页面识别:无障碍文字 + 可选的本地 $ocr.detect;图片不上传、不写入日志。 // 福利 → 签到 → 翻卡 → 红包10连开 → 看视频赚海量金币 → 追剧挑战赛;不执行阅读和吃饭补贴。 var CONFIG = { - version: "2026-10-26-hongguo-22-drama-choice", + version: "2026-10-27-hongguo-25-drama-intermission", packageName: "com.phoenix.read", rewardThreshold: 500, pollMs: 1200, @@ -717,7 +717,18 @@ function isCenteredPopupItem(item) { } function findFlipSettlementHeading(items) { - return first(items, /^[.,,。||]*一共[赢贏]取\d+(?:,\d{3})*金币$/, isCenteredPopupItem); + var original = first(items, /^[.,,。||]*一共[赢贏]取\d+(?:,\d{3})*金币$/, isCenteredPopupItem); + if (original) return original; + var current = first(items, /^当前已翻出$/, isCenteredPopupItem); + if (!current) return null; + var claim = first(items, /^开心收下$/, function(item) { + return isCenteredPopupItem(item) && item.rect.top > current.rect.bottom && + item.rect.top < current.rect.bottom + device.height * 0.35; + }); + var close = first(items, /^(?:关闭|关闭弹窗|[xX×✕])$/, function(item) { + return isCenteredPopupItem(item) && claim && item.rect.top > claim.rect.bottom; + }); + return claim && close ? current : null; } function findFlipSettlementButton(items) { @@ -1146,6 +1157,10 @@ function handleVideosLoop(returnPattern, launchGraceMs) { sleep(CONFIG.pollMs); continue; } + // 广告结束切帧时截图和原生树可能同时为空,空帧不是广告退出证据。 + if (!items.length) {stableReturn=0;sleep(CONFIG.pollMs);continue;} + // 经历过倒计时后,连续三次非广告识别才交还任务流程,等待延迟出现的领奖关闭。 + if (sawCountdown && ++stableReturn < 3) {sleep(CONFIG.pollMs);continue;} // 广告可能在点击领取数秒后才出现;启动宽限期内继续识别,避免提前结束。 if (Date.now() < launchDeadline) { sleep(CONFIG.pollMs); continue; } // 无倒计时、无关闭、无额外奖励就交还调度,不等待旧的返回页标签。 @@ -2087,13 +2102,29 @@ function dramaPlayer(items) { })); } +function dramaIntermissionCard(items) { + // 仅识别播放器明确给出的继续提示,不用上滑跳过奖励广告倒计时。 + if (countdown(items) || isAdvertisementPage(items)) return null; + return first(items, /上滑继续看短剧$/, function(item) { + return item.rect.top > device.height * 0.8 && item.rect.bottom < device.height * 0.98; + }); +} + function watchDramaRound(remainingEpisodes) { // 本轮集数只用于提前回卡片复查,最终是否达标始终以平台奖励状态为准。 var candidate = null, stableEpisode = null, completed = 0; var started = Date.now(), enteredAt = started, lastEpisode = "", lastProgressAt = started; - var fullEntryAttempts = 0, resumeAttempts = 0; + var fullEntryAttempts = 0, resumeAttempts = 0, intermissionAttempts = 0; while (Date.now() - started < CONFIG.dramaRoundWatchMs) { var page = snapshot(); // 广告、直播与弹窗仍优先处理,绝不在遮挡层上滑动播放器。 + if (dramaIntermissionCard(page)) { + if (++intermissionAttempts > 3) stopWith("短剧推广卡片连续三次上滑未消失,保留现场"); + writeRunLog("DRAMA INTERMISSION: 按上滑继续看短剧提示跳过推广卡片"); + if (!swipe(device.width*0.4,device.height*0.75,device.width*0.4,device.height*0.3,700)) + stopWith("短剧推广卡片上滑失败"); + enteredAt=Date.now();sleep(CONFIG.pollMs);continue; + } + intermissionAttempts = 0; var full = dramaPreviewEntry(page); if (full) { if (++fullEntryAttempts > 3) stopWith("观看完整短剧入口连续三次未响应"); diff --git a/hongguo_auto/tests/drama-choice.test.js b/hongguo_auto/tests/drama-choice.test.js deleted file mode 100644 index 7a6a354..0000000 --- a/hongguo_auto/tests/drama-choice.test.js +++ /dev/null @@ -1,6 +0,0 @@ -const test=require('node:test'),assert=require('node:assert/strict'),fs=require('node:fs'),vm=require('node:vm'),path=require('node:path'); -const source=fs.readFileSync(path.join(__dirname,'../hongguo-daily.auto.js'),'utf8'); -function setup(){const c=vm.createContext({});vm.runInContext(source.slice(0,source.lastIndexOf('\ntry {')),c);c.device={width:1080,height:2400};return {c,p:JSON.parse(fs.readFileSync(path.join(__dirname,'fixtures/oppo-drama-choice.json'),'utf8'))};} -test('OPPO上下排列追剧奖励选3220而非939,并触发通用处理',()=>{const {c,p}=setup();assert.equal(c.findCoinChoiceClaim(p).text,'看视频领3220金币');assert.equal(c.needsCommonHandling(p),true);}); -test('缺少追剧弹窗标题或成对按钮不混入背景任务',()=>{const {c,p}=setup();for(const pattern of [/恭喜[获荻]得追剧奖励/,/^直接领取939金币$/,/^看视频领3220金币$/])assert.equal(c.findCoinChoiceClaim(p.filter(x=>!pattern.test(x.text))),null);}); -test('保留500金币阈值规则,两选项都低于阈值选较小',()=>{const {c,p}=setup();p.forEach(x=>{x.text=x.text.replace('3220金币','320金币').replace('939金币','99金币');});assert.equal(c.findCoinChoiceClaim(p).text,'直接领取99金币');}); diff --git a/hongguo_auto/tests/fixtures/oppo-drama-choice.json b/hongguo_auto/tests/fixtures/oppo-drama-choice.json deleted file mode 100644 index 3b22538..0000000 --- a/hongguo_auto/tests/fixtures/oppo-drama-choice.json +++ /dev/null @@ -1 +0,0 @@ -[{"text":"恭喜获得追剧奖励","rect":{"left":325,"top":697,"right":757,"bottom":772}},{"text":"939","rect":{"left":315,"top":1108,"right":424,"bottom":1179}},{"text":"直接领取","rect":{"left":297,"top":1196,"right":441,"bottom":1238}},{"text":"3220","rect":{"left":650,"top":1108,"right":791,"bottom":1179}},{"text":"看视频领取","rect":{"left":631,"top":1196,"right":811,"bottom":1238},"darkButton":false},{"text":"看视频领3220金币","rect":{"left":340,"top":1370,"right":743,"bottom":1427}},{"text":"直接领取939金币","rect":{"left":354,"top":1500,"right":727,"bottom":1557}},{"text":"common-info-modalbackground","rect":{"left":153,"top":614,"right":928,"bottom":1514}},{"text":"rewardcoin","rect":{"left":228,"top":814,"right":510,"bottom":1096}},{"text":"rewardcoin","rect":{"left":580,"top":814,"right":862,"bottom":1096}},{"text":"doubleinfotransition","rect":{"left":499,"top":998,"right":595,"bottom":1058}},{"text":"关闭","rect":{"left":481,"top":1713,"right":601,"bottom":1833}},{"text":"金币收益>","rect":{"left":68,"top":206,"right":221,"bottom":237}},{"text":"5.1元","rect":{"left":68,"top":289,"right":224,"bottom":356}},{"text":"看短","rect":{"left":54,"top":759,"right":166,"bottom":812}},{"text":"0点自动兑现金(可能存在延迟)","rect":{"left":67,"top":401,"right":521,"bottom":432}},{"text":"看短","rect":{"left":57,"top":897,"right":165,"bottom":943}},{"text":"再機7","rect":{"left":61,"top":965,"right":155,"bottom":1001}},{"text":"待领","rect":{"left":77,"top":1192,"right":159,"bottom":1226}},{"text":"迫剧","rect":{"left":72,"top":1338,"right":152,"bottom":1378}},{"text":"完成通","rect":{"left":62,"top":1407,"right":155,"bottom":1438}},{"text":"看","rect":{"left":116,"top":1512,"right":143,"bottom":1534}},{"text":"日常福利","rect":{"left":78,"top":1743,"right":260,"bottom":1788}},{"text":"首页","rect":{"left":82,"top":2229,"right":168,"bottom":2274}},{"text":"现金收益(元)>","rect":{"left":413,"top":204,"right":626,"bottom":238}},{"text":"今日打卡任务待完成","rect":{"left":273,"top":534,"right":637,"bottom":574}},{"text":"13.59","rect":{"left":423,"top":282,"right":638,"bottom":358}},{"text":"恭喜荻得追剧奖励","rect":{"left":328,"top":709,"right":751,"bottom":759}},{"text":"吃饭补贴","rect":{"left":207,"top":2096,"right":375,"bottom":2137}},{"text":"|吃饭补见O50","rect":{"left":180,"top":2087,"right":501,"bottom":2136}},{"text":"天天顿金币最高63014","rect":{"left":188,"top":1850,"right":715,"bottom":1896}},{"text":"剧场","rect":{"left":288,"top":2229,"right":376,"bottom":2274}},{"text":"X","rect":{"left":529,"top":1758,"right":555,"bottom":1786}},{"text":"今日签到立即领10金币,做任务最高领","rect":{"left":204,"top":1920,"right":762,"bottom":1952}},{"text":"63004金币","rect":{"left":203,"top":1960,"right":365,"bottom":1990}},{"text":"Tm十丁头人Hフ2人工","rect":{"left":204,"top":2164,"right":469,"bottom":2176}},{"text":"商城","rect":{"left":495,"top":2229,"right":586,"bottom":2273}},{"text":"福利","rect":{"left":697,"top":2227,"right":792,"bottom":2277}},{"text":"领810金币","rect":{"left":831,"top":401,"right":985,"bottom":432}},{"text":"去打卡>","rect":{"left":874,"top":562,"right":1004,"bottom":598}},{"text":"取","rect":{"left":919,"top":925,"right":990,"bottom":970}},{"text":"取","rect":{"left":921,"top":1367,"right":985,"bottom":1403}},{"text":"点击领2294","rect":{"left":797,"top":1836,"right":979,"bottom":1866}},{"text":"去领取","rect":{"left":827,"top":1896,"right":970,"bottom":1941}},{"text":"|待领","rect":{"left":974,"top":1190,"right":1034,"bottom":1227}},{"text":"去领取","rect":{"left":826,"top":2119,"right":970,"bottom":2163}},{"text":"11","rect":{"left":997,"top":1061,"right":1023,"bottom":1087}},{"text":"|我的","rect":{"left":908,"top":2218,"right":1010,"bottom":2271}}] \ No newline at end of file diff --git a/huolong_auto/README.md b/huolong_auto/README.md index fc7f466..05c2fe5 100644 --- a/huolong_auto/README.md +++ b/huolong_auto/README.md @@ -81,3 +81,18 @@ OPPO 脚本位置:`/sdcard/脚本/火龙/huolong-daily.auto.js`。在 AutoJs6 任务搜索改用目标包的原生纵向 `ScrollView` 翻页,原生返回已到边界时立即换方向;缺少原生容器时才使用手势。页面停止变化的比较优先采用原生正文,忽略状态栏、OCR抖动和计时数字。避免已完成签到仍反复32次滑动,延迟进入漫剧流程。 语法检查及44项测试通过。通过 vivo 无线调试同步正式脚本并重启对应火龙实例,SHA256 两端一致:`b58e29ed47adce0115bffe983754a3182ba6a57f0292284b73aae02937d19d48`。13:58:32签到仅三次翻页后结束搜索,13:58:49确认广告任务完成并进入漫剧流程;13:59:19自动点击去看剧,随后页面文字确认“选集·全54集”“第1集”“全屏观看”,已实际离开福利进入播放页。未宣称所有漫剧奖励已经领完。 + +2026-10-27:版本7修复vivo广告挽留弹窗OCR将“放弃奖励”识别为“放弃奔奖励”,导致额外奖励退出识别失败、视频任务反复重试。退出按钮匹配兼容一个或两个“弃/奔”字,保留同一前景层标题、继续观看和退出按钮的组合校验及原金额阈值。语法和3项测试通过。正式文件已覆盖,手机与电脑SHA256一致:`3e308b30741618d19a6c19b6d4cae33b764dd78662ae7a79779a6c3e69d7281f`。恢复后vivo10:21:17实际关闭奖励视频,10:21:19点击“我知道了”确认层,10:21:23完成第1轮并继续第2轮;未宣称整个任务结束。 + +## 2026-10-28 vivo 福利页反复翻动修复(版本8) + +现场版本7日志持续搜索广告领取入口;无障碍树确认“看视频广告得火龙币”同一行右侧已显示“已完成”,签到任务也已领取。当前正式源文件还缺少此前要求的看漫剧衔接。 + +- 视频广告同一任务行连续两次确认完成状态后结束该项;其他任务的完成、遮挡、按钮暂缺不能冒充完成。 +- 福利列表改用原生纵向 ScrollView,返回边界立即换方向;页面比较优先原生正文,避免状态栏与 OCR 抖动导致反复空翻。 +- 恢复“广告 -> 看漫剧得福利”。横向奖励条从左至右读档位,待领取优先领取,否则播放60秒再返回福利复查。连续两次全扫描确认各档已领,且合计等于任务行显示总额,才结束;当前实机10档合计15440。单阶段进度满、仅点击、缺少入口均不算全部领奖完成。 +- 保留原有广告弹窗规则和500金币追加奖励阈值;漫剧基础奖励领取不套用该门槛。单次识别/操作限时,连续3次漫剧异常上报;不设整段看剧总轮数。 + +验证:语法检查、12项火龙行为测试与差异空白检查通过。新增当前福利页/完成行 fixtures。已覆盖 vivo `/sdcard/脚本/火龙/huolong-daily.auto.js` 并启动正式脚本,手机与电脑SHA256均为 `ba4b7c27406027c00288eac94f67e01d79164cfd32f63410c9f126750a273ad8`。 + +真机13:25:57连续复核广告已完成后进入漫剧;13:26:44完整扫描确认80、160档已领,其余待解锁或观看中;13:26:54确认进入播放页,13:28:04自动返回福利页,13:28:12继续点击240档待领取。已验证播放/回查/继续领奖循环,尚未验证当日15440奖励全部领取。 diff --git a/huolong_auto/huolong-daily.auto.js b/huolong_auto/huolong-daily.auto.js index 82f7d64..d9c93b9 100644 --- a/huolong_auto/huolong-daily.auto.js +++ b/huolong_auto/huolong-daily.auto.js @@ -4,7 +4,7 @@ // 页面识别:无障碍文字 + 可选的本地 $ocr.detect;图片不上传、不写入日志。 // 底部福利 → 签到 → 看视频广告得火龙币。 var CONFIG = { - version: "2026-10-22-huolong-6", + version: "2026-10-28-huolong-8-welfare-flow", packageName: "com.tencent.kairos", rewardThreshold: 500, pollMs: 1200, @@ -434,7 +434,7 @@ function adExitPopupDecision(items) { var watch = first(items, /^继续观看$/, function (item) { return isCenteredPopupItem(item) && item.rect.top >= heading.rect.bottom; }); - var exit = watch && first(items, /^(?:放[弃奔]奖励|坚持退出|退出|关闭)$/, function (item) { + var exit = watch && first(items, /^(?:放[弃奔]{1,2}奖励|坚持退出|退出|关闭)$/, function (item) { return isCenteredPopupItem(item) && item.rect.top >= watch.rect.bottom; }); if (!watch || !exit) return null; @@ -1059,7 +1059,7 @@ function handleVideosLoop(returnPattern, launchGraceMs) { stableReturn = 0; if (++actions > CONFIG.maxVideos * 4) stopWith("弹窗处理次数达到上限,页面可能没有响应,已停止。"); var take = offer.amount !== null && offer.amount >= CONFIG.rewardThreshold; - var button = first(items, take ? /^(领取奖励|领更多金币|颌更多金币|确认|继续领金币|继续观看|看视频领取|看视频领\d+金币|看视频(?:再得|再领|领)\d+金币)$/ : /^[||]?(放[弃奔]奖励|坚持退出|退出|[xX×✕])$/, + var button = first(items, take ? /^(领取奖励|领更多金币|颌更多金币|确认|继续领金币|继续观看|看视频领取|看视频领\d+金币|看视频(?:再得|再领|领)\d+金币)$/ : /^[||]?(放[弃奔]{1,2}奖励|坚持退出|退出|[xX×✕])$/, function (item) { return item.rect.top >= offer.heading.rect.top && item.rect.top < offer.heading.rect.bottom + device.height * 0.30; }); if (!button && !take) button = findEmptyRewardPopupClose(items, true); @@ -1172,27 +1172,41 @@ function signInStep() { writeRunLog("SIGN DONE: 签到领取流程已处理,继续视频广告任务;不将点击当作到账。"); } +function scrollWelfareList(forward) { + // 原生纵向容器能确认边界,避免在横向奖励条或静止页面上反复手势。 + var lists = className("android.widget.ScrollView").packageName(CONFIG.packageName).find(); + for (var i=0; idevice.height*0.4) + return forward ? node.scrollForward() : node.scrollBackward(); + } + return swipe(Math.round(device.width*0.5),Math.round(device.height*(forward?0.8:0.35)), + Math.round(device.width*0.5),Math.round(device.height*(forward?0.35:0.8)),450); +} +function welfareSearchKey(page) { + var nativeItems=page.filter(function(item){return !!item.node;}); + return (nativeItems.length?nativeItems:page).filter(function(item){ + return item.rect.top>device.height*0.15 && item.rect.bottom= 2) break; + if (moved === false || stationary >= 2) break; } } return null; @@ -1279,6 +1293,19 @@ function findMassVideoClaim(items) { if(!isWelfarePage(items))return null; return findEarningTaskAction(items,MASS_VIDEO_LABEL,/^[||]?(?:去领取|立即[领颌颁頒]取|领取)$/); } +function findMassVideoCompleted(items) { + if (!isClearWelfarePage(items)) return null; + var labels=matches(items,MASS_VIDEO_LABEL); + for(var i=0;idevice.width*0.65 && + Math.abs((item.rect.top+item.rect.bottom-row.rect.top-row.rect.bottom)/2)heading.rect.bottom;}); + var bottom=next?next.rect.top:device.height*0.91; + var total=first(page,/^最高\+\d+$/,function(item){ + return Math.abs(item.rect.top-heading.rect.top)heading.rect.bottom+device.height*0.05 && item.rect.bottom=item.rect.bottom-10 && label.rect.top-item.rect.bottomdevice.width*0.6) + return forward?node.scrollForward():node.scrollBackward(); + } + stopWith('漫剧奖励条未完整显示,不能将部分档位当作全部奖励'); +} +function locateDramaCard() { + enterWelfareStep(); + var found=searchTaskAction(function(page){var card=dramaCard(page);return card&&card.action;},'看漫剧去看剧或领取',/漫剧|去看剧|领取/,'DRAMA SEARCH'); + if(!found)stopWith('没有确认看漫剧入口,不能当作奖励全部领完'); + for(var i=0;i<5;i++) { + var card=dramaCard(snapshot()); + if(card && card.grades.length && card.heading.rect.top0 && grades.length>0 && grades.every(function(g){return /^(?:已领|已领取|已获得)$/.test(g.state);}) && + grades.reduce(function(sum,g){return sum+g.amount;},0)===total; +} +function scanDramaRewards() { + locateDramaCard(); + var reachedStart=false; + for(var i=0;i<16;i++) { + if(scrollDramaRewards(false)===false){reachedStart=true;break;} + sleep(300); + } + if(!reachedStart)stopWith('未确认漫剧奖励条左边界'); + var seen={}, total=null; + for(var j=0;j<16;j++) { + var card=dramaCard(snapshot()); + if(!card || !card.grades.length)stopWith('漫剧奖励档位识别不完整'); + if(card.total)total=card.total; + var claim=card.grades.filter(function(g){return !!g.claim;})[0]; + if(claim)return {claim:claim,complete:false}; + if(card.action && /^(?:领取|去领取)$/.test(card.action.text))return {action:card.action,complete:false}; + card.grades.forEach(function(g){seen[g.amount]=g;}); + if(scrollDramaRewards(true)===false) { + var grades=Object.keys(seen).map(function(key){return seen[key];}); + writeRunLog('DRAMA REWARDS: '+JSON.stringify(grades.map(function(g){return {amount:g.amount,state:g.state,progress:g.progress};}))+';总额='+total); + return {complete:dramaRewardsComplete(grades,total),grades:grades,total:total}; + } + sleep(CONFIG.pollMs); + } + stopWith('未确认漫剧奖励条右边界'); +} +function isDramaPlayer(page) { + if(isWelfarePage(page) || isAdvertisementPage(page))return false; + var episode=first(page,/第\d+集|选集[·・]?全?\d+集/), full=first(page,/^全屏观看$/); + return !!(episode && (full || bottomNavigation(page,/^刷刷$/))); +} +function watchDramaRound() { + var card=locateDramaCard(); + if(!card.action || card.action.text!=='去看剧')stopWith('漫剧当前不是去看剧入口,重新核验领奖状态'); + tap(card.action,function(page){var current=dramaCard(page);return current&¤t.action&¤t.action.text==='去看剧'?current.action:null;}); + var enterDeadline=Date.now()+20000,page; + do {page=snapshot();if(isDramaPlayer(page))break;sleep(CONFIG.pollMs);}while(Date.now()=3)stopWith('漫剧播放被未知页面打断,保留现场'); + } + enterWelfareStep(); + writeRunLog('DRAMA WATCH DONE: 已返回福利页复查,不将观看时长当作奖励到账'); +} +function dramaStep() { + var completeChecks=0,errors=0,claims=0; + while(true) { + var result=runStep('看漫剧奖励核验',scanDramaRewards); + if(!result.ok || !result.value) { + if(++errors>=3)stopWith('漫剧奖励连续3次核验失败,未确认全部领完'); + sleep(CONFIG.videoRetryMs);continue; + } + var rewards=result.value; + if(rewards.complete) { + if(++completeChecks>=2) { + writeRunLog('DRAMA DONE: 连续两次完整扫描确认所有档位已领,总额='+rewards.total); + return {ok:true,completed:true,claims:claims}; + } + sleep(CONFIG.pollMs);continue; + } + completeChecks=0; + var step=runStep(rewards.claim||rewards.action?'领取漫剧阶段奖励':'观看漫剧',function(){ + if(rewards.claim || rewards.action) { + var amount=rewards.claim&&rewards.claim.amount; + tap(rewards.claim?rewards.claim.claim:rewards.action,function(page){ + var current=dramaCard(page);if(!current)return null; + if(!amount)return current.action&&/^(?:领取|去领取)$/.test(current.action.text)?current.action:null; + var grade=current.grades.filter(function(g){return g.amount===amount;})[0];return grade&&grade.claim; + }); + snapshot();claims++; + writeRunLog('DRAMA CLAIM CHECK: 已处理领取入口,继续核验档位状态'); + } else watchDramaRound(); + }); + if(step.ok)errors=0; + else if(++errors>=3)stopWith('漫剧操作连续3次失败,未确认全部领奖'); + else sleep(CONFIG.videoRetryMs); + } +} + function runDaily() { files.write(CONFIG.logPath, ""); writeRunLog("START: version="+CONFIG.version+";火龙免费剧漫;本地火龙币文字归一匹配。"); @@ -1418,15 +1596,17 @@ function runDaily() { if(CONFIG.useLocalOcr&&!localOcrEnabled)throw new Error("本地OCR未就绪,不能继续判断弹窗"); restartTargetApp(); enterWelfareStep(); - writeRunLog("FLOW: 底部福利 -> 签到 -> 看视频广告得火龙币;饭点补贴已取消。"); + writeRunLog("FLOW: 底部福利 -> 签到 -> 看视频广告得火龙币 -> 看漫剧得福利;饭点补贴已取消。"); var failed=[]; var sign=runStep("签到",signInStep); if(!sign.ok)failed.push("签到"); // 签到结束或跳过后直接检查视频,通用规则始终先执行。 var video=runStep("看视频广告得火龙币",massVideoStep,0); if(!video.ok || !video.value || !video.value.ok)failed.push("视频广告"); + var drama=runStep("看漫剧得福利",dramaStep,0); + if(!drama.ok || !drama.value || !drama.value.ok)failed.push("看漫剧"); if(failed.length)throw new Error("后续任务已检查,本轮未恢复的步骤:"+failed.join("、")); - return "END: 火龙签到、视频广告已配置流程执行结束;无入口则跳过,不将点击当作到账。"; + return "END: 火龙签到、视频广告及看漫剧奖励流程已执行结束,不将点击当作到账。"; } diff --git a/kuaishou_auto/kuaishou-daily.auto.js b/kuaishou_auto/kuaishou-daily.auto.js index 86a020b..3b6c194 100644 --- a/kuaishou_auto/kuaishou-daily.auto.js +++ b/kuaishou_auto/kuaishou-daily.auto.js @@ -2,7 +2,7 @@ // 快手极速版:无障碍文字 + 手机本地 OCR;不保存或上传图片,不访问媒体音量。 var CONFIG = { - version: "2026-10-26-kuaishou-11-continuous-video", + version: "2026-10-28-kuaishou-17-live-preview", packageName: "com.kuaishou.nebula", pollMs: 1200, recognitionTimeoutMs: 30000, @@ -19,14 +19,12 @@ var localOcrEnabled = false; var captureQueue = null, captureWorker = null, captureRecoveries = 0; var rejection = null, rewardSerial = 0, currentRoundRewardCoins = null; var STAGES = [ + {name: "翻卡赢金币", title: /^翻卡赢金币$/, kind: "flip"}, + {name: "连续看视频阶段奖励", kind: "continuousVideo"}, {name: "看广告得金币", title: /^看广告[得赚]金币$/, kind: "ad", stopAtCoins: 20}, - {name: "到饭点领饭补", title: /^到饭点领饭补$/, kind: "meal"}, {name: "明日0点领金币", title: /^(?:明日0点领金币|预约领金币)$/, kind: "reserve"}, {name: "搜索看广告", title: /^搜索看广告$/, kind: "search"}, - {name: "逛街领金币", title: /^逛街[领赚]金币$/, kind: "street"}, - {name: "翻卡赢金币", title: /^翻卡赢金币$/, kind: "flip"}, - {name: "逛快手商城赚金币", title: /^逛(?:快手|开售)商城[赚领]金币$/, kind: "mall", products: 6}, - {name: "连续看视频阶段奖励", kind: "continuousVideo"} + {name: "逛快手商城赚金币", title: /^逛(?:快手|开售)商城[赚领]金币$/, kind: "mall", products: 6} ]; function writeRunLog(message) { @@ -279,7 +277,7 @@ function readSnapshot() { if (!box || !node.visibleToUser()) continue; var resourceId = String(node.id() || ""), enabled = node.enabled(); var values = [compact(node.text()), compact(node.desc())]; - if (!values[0] && /:id\/(?:video_countdown|video_countdown_end_icon|.*close.*)$/.test(resourceId)) { + if (!values[0] && /:id\/(?:video_countdown|video_countdown_end_icon|.*close.*|live_simple_play_content_view|live_simple_play_swipe_text)$/.test(resourceId)) { values.push("@" + resourceId.split("/").pop()); } for (var v = 0; v < values.length; v++) { @@ -973,6 +971,23 @@ function locateContinuousVideoCard() { } throw new Error("连续看视频奖励卡片未找到,不能认定全部领取完成"); } +function skippableContinuousFeedCard(page) { + if (!bottomNavigation(page,/^首页$/)) return false; + return !!first(page,/^(?:上滑继续观看视频|点击进入直播间|查看图片详情|图文)$/) || page.some(function(item) { + // OPPO 直播预览的进入提示会随动画隐藏,保留稳定内容控件和底部标题作为证据。 + return /:id\/(?:live_simple_play_swipe_text|live_simple_play_content_view|live_preview_bottom_caption|pic_text)$/.test(item.id || ""); + }); +} +function waitContinuousVideoReceipt() { + // vivo 弹窗动画期间原生树和截图可能仍是上一帧,不能单次读取就判定失败。 + var deadline=Date.now()+15000; + do { + var page=snapshot(); + if(first(page,/^任务完成奖励$/)) return page; + sleep(CONFIG.pollMs); + } while(Date.now()text,desc:()=>desc,id:()=>id,bounds:()=>box,visibleToUser:()=>visible,enabled:()=>true};} -test('单次目标应用查询保留文字、描述与无文字广告关闭ID并剔除隐藏节点',()=>{ - const c=vm.createContext({});vm.runInContext(source.slice(0,source.indexOf('// MAIN:')),c); - c.device={width:1080,height:2400};c.keepScreenAwake=()=>{};c.foregroundPackage=()=>c.CONFIG.packageName;c.files={write:()=>{}}; - const box={left:10,top:100,right:200,bottom:160}; - const nodes=[node('任务中心','任务中心','',box),node('','关闭弹窗','',box), - node('','','com.kuaishou.nebula:id/video_countdown_end_icon',box),node('隐藏','','',box,false), - node('越界','','',{left:0,top:2500,right:100,bottom:2600})]; - let queries=0;c.packageName=p=>{assert.equal(p,'com.kuaishou.nebula');return {find:()=>{queries++;return {size:()=>nodes.length,get:i=>nodes[i]};}};}; - const page=c.readSnapshot();assert.equal(queries,1);assert.deepEqual(Array.from(page,x=>x.text),['任务中心','关闭弹窗','@video_countdown_end_icon']); -}); -test('vivo已成功领取14金币后识别原生关闭按钮,倒计时未结束时不关闭',()=>{ - const c=vm.createContext({});vm.runInContext(source.slice(0,source.indexOf('// MAIN:')),c);c.device={width:1080,height:2400}; - const p=JSON.parse(fs.readFileSync(require('node:path').join(__dirname,'fixtures/vivo-ad-reward.json'),'utf8')); - assert.equal(c.adReward(p),true);assert.equal(c.adClose(p).text,'@video_countdown_end_icon'); - for(const label of ['28秒后可领取奖励','0秒后可领取奖励','已成功领取奖励']){ - const page=p.map(x=>({...x,text:x.text==='已成功领取14金币'?label:x.text})); - assert.equal(!!c.adClose(page),label==='已成功领取奖励'); - } - const background=p.map(x=>({...x,rect:{...x.rect,top:1500,bottom:1550}}));assert.equal(c.adClose(background),null); -}); -test('去搜索点击紧邻按钮容器,不点击整行,容器过大时回退文字位置',()=>{ - const c=vm.createContext({});vm.runInContext(source.slice(0,source.indexOf('// MAIN:')),c);c.device={width:1080,height:2400};c.foregroundPackage=()=>c.CONFIG.packageName;c.sleep=()=>{};c.writeRunLog=()=>{}; - let clicks=0,presses=0;c.press=()=>{presses++;return true;}; - const rect={left:822,top:1444,right:963,bottom:1507};let parentBox={left:763,top:1411,right:1022,bottom:1541}; - const parent={bounds:()=>parentBox,enabled:()=>true,clickable:()=>true,click:()=>{clicks++;return true;}}; - const item={text:'去搜索',rect,node:{clickable:()=>false,parent:()=>parent}}; - c.clickItem(item);assert.equal(clicks,1);assert.equal(presses,0); - parentBox={left:43,top:1357,right:1037,bottom:1595};c.clickItem(item);assert.equal(clicks,1);assert.equal(presses,1); -}); -test('实际到账1金币锁定退出信号,最高奖励与余额不触发',()=>{ - const c=vm.createContext({});vm.runInContext(source.slice(0,source.indexOf('// MAIN:')),c); - for(const value of ['最高1金币','金币1','搜索得1金币'])c.recordRewardCoins(value);assert.equal(c.currentRoundRewardCoins,null); - c.recordRewardCoins('已成功领取1金币');c.recordRewardCoins('已获得50金币');assert.equal(c.currentRoundRewardCoins,1); -}); -test('搜索与逛街类目单次1金币退出当前流程',()=>{ - for(const kind of ['search','street']){ - const c=vm.createContext({});vm.runInContext(source.slice(0,source.indexOf('// MAIN:')),c); - c.locateTask=()=>({title:'测试任务'});c.snapshot=()=>[];c.coinBalance=()=>100;c.ensureTaskCenter=()=>{};c.writeRunLog=()=>{}; - c.boundedCall=(_name,_ms,fn)=>fn();c.executeRound=()=>{c.recordRewardCoins('恭喜获得1金币');return {rewardSeen:true};}; - const result=c.drainTask({title:'测试任务'},kind,{});assert.equal(result.lastRewardCoins,1);assert.match(result.reason,/1金币/); - } -}); -test('连续看视频区分待领取、观看和全部领完,阶段进度满不等于全部领完',()=>{ - const c=vm.createContext({});vm.runInContext(source.slice(0,source.indexOf('// MAIN:')),c);c.device={width:1080,height:2400}; - const p=JSON.parse(fs.readFileSync(require('node:path').join(__dirname,'fixtures/vivo-continuous-video.json'),'utf8')); - let card=c.continuousVideoCard(p);assert.equal(card.progress.done,900);assert.equal(card.watch.text,'去看视频');assert.equal(card.done,false); - let ready=p.map(x=>({...x,text:x.text==='去看视频'?'领金币':x.text}));assert.equal(c.continuousVideoCard(ready).claim.text,'领金币'); - let full=p.map(x=>({...x,text:x.text==='900/12112'?'12112/12112':x.text}));assert.equal(c.continuousVideoCard(full).done,false); - const done=p.filter(x=>x.text!=='去看视频');done.push({text:'今日奖励已全部领取',rect:{left:100,top:942,right:800,bottom:990}}); - assert.equal(c.continuousVideoCard(done).done,true); -});