2026-10-30 14:31:15 +08:00

27 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var output='/sdcard/Download/kuaishou-flip-inspect.json';
var active=engines.all().filter(function(e){return e.id!==engines.myEngine().id;})
.map(function(e){return {id:e.id,source:String(e.getSource())};});
if(active.length){files.write(output,JSON.stringify({engines:active,error:'其他脚本正在运行,未操作页面'}));exit();}
eval(files.read('/sdcard/脚本/快手/kuaishou-daily.auto.js').split('// MAIN:')[0]);
CONFIG.logPath='/sdcard/Download/kuaishou-flip-inspect.log';
CONFIG.pageTextPath='/sdcard/Download/kuaishou-flip-inspect-page.json';
needsLocalOcr=function(){return true;};
function plain(page){return page.map(function(i){return {text:i.text,rect:i.rect,id:i.id,enabled:i.enabled};});}
try{
auto.waitFor();keepScreenAwake();initLocalOcr();
app.launchPackage(CONFIG.packageName);waitStartupPackage(CONFIG.packageName,15000);sleep(1200);
finishExistingAd();var page=snapshot();
if(!isFlipPage(page)){
ensureTaskCenter();var row=locateTask(/^翻卡赢金币$/);
if(!row)throw new Error('未找到翻卡入口');
row=prepareRow(row);if(!row||!row.action)throw new Error('未识别翻卡入口按钮');
tapFresh(row.action);sleep(1500);page=snapshot();
}
files.write(output,JSON.stringify({engines:active,isFlip:isFlipPage(page),page:plain(page)}));
}catch(e){files.write(output,JSON.stringify({engines:active,error:String(e),stack:String(e.stack)}));}
finally{
try{images.stopScreenCapture();}catch(ignore){}
if(captureWorker&&captureWorker.isAlive()){captureWorker.interrupt();captureWorker.join(1500);}
releaseScreenAwake();
}