22 lines
1.5 KiB
JavaScript
22 lines
1.5 KiB
JavaScript
var other=engines.all().filter(function(e){return e.id!==engines.myEngine().id;});
|
||
if(other.length)throw new Error('其他脚本仍在运行,取消独立排查');
|
||
eval(files.read('/sdcard/脚本/抖音极速/douyin-lite.js').split('// MAIN:')[0]);
|
||
CONFIG.logPath='/sdcard/Download/douyin-task-probe.log';
|
||
CONFIG.pageTextPath='/sdcard/Download/douyin-task-probe-page.json';
|
||
var output='/sdcard/Download/douyin-task-probe.json',frames=[];
|
||
function plainPage(p){return p.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,10000);sleep(1200);sessionStartedAt=Date.now();
|
||
var originalSnapshot=snapshot;
|
||
snapshot=function(){var p=originalSnapshot();frames.push({page:plainPage(p),signature:pageSignature(p),
|
||
rows:rowsOnPage(p,TASK_TITLE).map(function(r){return {title:r.title,detail:r.detail,action:r.action&&r.action.text};})});return p;};
|
||
var found=locateTask(/^看广告赚金币$/);
|
||
files.write(output,JSON.stringify({found:found&&{title:found.title,detail:found.detail,action:found.action&&found.action.text},frames:frames}));
|
||
}catch(e){files.write(output,JSON.stringify({error:String(e),stack:String(e.stack),frames:frames}));}
|
||
finally{
|
||
try{images.stopScreenCapture();}catch(ignore){}
|
||
if(captureWorker&&captureWorker.isAlive()){captureWorker.interrupt();captureWorker.join(1500);}
|
||
releaseScreenAwake();
|
||
}
|