eval(files.read('/sdcard/脚本/抖音极速/douyin-lite.js').split('// MAIN:')[0]); CONFIG.logPath='/sdcard/Download/douyin-close-probe.log';CONFIG.pageTextPath='/sdcard/Download/douyin-close-probe-page.json'; try{ sessionStartedAt=Date.now();auto.waitFor();keepScreenAwake();initLocalOcr();app.launchPackage(CONFIG.packageName);waitStartupPackage(CONFIG.packageName,10000);sleep(1000); captureCall('局部文字识别',30000,function(){ var page=readSnapshot(),frame=images.copy(captureScreen()),out={items:JSON.parse(files.read(CONFIG.pageTextPath)),crops:[]}; try{ var merged=first(page,/^(?:领取成功|奖励已到账|已获得奖励)[xX×✕]$/); if(merged)for(var n=0;n<2;n++){ var h=merged.rect.bottom-merged.rect.top,w=Math.round(h*(n?1.5:1)),left=merged.rect.right-w,top=Math.max(0,merged.rect.top-6),height=Math.round(h+12),crop=null,big=null; try{crop=images.clip(frame,left,top,w,height);big=images.resize(crop,[w*3,height*3]);var detected=$ocr.detect(big);out.crops.push({left:left,top:top,width:w,height:height,results:detected.map(function(r){return{text:r.text,bounds:r.bounds};})});} finally{if(big)big.recycle();if(crop)crop.recycle();} } }finally{frame.recycle();} files.write('/sdcard/Download/douyin-close-probe.json',JSON.stringify(out)); }); }catch(e){files.write('/sdcard/Download/douyin-close-probe.json',JSON.stringify({error:String(e),stack:String(e.stack)}));} finally{try{images.stopScreenCapture();}catch(ignore){}if(captureWorker&&captureWorker.isAlive()){captureWorker.interrupt();captureWorker.join(1500);}releaseScreenAwake();}