var output='/sdcard/Download/douyin-video-counts-inspect.json'; var report={startedAt:new Date().toISOString(),stopped:[]}; function save(){files.write(output,JSON.stringify(report));} try { var others=engines.all().filter(function(e){return e.id!==engines.myEngine().id;}); if(others.some(function(e){return !/\/douyin-lite\.js$/.test(String(e.getSource()));}))throw new Error('其他应用脚本仍在运行'); others.forEach(function(e){report.stopped.push(e.id);e.forceStop();}); var deadline=Date.now()+7000; while(engines.all().some(function(e){return report.stopped.indexOf(e.id)>=0;})&&Date.now()=0;}))throw new Error('旧抖音脚本尚未退出'); eval(files.read('/sdcard/脚本/抖音极速/douyin-lite.js').split('// MAIN:')[0]); CONFIG.logPath='/sdcard/Download/douyin-video-counts-inspect.log'; CONFIG.pageTextPath='/sdcard/Download/douyin-video-counts-page.json'; auto.waitFor();initLocalOcr();app.launchPackage(CONFIG.packageName);waitStartupPackage(CONFIG.packageName,10000);sleep(800); sessionStartedAt=Date.now(); var card=locateThirtyDayCard(),page=snapshot(); report.page=page.map(function(i){return {text:i.text,id:i.id,rect:i.rect};}); report.card=card&&{signature:card.signature,today:card.today.map(function(d){return {amount:d.amount,progress:d.progress,claimed:d.claimed, items:d.items.map(function(i){return {text:i.text,id:i.id,rect:i.rect};})};})}; }catch(e){report.error=String(e);report.stack=String(e.stack);} finally { try{images.stopScreenCapture();}catch(ignore){} if(typeof captureWorker!=='undefined'&&captureWorker&&captureWorker.isAlive()){captureWorker.interrupt();captureWorker.join(1500);} if(typeof releaseScreenAwake==='function')releaseScreenAwake(); report.finishedAt=new Date().toISOString();save(); } engines.execScriptFile('/sdcard/脚本/抖音极速/douyin-lite.js',{path:'/sdcard/脚本/抖音极速/'});