const douyin = require("./common/douyin"); const conf = require("./common/conf"); const engine = require("./common/engine"); const utility = require("./common/utility"); var param = { yxgs: 30, gksj1: 6, gksj2: 12, tggz: true, tgsy: true, dz: 80, gz: 10, pl: 50, zyyl: 60, gjc: conf.czyhGjzs, plhs: conf.commonts, pltp: true }; var czyh = { init() { return !!douyin.init() && !(typeof ENV_CONF != "undefined" && Object.assign(param, ENV_CONF), douyin.isRecommend() ? param.gjc.length < 1 ? (alert("请设置评论关键词!"), 1) : param.pl > 0 && param.plhs.length < 1 ? (alert("请设置评论话术"), 1) : (utility.toast("开始任务:垂直养号"), engine.sleep(1), device.keepScreenDim(), douyin.popupAndClose(), 0) : (alert("请在 抖音首页—推荐 界面运行"), 1)); }, hasKey() { var desc_text = douyin.getVideoDesc(); if (desc_text !== "") { for (let i = 0; i < param.gjc.length; i++) { if (desc_text && param.gjc[i] && desc_text.indexOf(param.gjc[i]) != "-1") { utility.toast("包含关键词:" + param.gjc[i]); sleep(500); return true; } } } return false; }, run() { if (czyh.init()) { let runCount = dzCount = gzCount = plCount = zyylCount = 0; while (true) { var startTime = engine.getUnix(); engine.sleepMs(1000, 2000); if (runCount >= param.yxgs) { device.cancelKeepingAwake(); alert("恭喜任务完成!", "本次任务共完成\n点赞" + dzCount + "次\n关注" + gzCount + "次\n评论" + plCount + "次\n访问主页" + zyylCount + "次"); return; } utility.toast("已观看 " + runCount + " 个有效视频,任务总数" + param.yxgs); if (douyin.skipVideo()) { douyin.execClose(); } else if (!douyin.sikpAp() && !douyin.sikpLike() && (!param.tggz || !douyin.sikpFollow()) && (!param.tgsy || !douyin.sikpCommerce())) { if (this.hasKey()) { watchTime = random(param.gksj1, param.gksj2); douyin.watchVideo(startTime, watchTime); if (utility.checkProbability(param.dz, "点赞")) { douyin.execLike(); dzCount++; sleep(1000); } else { utility.toast("不点赞"); } if (utility.checkProbability(param.gz, "关注")) { douyin.execFollow(); gzCount++; sleep(1000); } else { utility.toast("不关注"); } if ((startTime = utility.checkProbability(param.pl, "评论")) && douyin.canComment()) { douyin.sendComment(param.plhs, startTime, false, param.pltp); plCount++; } else { utility.toast("不评论"); } if (utility.checkProbability(param.zyyl, "访问主页")) { douyin.previewHome(); zyylCount++; sleep(1000); } else { utility.toast("不访问用户首页"); } if (!douyin.IsVideo()) { douyin.execClose(); douyin.execBack(); } runCount++; } else { utility.toast("未找到关键词,跳过"); sleep(1000); } engine.slide(); } } } } }; try { czyh.run(); } catch (error) { utility.error(conf.packageName, error); } finally { engine.exit(); }