czyh.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. const douyin = require("./common/douyin");
  2. const conf = require("./common/conf");
  3. const engine = require("./common/engine");
  4. const utility = require("./common/utility");
  5. var param = {
  6. yxgs: 30,
  7. gksj1: 6,
  8. gksj2: 12,
  9. tggz: true,
  10. tgsy: true,
  11. dz: 80,
  12. gz: 10,
  13. pl: 50,
  14. zyyl: 60,
  15. gjc: conf.czyhGjzs,
  16. plhs: conf.commonts,
  17. pltp: true
  18. };
  19. var czyh = {
  20. init() {
  21. 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));
  22. },
  23. hasKey() {
  24. var desc_text = douyin.getVideoDesc();
  25. if (desc_text !== "") {
  26. for (let i = 0; i < param.gjc.length; i++) {
  27. if (desc_text && param.gjc[i] && desc_text.indexOf(param.gjc[i]) != "-1") {
  28. utility.toast("包含关键词:" + param.gjc[i]);
  29. sleep(500);
  30. return true;
  31. }
  32. }
  33. }
  34. return false;
  35. },
  36. run() {
  37. if (czyh.init()) {
  38. let runCount = dzCount = gzCount = plCount = zyylCount = 0;
  39. while (true) {
  40. var startTime = engine.getUnix();
  41. engine.sleepMs(1000, 2000);
  42. if (runCount >= param.yxgs) {
  43. device.cancelKeepingAwake();
  44. alert("恭喜任务完成!", "本次任务共完成\n点赞" + dzCount + "次\n关注" + gzCount + "次\n评论" + plCount + "次\n访问主页" + zyylCount + "次");
  45. return;
  46. }
  47. utility.toast("已观看 " + runCount + " 个有效视频,任务总数" + param.yxgs);
  48. if (douyin.skipVideo()) {
  49. douyin.execClose();
  50. } else if (!douyin.sikpAp() && !douyin.sikpLike() && (!param.tggz || !douyin.sikpFollow()) && (!param.tgsy || !douyin.sikpCommerce())) {
  51. if (this.hasKey()) {
  52. watchTime = random(param.gksj1, param.gksj2);
  53. douyin.watchVideo(startTime, watchTime);
  54. if (utility.checkProbability(param.dz, "点赞")) {
  55. douyin.execLike();
  56. dzCount++;
  57. sleep(1000);
  58. } else {
  59. utility.toast("不点赞");
  60. }
  61. if (utility.checkProbability(param.gz, "关注")) {
  62. douyin.execFollow();
  63. gzCount++;
  64. sleep(1000);
  65. } else {
  66. utility.toast("不关注");
  67. }
  68. if ((startTime = utility.checkProbability(param.pl, "评论")) && douyin.canComment()) {
  69. douyin.sendComment(param.plhs, startTime, false, param.pltp);
  70. plCount++;
  71. } else {
  72. utility.toast("不评论");
  73. }
  74. if (utility.checkProbability(param.zyyl, "访问主页")) {
  75. douyin.previewHome();
  76. zyylCount++;
  77. sleep(1000);
  78. } else {
  79. utility.toast("不访问用户首页");
  80. }
  81. if (!douyin.IsVideo()) {
  82. douyin.execClose();
  83. douyin.execBack();
  84. }
  85. runCount++;
  86. } else {
  87. utility.toast("未找到关键词,跳过");
  88. sleep(1000);
  89. }
  90. engine.slide();
  91. }
  92. }
  93. }
  94. }
  95. };
  96. try {
  97. czyh.run();
  98. } catch (error) {
  99. utility.error(conf.packageName, error);
  100. } finally {
  101. engine.exit();
  102. }