diff --git a/agree.html b/agree.html new file mode 100644 index 0000000..837832a --- /dev/null +++ b/agree.html @@ -0,0 +1,27 @@ +欢迎使用DeekeScript App模拟点击软件(以下简称“本软件”)。在使用本软件前,请您仔细阅读以下用户使用协议条款。使用本软件即表示您同意遵守本协议的所有条款。如果您不同意这些条款,请勿使用本软件。 + +
本软件旨在减少人工操作成本,提升企业运营效率;围绕第三方软件的“点赞”、“评论”、“私信”、“关注”、“赞评论”、“赞头像”、“收藏”、“无限卡片”等功能进行设计, + 绝大多数功能进入设置界面就能很好地了解对应工作的目的和操作
+ +下面主要就软件的功能特点和操作进行简单的参数
+ +由于软件主要模拟人工操作,在绝大多数场景下,相关设置应该满足人类操作规律和速度!长时间运行,就不用高频率“点赞”、“评论”等操作;短时间运行,可以适当提升操作频率; + 无论是“评论”还是“私信”,尽量不要发送硬广(硬广就是直截了当地告诉别人,我有XXX产品和服务,快来找我买!!!或者直接了当地询问别人要不要XXX产品和服务); + 操作频率可以由小到大,比如刚刚开始从点赞率10%到后面调整到35%甚至更高;新号不要一上来就操作“点赞”、“评论”等,注意养号,前期用软件多刷视频,但是不要操作! +
+ +* 注意,如果功能需要输入UID或者USER_ID,部分机型需要打开“后台弹窗”权限;点击软件主页的左上角“三条杠”图标,开启即可
+ +* 注意,任务未关闭之前,不要人工介入手机操作,否则可能会产生不良后果
+ +虽然我们的软件已经历经了多年沉淀、功能优化和底层重构,并且我们让软件能在95%以上的主流Android手机上正常运行,但是仍有一些操作问题导致的系统异常、或者部分机型无障碍存在bug,导致软件异常
+如果你发现了异常,请第一时间给我们反馈,我们将会在24小时内修复
+操作频率是软件操作的很重要的一个概念,比如点赞频率为50%,则大概每100个视频会操作50次点赞;当然,因为概率具备随机性,操作的次数越多概率越接近;次数少的时候可能不准确!
+ +类似“推荐营销”,区别是在“同城”区域运行;适合同城相关业务
+ +功能完全参考DY功能即可
diff --git a/tasks/task_dy_cancel_fans.js b/tasks/task_dy_cancel_fans.js index c54fd4a..a339d38 100644 --- a/tasks/task_dy_cancel_fans.js +++ b/tasks/task_dy_cancel_fans.js @@ -1,9 +1,10 @@ -import {Common as tCommon} from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -// import { Search as DySearch } from 'app/dy/Search.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +// let DySearch = require('app/dy/Search.js'); const DyUser = require('app/dy/User.js'); -import { Video as DyVideo } from 'app/dy/Video.js'; -// import { Comment as DyComment } from 'app/dy/Comment.js'; +let DyVideo = require('app/dy/Video.js'); +let machine = require('common/machine.js'); +// let DyComment = require('app/dy/Comment.js'); // let dy = require('app/iDy'); // let config = require('config/config'); @@ -23,7 +24,7 @@ let task = { testTask() { //首先进入点赞页面 DyIndex.intoMyPage(); - DyUser.cancelFocusList(); + DyUser.cancelFocusList(machine); }, } diff --git a/tasks/task_dy_cancel_focus.js b/tasks/task_dy_cancel_focus.js index 29318b2..e9e8f16 100644 --- a/tasks/task_dy_cancel_focus.js +++ b/tasks/task_dy_cancel_focus.js @@ -1,6 +1,7 @@ -import { Common as tCommon } from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { User as DyUser } from 'app/dy/User.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +let DyUser = require('app/dy/User.js'); +let machine = require('common/machine.js'); let task = { run() { @@ -17,18 +18,17 @@ let task = { testTask() { //首先进入点赞页面 DyIndex.intoMyPage(); - return DyUser.cancelFocusList(); + return DyUser.cancelFocusList(machine); }, } - tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); while (true) { task.log(); try { - //开启线程 自动关闭弹窗 - Engines.executeScript("unit/dialogClose.js"); if (task.run()) { tCommon.sleep(1000); FloatDialogs.show('提示', '取消关注已完成'); @@ -36,7 +36,8 @@ while (true) { } tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } \ No newline at end of file diff --git a/tasks/task_dy_cancel_zan.js b/tasks/task_dy_cancel_zan.js index 907fa31..525ea95 100644 --- a/tasks/task_dy_cancel_zan.js +++ b/tasks/task_dy_cancel_zan.js @@ -1,9 +1,9 @@ -import {Common as tCommon} from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -// import { Search as DySearch } from 'app/dy/Search.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +// let DySearch = require('app/dy/Search.js'); // const DyUser = require('app/dy/User.js'); -import { Video as DyVideo } from 'app/dy/Video.js'; -// import { Comment as DyComment } from 'app/dy/Comment.js'; +let DyVideo = require('app/dy/Video.js'); +// let DyComment = require('app/dy/Comment.js'); // let dy = require('app/iDy'); // let config = require('config/config'); @@ -72,61 +72,28 @@ let task = { if (isZan) { DyVideo.clickZan(); } - tCommon.sleep(500); + tCommon.sleep(1500); DyVideo.next(); } }, } -let i = false; -Dialogs.confirm('提示', '确定开始执行嘛?', (_true) => { - i = _true; -}); - -if (!i) { - tCommon.showToast('你取消了执行'); - //console.hide();(); - System.exit(); -} - tCommon.openApp(); +Engines.executeScript("unit/dialogClose.js"); -let thr = undefined; while (true) { task.log(); try { //开启线程 自动关闭弹窗 - thr = tCommon.closeAlert(); if (task.run()) { - if (thr) { - thr.interrupt(); - Threads.shutDownAll(); - tCommon.sleep(1000); - } + tCommon.sleep(1000); FloatDialogs.show('提示', '一键取赞完成'); break; } tCommon.sleep(3000); } catch (e) { Log.log(e); - try { - if (thr) { - thr.interrupt(); - Threads.shutDownAll(); - } - tCommon.showToast("遇到错误,即将自动重启"); - tCommon.closeApp(); - tCommon.sleep(3000); - tCommon.showToast('开启抖音'); - tCommon.openApp(); - } catch (e) { - Log.log('启停bug', e); - } + tCommon.closeAlert(1); + tCommon.backHome(); } } - -try { - Engines.closeAll(true); -} catch (e) { - Log.log('停止脚本'); -} diff --git a/tasks/task_dy_comment_back.js b/tasks/task_dy_comment_back.js index 4ac8b4f..a52d9b8 100644 --- a/tasks/task_dy_comment_back.js +++ b/tasks/task_dy_comment_back.js @@ -1,10 +1,10 @@ -import {Common as tCommon} from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -// import { Search as DySearch } from 'app/dy/Search.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +// let DySearch = require('app/dy/Search.js'); const DyUser = require('app/dy/User.js'); -import { Video as DyVideo } from 'app/dy/Video.js'; +let DyVideo = require('app/dy/Video.js'); const DyMessage = require('app/dy/Message.js'); -// import { Comment as DyComment } from 'app/dy/Comment.js'; +// let DyComment = require('app/dy/Comment.js'); // let dy = require('app/iDy'); // let config = require('config/config'); diff --git a/tasks/task_dy_consum_user.js b/tasks/task_dy_consum_user.js index bd0a0a9..1f4bcc1 100644 --- a/tasks/task_dy_consum_user.js +++ b/tasks/task_dy_consum_user.js @@ -1,12 +1,14 @@ -import { Common as tCommon } from 'app/dy/Common.js'; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; -import { User as DyUser } from 'app/dy/User.js'; -import { Video as DyVideo } from 'app/dy/Video.js'; -import { storage } from 'common/storage.js'; -import { machine } from 'common/machine.js'; -import { Comment as DyComment } from 'app/dy/Comment.js'; -import { baiduWenxin } from 'service/baiduWenxin.js'; +let tCommon = require('app/dy/Common.js'); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); +let DyUser = require('app/dy/User.js'); +let DyVideo = require('app/dy/Video.js'); +let storage = require('common/storage.js'); +let machine = require('common/machine.js'); +let DyComment = require('app/dy/Comment.js'); +let baiduWenxin = require('service/baiduWenxin.js'); +let statistics = require('common/statistics'); +let V = require("version/V.js"); // let dy = require('app/iDy'); // let config = require('config/config'); @@ -34,7 +36,7 @@ let task = { //type 0 评论,1私信 getMsg(type, title, age, gender) { - if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; } return machine.getMsg(type) || false;//永远不会结束 @@ -72,7 +74,7 @@ let task = { DySearch.homeIntoSearchUser(account); tCommon.sleep(2000 + 2000 * Math.random()); //进入喜欢视频列表 - let likeTag = tCommon.aId('text1').textContains('喜欢').filter((v) => { + let likeTag = tCommon.aId(V.C.text1a).textContains(V.Index.intoMyLikeVideo[1]).filter((v) => { return v && v.bounds() && v.bounds().top > 0 && v.bounds().left > 0 && v.bounds().height() > 0 && v.bounds().width() > 0; }).findOnce(); @@ -86,7 +88,7 @@ let task = { tCommon.click(likeTag); tCommon.sleep(3000 + Math.random() * 3000); - let contain = tCommon.id('m_a').filter((v) => { + let contain = tCommon.id(V.Index.intoMyLikeVideo[2]).filter((v) => { return v && v.bounds() && v.bounds().top > 0 && v.bounds().left >= 0 && v.bounds().height() > 0 && v.bounds().width() > 0; }).findOnce(); @@ -158,6 +160,8 @@ let task = { tCommon.sleep(1000 * (Math.random() * 10 + 5)); System.toast('开始操作视频'); DyVideo.clickZan(); + statistics.viewVideo(); + statistics.viewTargetVideo(); videoCount--; if (videoCount <= 0) { return true; @@ -177,7 +181,7 @@ let task = { } catch (e) { Log.log(e) } - tCommon.back();///返回到视频 + //tCommon.back();///返回到视频 这个页面的视频评论之后,自动关闭了,不用返回 tCommon.sleep(1500); } @@ -186,6 +190,7 @@ let task = { DyVideo.intoUserPage(); tCommon.sleep(1000 * (Math.random() * 2)); tCommon.back();//防止头像找不到异常 + Log.log("用户页面返回"); } catch (e) { Log.log('进入用户主页出错'); } @@ -203,7 +208,7 @@ let task = { tCommon.sleep(1000); } } catch (e) { - print(e, errorCount); + //print(e, errorCount); errorCount++; if (errorCount > 3) { return true; @@ -232,12 +237,12 @@ if (isNaN(videoCount) || videoCount <= 0) { } tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); while (true) { task.log(); try { - //开启线程 自动关闭弹窗 - Engines.executeScript("unit/dialogClose.js"); let res = task.run(account); if (res) { tCommon.sleep(3000); @@ -256,7 +261,8 @@ while (true) { tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } diff --git a/tasks/task_dy_fans_back_view.js b/tasks/task_dy_fans_back_view.js index 9467e53..1a82d73 100644 --- a/tasks/task_dy_fans_back_view.js +++ b/tasks/task_dy_fans_back_view.js @@ -1,9 +1,9 @@ -import { Common as tCommon } from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -// import { Search as DySearch } from 'app/dy/Search.js'; -import { User as DyUser } from 'app/dy/User.js'; -//import { Video as DyVideo } from 'app/dy/Video.js'; -// import { Comment as DyComment } from 'app/dy/Comment.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +// let DySearch = require('app/dy/Search.js'); +let DyUser = require('app/dy/User.js'); +//let DyVideo = require('app/dy/Video.js'); +// let DyComment = require('app/dy/Comment.js'); // let dy = require('app/iDy'); // let config = require('config/config'); @@ -41,7 +41,7 @@ while (true) { } tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); tCommon.backHome(); } } diff --git a/tasks/task_dy_fans_group.js b/tasks/task_dy_fans_group.js index adae00b..4fa10cd 100644 --- a/tasks/task_dy_fans_group.js +++ b/tasks/task_dy_fans_group.js @@ -1,12 +1,12 @@ -import { Common as tCommon } from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -//import { Search as DySearch } from 'app/dy/Search.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +//let DySearch = require('app/dy/Search.js'); // const DyUser = require('app/dy/User.js'); -//import { Video as DyVideo } from 'app/dy/Video.js'; -import { storage } from "common/storage"; -import { machine } from "common/machine"; -import { Message as DyMessage } from 'app/dy/Message.js'; - +//let DyVideo = require('app/dy/Video.js'); +let storage = require("common/storage"); +let machine = require("common/machine"); +let DyMessage = require('app/dy/Message.js'); +let baiduWenxin = require('service/baiduWenxin.js'); // let dy = require('app/iDy'); // let config = require('config/config'); @@ -27,7 +27,7 @@ let task = { //type 0 评论,1私信 getMsg(type, lib_id, title, age, gender) { if (storage.getMachineType() === 1) { - if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; } return machine.getMsg(type) || false;//永远不会结束 @@ -63,12 +63,13 @@ if (!index) { } tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); while (true) { task.log(); try { - //开启线程 自动关闭弹窗 - Engines.executeScript("unit/dialogClose.js"); + let res = task.run(keyword, index); if (res || res === false) { tCommon.sleep(1000); @@ -76,13 +77,10 @@ while (true) { break; } - if (res === false) { - break; - } - tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } \ No newline at end of file diff --git a/tasks/task_dy_fans_inc.js b/tasks/task_dy_fans_inc.js index fe330db..6860678 100644 --- a/tasks/task_dy_fans_inc.js +++ b/tasks/task_dy_fans_inc.js @@ -1,11 +1,11 @@ -import {Common as tCommon} from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); const DyUser = require('app/dy/User.js'); -import { Video as DyVideo } from 'app/dy/Video.js'; -import { Comment as DyComment } from 'app/dy/Comment.js'; -import {storage} from "common/storage"; -import {baiduWenxin} from "service/baiduWenxin"; -import {machine} from "common/machine"; +let DyVideo = require('app/dy/Video.js'); +let DyComment = require('app/dy/Comment.js'); +let storage = require("common/storage"); +let baiduWenxin = require("service/baiduWenxin"); +let machine = require("common/machine"); let task = { msg: [], diff --git a/tasks/task_dy_fans_inc_main.js b/tasks/task_dy_fans_inc_main.js index d807d5d..a5af64f 100644 --- a/tasks/task_dy_fans_inc_main.js +++ b/tasks/task_dy_fans_inc_main.js @@ -1,16 +1,17 @@ -import { Common as tCommon } from 'app/dy/Common.js'; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; -import { User as DyUser } from 'app/dy/User.js'; -import { Video as DyVideo } from 'app/dy/Video.js'; -import { storage } from 'common/storage.js'; -import { machine } from 'common/machine.js'; -import { Comment as DyComment } from 'app/dy/Comment.js'; -import { baiduWenxin } from 'service/baiduWenxin.js'; +let tCommon = require('app/dy/Common.js'); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); +let DyUser = require('app/dy/User.js'); +let DyVideo = require('app/dy/Video.js'); +let storage = require('common/storage.js'); +let machine = require('common/machine.js'); +let DyComment = require('app/dy/Comment.js'); +let baiduWenxin = require('service/baiduWenxin.js'); let task = { contents: [], me: {}, + remark: false,//是否是#开头 run(settingData) { return this.testTask(settingData); }, @@ -24,7 +25,7 @@ let task = { //type 0 评论,1私信 getMsg(type, title, age, gender) { - if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; } @@ -47,15 +48,20 @@ let task = { })); DyIndex.intoHome(); - if (settingData.account.indexOf('+') === 0) { - DyIndex.intoMyPage(); + if (this.remark) { + App.gotoIntent('snssdk1128://user/profile/' + settingData.account); + tCommon.sleep(5000 + 2000 * Math.random()); } else { - DyIndex.intoSearchPage(); - } - - let res = DySearch.homeIntoSearchUser(settingData.account); - if (res) { - return res; + if (settingData.account.indexOf('+') === 0) { + DyIndex.intoMyPage(); + } else { + DyIndex.intoSearchPage(); + } + + let res = DySearch.homeIntoSearchUser(settingData.account); + if (res) { + return res; + } } return DyUser.fansIncList(this.getMsg, DyVideo, DyComment, machine, settingData, this.contents, this.me.nickname); @@ -69,7 +75,7 @@ Log.log('settingData', settingData); let count = settingData.task_dy_fans_inc_head_zan_rate + settingData.task_dy_fans_inc_video_zan_rate + settingData.task_dy_fans_inc_comment_rate + settingData.task_dy_fans_inc_collection_rate; if (count == 0) { - count = 1; + count = 100; } settingData.task_dy_fans_inc_head_zan_rate = (settingData.task_dy_fans_inc_head_zan_rate / count) * 100; @@ -80,11 +86,15 @@ settingData.task_dy_fans_inc_collection_rate = (settingData.task_dy_fans_inc_col console.log(machine.getMsg(0)); Log.log('settingData', settingData); -let tmp = settingData.task_dy_fans_inc_account.split(','); +task.remark = tCommon.getRemark(settingData.task_dy_fans_inc_accounts); +if (task.remark) { + settingData.task_dy_fans_inc_accounts = settingData.task_dy_fans_inc_accounts.substring(1); +} +let tmp = settingData.task_dy_fans_inc_accounts.split("\n"); tCommon.openApp(); Engines.executeScript("unit/dialogClose.js"); //开启线程 自动关闭弹窗 -Log.log('日志开始'); +Log.log('日志开始', tmp); task.log(); while (true) { @@ -100,7 +110,8 @@ while (true) { tCommon.sleep(3000); } } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } diff --git a/tasks/task_dy_friend_change.js b/tasks/task_dy_friend_change.js new file mode 100644 index 0000000..32a8e4d --- /dev/null +++ b/tasks/task_dy_friend_change.js @@ -0,0 +1,251 @@ +let tCommon = require('app/dy/Common.js'); +let DyUser = require('app/dy/User.js'); +let DyVideo = require('app/dy/Video.js'); +let storage = require('common/storage.js'); +let machine = require('common/machine.js'); +let baiduWenxin = require('service/baiduWenxin.js'); +let statistics = require('common/statistics'); +let V = require("version/V.js"); + +// let dy = require('app/iDy'); +// let config = require('config/config'); + +/** + * 赞回访 + */ + +let videoCount = 500; + +let task = { + contents: [], + run() { + return this.testTask(); + }, + + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-dy-friend-change-" + file + ".txt"; + Log.setFile(allFile); + }, + + //type 0 评论,1私信 + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + return machine.getMsg(type) || false;//永远不会结束 + }, + + getConfig() { + return { + runTimes: machine.get('task_dy_friend_change_run_count', 'int'),//运行次数 + intevalSecond: machine.get('task_dy_friend_change_interval', 'int'),//操作间隔 + homeWait: machine.get('task_dy_friend_change_home_wait', 'int'),//主页停留时间 + workWait: machine.get('task_dy_friend_change_work_wait', 'int'),//作品停留时间 + fansMin: machine.get('task_dy_friend_change_min_fans', 'int'), //最小粉丝数 + fansMax: machine.get('task_dy_friend_change_max_fans', 'int'),//最大粉丝数 + workMin: machine.get('task_dy_friend_change_min_work', 'int'),//最小作品数 + op: machine.getArray('task_dy_friend_change_op'), // "0","1","2" 分别是 关注、私信、点赞 + privateType: machine.getArray('task_dy_friend_change_private_type'), + } + }, + + testTask() { + //查看是不是进入了指定页面,是的话才开始运行 + let config = this.getConfig(); + Log.log("配置信息:", config); + tCommon.aId(V.C.text1a).textContains(V.Search.userList[2]).isVisibleToUser(true).waitFindOne();//粉丝或者关注界面 + Log.log("bug来了"); + let arr = [];//存储最新的20个 + let count = 0; + let repeatCount = 0; + let errorCount = 0; + let errorContainsCount = 0; + while (true) { + try { + tCommon.sleep(3000); + System.toast('开始执行,剩余数量:' + (config.runTimes - count)); + let contains = tCommon.id(V.C.rootLayout).isVisibleToUser(true).find(); + Log.log("找到的内容数量:", contains.length); + if (contains.length == 0) { + if (errorContainsCount++ >= 3) { + errorCount = 0; + throw new Error("3次找不到container内容"); + } + continue; + } + errorContainsCount = 0; + + for (let i in contains) { + tCommon.sleep(config.intevalSecond * 1000); + let nicknameTag = contains[i].children().findOne(tCommon.id(V.C.fansNickTag).isVisibleToUser(true)); + Log.log(nicknameTag); + if (!nicknameTag) { + System.generateWindowElements(); + Log.log('找不到昵称标签', contains[i]); + if (errorCount++ > 3) { + throw new Error("3次找不到昵称"); + } + continue; + } + errorCount = 0; + + tCommon.click(nicknameTag); + tCommon.sleep(2000); + statistics.viewUser(); + let nickname = nicknameTag.text(); + + if (count >= config.runTimes) { + System.toast('运行次数达到了'); + return true; + } + + if (DyUser.isPrivate()) { + tCommon.back(); + System.toast('私密账号'); + continue; + } + + let account = DyUser.getDouyin(); + if (machine.get("task_dy_friend_change_" + account, 'bool')) { + tCommon.back(); + System.toast('已经操作过了'); + continue; + } + + Log.log("抖音号:", account); + machine.set("task_dy_friend_change_" + account, true); + if (arr.indexOf(account) != -1) { + repeatCount++; + if (repeatCount >= 2) { + System.toast('运行结束'); + return true; + } + tCommon.back(); + continue; + } else { + repeatCount = 0; + } + + arr.push(account); + + let fansCount = DyUser.getFansCount(); + Log.log("粉丝数量:", fansCount); + if (fansCount < config.fansMin || fansCount > config.fansMax) { + tCommon.back(); + System.toast('粉丝数不符合要求'); + continue; + } + + let workCount = DyUser.getWorksCount(); + Log.log("作品数量:", workCount); + if (workCount < config.workMin) { + tCommon.back(); + System.toast('作品数不符合要求'); + continue; + } + + let isOp = false; + if (config.op.includes("2") && DyVideo.intoUserVideo()) { + Log.log("执行进入视频"); + tCommon.sleep(config.workWait * 1000); + if (DyVideo.isZan()) { + System.toast('已经点赞了'); + } else { + DyVideo.clickZan(); + isOp = true; + tCommon.sleep(2000 + 1000 * Math.random()); + } + tCommon.back(); + } + + //查看是否关注 + if (config.op.includes("0")) { + Log.log("执行关注"); + if (DyUser.isFocus()) { + System.toast('已关注,不操作'); + } else { + DyUser.focus(); + isOp = true; + tCommon.sleep(1000 + Math.random() * 1000); + } + } + + if (config.op.includes("1")) { + Log.log("执行私信"); + //如果 + if (config.privateType.includes("0") && config.privateType.includes("1")) { + DyUser.privateMsg(this.getMsg(1, nickname).msg); + isOp = true; + } else if (config.privateType.includes("0") && !DyUser.isCompany()) { + DyUser.privateMsg(this.getMsg(1, nickname).msg); + isOp = true; + } else if (config.privateType.includes("1") && DyUser.isCompany()) { + DyUser.privateMsg(this.getMsg(1, nickname).msg); + isOp = true; + } + } + + if (isOp) { + count++; + Log.log('操作次数:' + count + "/" + config.runTimes); + } + + tCommon.sleep(config.homeWait * 1000);//主页停留 + tCommon.swipe(0, 0.5); + tCommon.sleep(500); + if (tCommon.id(V.C.userListHead).isVisibleToUser(true).findOne()) { + Log.log("在列表页面了"); + } else { + tCommon.back(); + } + } + + tCommon.sleep(1000); + Log.log("执行滑动"); + //判断是粉丝还是关注 + task.swipe(); + System.cleanUp(); + } catch (e) { + if (!tCommon.id(V.C.userListHead).isVisibleToUser(true).findOne()) { + Log.log("找不到标签,返回了"); + tCommon.back(); + tCommon.sleep(2000); + } else { + Log.log('滑动一下,解决问题'); + task.swipe(); + } + Log.log(e); + } + } + }, + + swipe() { + let fansTag = tCommon.aId(V.C.text1a).textContains(V.Search.userList[2]).findOne(); + if (fansTag && fansTag.parent().isSelected()) { + tCommon.swipeFansListOp(); + } else { + tCommon.swipeFocusListOp(); + } + } +} + +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); + +while (true) { + task.log(); + try { + let res = task.run(); + if (res) { + tCommon.sleep(3000); + FloatDialogs.show('提示', '已完成'); + break; + } + + tCommon.sleep(3000); + } catch (e) { + Log.log(e); + } +} diff --git a/tasks/task_dy_grab.js b/tasks/task_dy_grab.js index 8a7145f..6a3822e 100644 --- a/tasks/task_dy_grab.js +++ b/tasks/task_dy_grab.js @@ -1,11 +1,11 @@ -import {Common as tCommon} from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); const DyUser = require('app/dy/User.js'); -import {machine} from "common/machine"; +let machine = require("common/machine"); let mHttp = require('unit/mHttp'); let Wx = require('app/wx/Wx.js'); -import {storage} from "common/storage"; +let storage = require("common/storage"); let task = { setting: {}, @@ -239,11 +239,11 @@ let task = { let rp = 0; while (true) { - let tags = new UiSelector().className('com.lynx.tasm.behavior.ui.LynxFlattenUI').textContains('粉丝').filter((v) => { + let tags = UiSelector().className('com.lynx.tasm.behavior.ui.LynxFlattenUI').textContains('粉丝').filter((v) => { return v && !!v.bounds() && v.bounds().left > 0 && v.bounds().width() > 0 && v.bounds().top > 0 && v.bounds().top + v.bounds().height() < Device.height(); }).find(); - arr.push(contains ? (contains[0]?._addr) : null); + arr.push(contains ? (contains[0] && contains[0]._addr) : null); if (contains.length > 2) { contains.shift(); } @@ -274,7 +274,7 @@ let task = { tCommon.click(tags[i]); tCommon.sleep(3000); - let contentTag = new UiSelector().className('android.widget.TextView').clickable(true).filter((v) => { + let contentTag = UiSelector().className('android.widget.TextView').clickable(true).filter((v) => { return v && v.bounds() && v.bounds().top > 0 && v.bounds().left > 0 && v.bounds().width() > 0; }).textContains('更多').findOnce(); @@ -293,7 +293,7 @@ let task = { System.sleep(30); } tCommon.sleep(2000); - contentTag = new UiSelector().className('android.widget.TextView').filter((v) => { + contentTag = UiSelector().className('android.widget.TextView').filter((v) => { return v && v.bounds() && v.bounds().left == contentTag.bounds().left && v.bounds().top == contentTag.bounds().top && v.bounds().width() == contentTag.bounds().width(); }).clickable(true).findOnce(); } else { @@ -301,7 +301,7 @@ let task = { return v && v.bounds() && v.bounds().top > 0 && v.bounds().left >= 0 && v.bounds().width() > 0; }).findOnce(); - contentTag = new UiSelector().className('android.widget.TextView').filter((v) => { + contentTag = UiSelector().className('android.widget.TextView').filter((v) => { return v && v.bounds() && v.bounds().left >= 0 && v.bounds().top == tag.bounds().top + tag.bounds().height() && v.bounds().width() > 0; }).clickable(true).findOnce(); } diff --git a/tasks/task_dy_grab_phone.js b/tasks/task_dy_grab_phone.js index 203d013..23a9c8d 100644 --- a/tasks/task_dy_grab_phone.js +++ b/tasks/task_dy_grab_phone.js @@ -1,10 +1,10 @@ -import { Common as tCommon } from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); const DyUser = require('app/dy/User.js'); -import { machine } from "common/machine"; -// import { Video as DyVideo } from 'app/dy/Video.js'; -// import { Comment as DyComment } from 'app/dy/Comment.js'; +let machine = require("common/machine"); +// let DyVideo = require('app/dy/Video.js'); +// let DyComment = require('app/dy/Comment.js'); // let dy = require('app/iDy'); // let config = require('config/config'); @@ -37,11 +37,11 @@ let task = { let grabLvError = 0; while (true) { - let tags = new UiSelector().className('com.lynx.tasm.behavior.ui.LynxFlattenUI').textContains('粉丝').filter((v) => { + let tags = UiSelector().className('com.lynx.tasm.behavior.ui.LynxFlattenUI').textContains('粉丝').filter((v) => { return v && !!v.bounds() && v.bounds().left > 0 && v.bounds().width() > 0 && v.bounds().top > 0 && v.bounds().top + v.bounds().height() < Device.height(); }).find(); - arr.push(contains ? (contains[0]?._addr) : null); + arr.push(contains ? (contains[0] && contains[0]._addr) : null); if (contains.length > 2) { contains.shift(); } @@ -72,7 +72,7 @@ let task = { tCommon.click(tags[i]); tCommon.sleep(3000); - let contentTag = new UiSelector().className('android.widget.TextView').filter((v) => { + let contentTag = UiSelector().className('android.widget.TextView').filter((v) => { return v && v.bounds() && v.bounds().top > 0 && v.bounds().left > 0 && v.bounds().width() > 0; }).textContains('更多').findOnce(); @@ -91,7 +91,7 @@ let task = { System.sleep(30); } tCommon.sleep(2000); - contentTag = new UiSelector().className('android.widget.TextView').filter((v) => { + contentTag = UiSelector().className('android.widget.TextView').filter((v) => { return v && v.bounds() && v.bounds().left == contentTag.bounds().left && v.bounds().top == contentTag.bounds().top && v.bounds().width() == contentTag.bounds().width(); }).clickable(true).findOnce(); } diff --git a/tasks/task_dy_live_barrage.js b/tasks/task_dy_live_barrage.js index 20481fc..fe8c559 100644 --- a/tasks/task_dy_live_barrage.js +++ b/tasks/task_dy_live_barrage.js @@ -1,28 +1,37 @@ -import {Common as tCommon} from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; -// const DyUser = require('app/dy/User.js'); -const DyLive = require('app/dy/Live.js'); -// import { Comment as DyComment } from 'app/dy/Comment.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); +let DyUser = require('app/dy/User.js'); +let DyLive = require('app/dy/Live.js'); +// let DyComment = require('app/dy/Comment.js'); // let dy = require('app/iDy'); // let config = require('config/config'); -import {storage} from "common/storage"; +let storage = require("common/storage"); +let machine = require("common/machine"); let task = { rp: 0, msg: [], - run(account, second, msg) { - this.msg = tCommon.splitKeyword(msg); - Log.log('msg', this.msg); + run(account, second) { return this.testTask(account, second); }, - getMsg() { - return this.msg[Math.round(Math.random() * (this.msg.length - 1))]; + getMsg(type, title, age, gender) { + let comments = storage.get('task_dy_live_barrage_comments'); + if (comments) { + let tmp = comments.split("\n"); + let rd = Math.floor(Math.random() * tmp.length); + return { msg: tmp[rd] }; + } + + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + return machine.getMsg(type) || false;//永远不会结束 }, - log(){ + log() { let d = new Date(); let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); let allFile = "log/log-live-barrage-" + file + ".txt"; @@ -31,18 +40,35 @@ let task = { testTask(account, second) { //首先进入点赞页面 - DyIndex.intoSearchPage(); - this.rp++; - if (this.rp >= 3) { - return true; + if (!tCommon.getRemark(account)) { + DyIndex.intoSearchPage(); + this.rp++; + if (this.rp >= 3) { + return true; + } + + DySearch.intoSearchList(account, 1); + DySearch.intoLiveRoom(account); + } else { + account = account.substring(1); + App.gotoIntent('snssdk1128://user/profile/' + account); + tCommon.sleep(5000 + 2000 * Math.random()); + if (!DyUser.intoLive()) { + return true; + } + tCommon.sleep(5000 + 2000 * Math.random()); } - DySearch.intoSearchList(account, 1); - DySearch.intoLiveRoom(account); this.rp = 0; while (true) { - Log.log('开始评论了'); - if (false === DyLive.loopComment(this.getMsg())) { + Log.log('开始点赞了'); + if (storage.get('task_dy_live_barrage_zan_rate', 'int') > Math.random() * 100 && false === DyLive.loopClick(20 + Math.round(20 * Math.random()))) { + throw new Error('可能异常'); + } + + let msg = this.getMsg(0); + Log.log('开始评论了', msg); + if (msg && msg.msg && storage.get('task_dy_live_barrage_comment_rate', 'int') > Math.random() * 100 && false === DyLive.loopComment(msg.msg, storage.get('task_dy_live_barrage_comment_emoji_switch', 'bool'))) { throw new Error('可能异常'); } @@ -53,79 +79,29 @@ let task = { }, } -let i = false; -Dialogs.confirm('提示', '确定开始执行嘛?', (_true) => { - i = _true; -}); - -if (!i) { - tCommon.showToast('你取消了执行'); - //console.hide();(); - System.exit(); -} - -let account = Dialogs.input('请输入直播账号:', storage.get('task_dy_live_barrage_account') || ''); +let account = storage.get('task_dy_live_barrage_account', 'string'); if (!account) { - tCommon.showToast('你取消了执行'); - //console.hide();(); - System.exit(); -} -storage.set('task_dy_live_barrage_account', account); - -let second = Dialogs.input('请输入弹幕最大间隔(秒):', storage.get('task_dy_live_barrage_second') || ''); -if (!second || isNaN(second)) { - tCommon.showToast('你取消了执行'); - //console.hide();(); - System.exit(); -} -storage.set('task_dy_live_barrage_second', second); - -let msg = Dialogs.input('请输入评论内容(多个使用逗号隔开):', storage.get('task_dy_live_barrage_msg') || ''); -if (!msg) { - tCommon.showToast('你取消了执行'); - //console.hide();(); + tCommon.showToast('直播账号不能为空'); + //console.hide();(); System.exit(); } -storage.set('task_dy_live_barrage_msg', msg); tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); -let thr = undefined; while (true) { task.log(); try { //开启线程 自动关闭弹窗 - thr = tCommon.closeAlert(); - if (task.run(account, second, msg)) { - if (thr) { - thr.interrupt(); - Threads.shutDownAll(); - tCommon.sleep(1000); - } + if (task.run(account, storage.get('task_dy_live_barrage_second', 'int'))) { FloatDialogs.show('提示', '直播结束了'); break; } tCommon.sleep(3000); } catch (e) { Log.log(e); - try { - if (thr) { - thr.interrupt(); - Threads.shutDownAll(); - } - tCommon.showToast("遇到错误,即将自动重启"); - tCommon.closeApp(); - tCommon.sleep(3000); - tCommon.showToast('开启抖音'); - tCommon.openApp(); - } catch (e) { - Log.log('启停bug', e); - } + tCommon.closeAlert(1); + tCommon.backHome(); } } - -try { - Engines.closeAll(true); -} catch (e) { - Log.log('停止脚本'); -} diff --git a/tasks/task_dy_live_zan.js b/tasks/task_dy_live_zan.js index fb3a2b2..38e37c4 100644 --- a/tasks/task_dy_live_zan.js +++ b/tasks/task_dy_live_zan.js @@ -1,13 +1,13 @@ -import {Common as tCommon} from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); // const DyUser = require('app/dy/User.js'); const DyLive = require('app/dy/Live.js'); -// import { Comment as DyComment } from 'app/dy/Comment.js'; +// let DyComment = require('app/dy/Comment.js'); // let dy = require('app/iDy'); // let config = require('config/config'); -import {storage} from "common/storage"; +let storage = require("common/storage"); let task = { rp: 0, diff --git a/tasks/task_dy_qingsong_tuoke.js b/tasks/task_dy_qingsong_tuoke.js new file mode 100644 index 0000000..9df3f7e --- /dev/null +++ b/tasks/task_dy_qingsong_tuoke.js @@ -0,0 +1,244 @@ +let tCommon = require('app/dy/Common.js'); +let DyUser = require('app/dy/User.js'); +let DyVideo = require('app/dy/Video.js'); +let storage = require('common/storage.js'); +let machine = require('common/machine.js'); +let baiduWenxin = require('service/baiduWenxin.js'); +let statistics = require('common/statistics'); +let V = require("version/V.js"); + +// let dy = require('app/iDy'); +// let config = require('config/config'); + +/** + * 赞回访 + */ + +let videoCount = 500; + +let task = { + contents: [], + run() { + return this.testTask(); + }, + + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-dy-qingsong-tuoke-" + file + ".txt"; + Log.setFile(allFile); + }, + + //type 0 评论,1私信 + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + return machine.getMsg(type) || false;//永远不会结束 + }, + + getConfig() { + return { + runTimes: machine.get('task_dy_qingsong_tuoke_run_count', 'int'),//运行次数 + intevalSecond: machine.get('task_dy_qingsong_tuoke_interval', 'int'),//操作间隔 + homeWait: machine.get('task_dy_qingsong_tuoke_home_wait', 'int') || 5,//主页停留时间 + workWait: machine.get('task_dy_qingsong_tuoke_work_wait', 'int') || 5,//作品停留时间 + fansMin: machine.get('task_dy_qingsong_tuoke_min_fans', 'int') || 0, //最小粉丝数 + fansMax: machine.get('task_dy_qingsong_tuoke_max_fans', 'int') || 1000000000,//最大粉丝数 + workMin: machine.get('task_dy_qingsong_tuoke_min_work', 'int') || 1,//最小作品数 + op: ["2"],//machine.getArray('task_dy_qingsong_tuoke_op'), // "0","1","2" 分别是 关注、私信、点赞 + privateType: machine.getArray('task_dy_qingsong_tuoke_private_type') || [], + } + }, + + testTask() { + //查看是不是进入了指定页面,是的话才开始运行 + let config = this.getConfig(); + Log.log("配置信息:", config); + tCommon.aId(V.C.text1a).textContains(V.Search.userList[2]).isVisibleToUser(true).waitFindOne();//粉丝或者关注界面 + Log.log("bug来了"); + let arr = [];//存储最新的20个 + let count = 0; + let repeatCount = 0; + let errorCount = 0; + let errorContainsCount = 0; + + while (true) { + try { + tCommon.sleep(3000); + System.toast('开始执行,剩余数量:' + (config.runTimes - count)); + let contains = tCommon.id(V.C.rootLayout).isVisibleToUser(true).find(); + Log.log("找到的内容数量:", contains.length); + if (contains.length == 0) { + if (errorContainsCount++ >= 3) { + throw new Error("3次找不到container内容"); + } + continue; + } + errorContainsCount = 0; + + for (let i in contains) { + tCommon.sleep(config.intevalSecond * 1000); + let nicknameTag = contains[i].children().findOne(tCommon.id(V.C.fansNickTag).isVisibleToUser(true)); + Log.log(nicknameTag); + if (!nicknameTag) { + System.generateWindowElements(); + Log.log('找不到昵称标签', contains[i]); + if (errorCount++ > 3) { + errorCount = 0; + throw new Error("3次找不到昵称"); + } + continue; + } + errorCount = 0; + + tCommon.click(nicknameTag); + tCommon.sleep(2000); + statistics.viewUser(); + let nickname = nicknameTag.text(); + count++; + Log.log('操作次数:' + count + "/" + config.runTimes); + if (count >= config.runTimes) { + System.toast('运行次数达到了'); + return true; + } + + if (DyUser.isPrivate()) { + tCommon.back(); + System.toast('私密账号'); + continue; + } + + let account = DyUser.getDouyin(); + if (machine.get("task_dy_qingsong_tuoke_" + account, 'bool')) { + tCommon.back(); + System.toast('已经操作过了'); + continue; + } + + Log.log("抖音号:", account); + machine.set("task_dy_qingsong_tuoke_" + account, true); + if (arr.indexOf(account) != -1) { + repeatCount++; + if (repeatCount >= 2) { + System.toast('运行结束'); + return true; + } + tCommon.back(); + continue; + } else { + repeatCount = 0; + } + + arr.push(account); + + let fansCount = DyUser.getFansCount(); + Log.log("粉丝数量:", fansCount); + if (fansCount < config.fansMin || fansCount > config.fansMax) { + tCommon.back(); + System.toast('粉丝数不符合要求'); + continue; + } + + let workCount = DyUser.getWorksCount(); + Log.log("作品数量:", workCount); + if (workCount < config.workMin) { + tCommon.back(); + System.toast('作品数不符合要求'); + continue; + } + + if (config.op.includes("2") && DyVideo.intoUserVideo()) { + Log.log("执行进入视频"); + tCommon.sleep(config.workWait * 1000); + if (DyVideo.isZan()) { + System.toast('已经点赞了'); + } else { + DyVideo.clickZan(); + tCommon.sleep(2000 + 1000 * Math.random()); + } + tCommon.back(); + } + + //查看是否关注 + if (config.op.includes("0")) { + Log.log("执行关注"); + if (DyUser.isFocus()) { + System.toast('已关注,不操作'); + } else { + DyUser.focus(); + tCommon.sleep(1000 + Math.random() * 1000); + } + } + + if (config.op.includes("1")) { + Log.log("执行私信"); + //如果 + if (config.privateType.includes("0") && config.privateType.includes("1")) { + DyUser.privateMsg(this.getMsg(1, nickname).msg); + } else if (config.privateType.includes("0") && !DyUser.isCompany()) { + DyUser.privateMsg(this.getMsg(1, nickname).msg); + } else if (config.privateType.includes("1") && DyUser.isCompany()) { + DyUser.privateMsg(this.getMsg(1, nickname).msg); + } + } + + tCommon.sleep(config.homeWait * 1000);//主页停留 + tCommon.swipe(0, 0.5); + tCommon.sleep(500); + + if (tCommon.id(V.C.userListHead).isVisibleToUser(true).findOne()) { + //不做任何处理,已经在列表页面了 + Log.log("在列表页面了"); + } else { + tCommon.back();//这里的back最好是判断一下,如果不在用户页,则不用返回了;或者判断是不是在列表页,是的话,也不用返回 + } + } + + tCommon.sleep(1000); + Log.log("执行滑动"); + //判断是粉丝还是关注 + task.swipe(); + System.cleanUp(); + } catch (e) { + if (!tCommon.id(V.C.userListHead).isVisibleToUser(true).findOne()) { + Log.log("找不到标签,返回了"); + tCommon.back(); + tCommon.sleep(2000); + } else { + Log.log('滑动一下,解决问题'); + task.swipe(); + } + Log.log(e); + } + } + }, + + swipe() { + let fansTag = tCommon.aId(V.C.text1a).textContains(V.Search.userList[2]).findOne(); + if (fansTag && fansTag.parent().isSelected()) { + tCommon.swipeFansListOp(); + } else { + tCommon.swipeFocusListOp(); + } + } +} + +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); + +while (true) { + task.log(); + try { + let res = task.run(); + if (res) { + tCommon.sleep(3000); + FloatDialogs.show('提示', '已完成'); + break; + } + + tCommon.sleep(3000); + } catch (e) { + Log.log(e); + } +} diff --git a/tasks/task_dy_search_inquiry.js b/tasks/task_dy_search_inquiry.js index c40716a..0d50c5f 100644 --- a/tasks/task_dy_search_inquiry.js +++ b/tasks/task_dy_search_inquiry.js @@ -1,12 +1,12 @@ -import { Common as tCommon } from 'app/dy/Common.js'; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; -import { User as DyUser } from 'app/dy/User.js'; -import { Video as DyVideo } from 'app/dy/Video.js'; -import { storage } from 'common/storage.js'; -import { machine } from 'common/machine.js'; -import { Comment as DyComment } from 'app/dy/Comment.js'; -import { baiduWenxin } from 'service/baiduWenxin.js'; +let tCommon = require('app/dy/Common.js'); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); +let DyUser = require('app/dy/User.js'); +let DyVideo = require('app/dy/Video.js'); +let storage = require('common/storage.js'); +let machine = require('common/machine.js'); +let DyComment = require('app/dy/Comment.js'); +let baiduWenxin = require('service/baiduWenxin.js'); // let dy = require('app/iDy'); // let config = require('config/config'); @@ -265,12 +265,12 @@ if (!task.count) { } tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); while (true) { task.log(); try { - //开启线程 自动关闭弹窗 - Engines.executeScript("unit/dialogClose.js"); let res = task.run(keyword, kws); if (res) { tCommon.sleep(3000); @@ -284,7 +284,8 @@ while (true) { tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } diff --git a/tasks/task_dy_search_user.js b/tasks/task_dy_search_user.js index 56cc244..9036f7a 100644 --- a/tasks/task_dy_search_user.js +++ b/tasks/task_dy_search_user.js @@ -1,12 +1,12 @@ -import { Common as tCommon } from 'app/dy/Common.js'; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; -import { User as DyUser } from 'app/dy/User.js'; -import { Video as DyVideo } from 'app/dy/Video.js'; -import { storage } from 'common/storage.js'; -import { machine } from 'common/machine.js'; -import { Comment as DyComment } from 'app/dy/Comment.js'; -import { baiduWenxin } from 'service/baiduWenxin.js'; +let tCommon = require('app/dy/Common.js'); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); +let DyUser = require('app/dy/User.js'); +let DyVideo = require('app/dy/Video.js'); +let storage = require('common/storage.js'); +let machine = require('common/machine.js'); +let DyComment = require('app/dy/Comment.js'); +let baiduWenxin = require('service/baiduWenxin.js'); // let dy = require('app/iDy'); // let config = require('config/config'); @@ -64,8 +64,8 @@ let task = { } -let settingData = machine.getSearchUserSettingRate(); -settingData.isFirst = true; +let settingData = machine.getSearchUserSettingRate();//commentRate +settingData.isFirst = false;//首个视频必操作,关闭 Log.log('settingData', settingData); if (!settingData.keyword) { @@ -82,12 +82,12 @@ if (!task.count) { } tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); while (true) { task.log(); try { - //开启线程 自动关闭弹窗 - Engines.executeScript("unit/dialogClose.js"); let res = task.run(settingData); if (res) { tCommon.sleep(3000); @@ -102,7 +102,8 @@ while (true) { tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } \ No newline at end of file diff --git a/tasks/task_dy_search_vertical.js b/tasks/task_dy_search_vertical.js index f6fa009..cda609b 100644 --- a/tasks/task_dy_search_vertical.js +++ b/tasks/task_dy_search_vertical.js @@ -1,11 +1,12 @@ -import { Common as tCommon } from "app/dy/Common"; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; -import { Video as DyVideo } from 'app/dy/Video.js'; -import { storage } from "common/storage"; -import { machine } from "common/machine"; -import { Comment as DyComment } from 'app/dy/Comment.js'; -import { baiduWenxin } from "service/baiduWenxin"; +let tCommon = require("app/dy/Common"); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); +let DyVideo = require('app/dy/Video.js'); +let storage = require("common/storage"); +let machine = require("common/machine"); +let DyComment = require('app/dy/Comment.js'); +let baiduWenxin = require("service/baiduWenxin"); +let statistics = require("common/statistics"); // let dy = require('app/iDy'); // let config = require('config/config'); @@ -14,6 +15,9 @@ let task = { contents: [], lib_id: undefined, count: 100, + zanRate: storage.get('task_dy_search_zan_rate', 'int'), + commentRate: storage.get('task_dy_search_comment_rate', 'int'), + focusRate: storage.get('task_dy_search_focus_rate', 'int'), run(keyword) { return this.testTask(keyword); }, @@ -28,7 +32,7 @@ let task = { //type 0 评论,1私信 getMsg(type, title, age, gender) { if (storage.getMachineType() === 1) { - if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; } return machine.getMsg(type) || false;//永远不会结束 @@ -43,97 +47,115 @@ let task = { tCommon.sleep(5000); let rpCount = 0; + let noNicknameCount = 0; while (true) { - if (DyVideo.isLiving()) { - Log.log('直播'); - tCommon.sleep(2000 + Math.random() * 2000); - DyVideo.next(); - tCommon.sleep(2000); - continue; - } + try { + if (DyVideo.isLiving()) { + Log.log('直播'); + tCommon.sleep(2000 + Math.random() * 2000); + DyVideo.next(); + tCommon.sleep(2000); + continue; + } - let title = DyVideo.getContent(); - let nickname = DyVideo.getNickname(); - if (machine.get('task_dy_search_vertical_' + nickname + "_" + title, 'bool')) { - Log.log('重复视频'); - tCommon.sleep(2000 + Math.random() * 2000); - DyVideo.next(); - tCommon.sleep(2000); - continue; - } + let title = DyVideo.getContent(); + let nickname = DyVideo.getNickname(); - if (this.contents.includes(nickname + '_' + title)) { - rpCount++; - if (rpCount > 3) { - return true; + if (machine.get('task_dy_search_vertical_' + nickname + "_" + title, 'bool')) { + Log.log('重复视频'); + tCommon.sleep(2000 + Math.random() * 2000); + DyVideo.next(); + tCommon.sleep(2000); + continue; } - } - rpCount = 0; + statistics.viewVideo(); + statistics.viewTargetVideo(); - if (this.count-- <= 0) { - return true; - } + if (this.contents.includes(nickname + '_' + title)) { + rpCount++; + if (rpCount > 3) { + return true; + } + } - //刷视频 - let processBar = DyVideo.getProcessBar(); - //Log.log('processBar', processBar, processBar && processBar.bounds().height(), processBar && processBar.bounds().top); - if (storage.getPackage() !== 'org.autojs.autoxjs.v6') { - if (processBar) { - let sleepSec = 20 + 20 * Math.random() - 5; - Log.log('休眠' + sleepSec + 's'); - tCommon.sleep(sleepSec * 1000);//最后减去视频加载时间 和查询元素的时间 - } else { - let sleepSec = (15 + 10 * Math.random() - 5); - Log.log('休眠' + sleepSec + 's'); - tCommon.sleep(sleepSec * 1000);//最后减去视频加载时间 和查询元素的时间 + rpCount = 0; + + if (this.count-- <= 0) { + return true; } - } else { - let sleepSec = (5 + 10 * Math.random() - 5); + + //刷视频 + let sleepSec = (10 + 10 * Math.random()); Log.log('休眠' + sleepSec + 's'); tCommon.sleep(sleepSec * 1000);//最后减去视频加载时间 和查询元素的时间 - } - Log.log('看看是不是广告'); - //看看是不是广告,是的话,不操作作者 - if (DyVideo.viewDetail()) { - let clickRePlayTag = tCommon.id('fw2').filter((v) => { - return v && v.bounds() && v.bounds().top > 0 && v.bounds().top + v.bounds().height() < Device.height() && v.bounds().width() > 0 && v.bounds().left > 0; - }).findOnce(); - if (clickRePlayTag) { - Log.log('点击重播'); - clickRePlayTag.click(); - tCommon.sleep(1000); + Log.log('看看是不是广告'); + //看看是不是广告,是的话,不操作作者 + if (DyVideo.viewDetail()) { + let clickRePlayTag = UiSelector().textContains('点击重播').filter((v) => { + return v && v.bounds() && v.bounds().top > 0 && v.bounds().top + v.bounds().height() < Device.height() && v.bounds().width() > 0 && v.bounds().left > 0; + }).findOnce(); + if (clickRePlayTag) { + Log.log('点击重播'); + clickRePlayTag.click(); + tCommon.sleep(1000); + } + Gesture.click(500 + Math.random() * 200, 500 + Math.random() * 300); + tCommon.sleep(1500); + } else { + //Log.log('不是广告,准备进入主页'); } - Gesture.click(500 + Math.random() * 200, 500 + Math.random() * 300); - tCommon.sleep(1500); - } else { - Log.log('不是广告,准备进入主页'); - } - let commentCount = DyVideo.getCommentCount(); - - if (Math.random() <= 0.333) { - Log.log('评论') - let videoTitle = DyVideo.getContent(); - DyVideo.openComment(!!commentCount); - tCommon.sleep(500 + 500 * Math.random()); - let msg = this.getMsg(0, videoTitle); - DyComment.commentMsg(msg.msg); - tCommon.sleep(2000 + 2000 * Math.random()); - tCommon.back(); - tCommon.sleep(500); - } + let commentCount = DyVideo.getCommentCount(); + + if (Math.random() * 100 <= task.commentRate) { + Log.log('评论') + let videoTitle = DyVideo.getContent(); + DyVideo.openComment(!!commentCount); + tCommon.sleep(500 + 500 * Math.random()); + let msg = this.getMsg(0, videoTitle); + DyComment.commentMsg(msg.msg); + tCommon.sleep(2000 + 2000 * Math.random()); + tCommon.back(); + tCommon.sleep(500); + } - if (Math.random() <= 0.333) { - Log.log('点赞'); - DyVideo.clickZan(); - } + if (Math.random() * 100 <= task.zanRate) { + Log.log('点赞'); + DyVideo.clickZan(); + tCommon.sleep(1000 + 1000 * Math.random()); + } - machine.set('task_dy_search_vertical_' + nickname + "_" + title, true); - this.contents.push(nickname + "_" + title); - DyVideo.next(); - tCommon.sleep(2000); + if (Math.random() * 100 <= task.focusRate) { + DyVideo.intoUserPage(); + tCommon.sleep(3000 + 1000 * Math.random()); + Log.log('关注开始'); + DyUser.focus(); + tCommon.sleep(1000 + 1000 * Math.random()); + tCommon.back(); + Log.log('关注完成'); + } + + machine.set('task_dy_search_vertical_' + nickname + "_" + title, true); + this.contents.push(nickname + "_" + title); + DyVideo.next(); + tCommon.sleep(2000); + noNicknameCount = 0; + } catch (e) { + Log.log(e); + if (noNicknameCount++ >= 3) { + if (noNicknameCount > 6) { + Log.log('多次退出未解决问题'); + break; + } + tCommon.back(); + tCommon.sleep(500); + DyVideo.next(); + tCommon.sleep(2000); + } + continue; + } } }, } @@ -153,12 +175,12 @@ if (!task.count) { } tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); while (true) { task.log(); try { - //开启线程 自动关闭弹窗 - Engines.executeScript("unit/dialogClose.js"); let res = task.run(keyword); if (res) { tCommon.sleep(3000); @@ -174,7 +196,8 @@ while (true) { tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } diff --git a/tasks/task_dy_team_buy.js b/tasks/task_dy_team_buy.js new file mode 100644 index 0000000..6d42c7d --- /dev/null +++ b/tasks/task_dy_team_buy.js @@ -0,0 +1,372 @@ +let tCommon = require("app/dy/Common"); +let DyIndex = require("app/dy/Index"); +let DyUser = require("app/dy/User"); +let DyVideo = require("app/dy/Video"); +let DyComment = require("app/dy/Comment"); +let storage = require("common/storage"); +let machine = require("common/machine"); +let baiduWenxin = require("service/baiduWenxin"); +let V = require('version/V.js'); + +let task = { + index: -1, + nicknames: [], + contents: [], + run() { + return this.testTask(); + }, + + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + return machine.getMsg(type) || false;//永远不会结束 + }, + + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-comment-" + file + ".txt"; + Log.setFile(allFile); + }, + + includesKw(str, kw) { + for (let i in kw) { + if (str.includes(kw[i])) { + return true; + } + } + return false; + }, + + search(keyword) { + let inputTag = tCommon.id(V.Search.intoSearchList[0]).isVisibleToUser(true).findOne(); + if (!inputTag) { + Log.log('没有input'); + return false; + } + + tCommon.click(inputTag); + tCommon.sleep(2000); + + inputTag = tCommon.id(V.Search.intoSearchList[0]).findOne(); + if (!inputTag) { + tCommon.sleep(2000); + inputTag = tCommon.id(V.Search.intoSearchList[0]).findOne(); + } + + inputTag.setText(keyword); + tCommon.sleep(2000); + + let submitTag = tCommon.id(V.Search.intoSearchList[1]).textContains(V.Search.intoSearchList[2]).isVisibleToUser(true).findOne(); + if (!submitTag) { + Log.log('没有搜索button'); + return false; + } + tCommon.click(submitTag); + tCommon.sleep(5000); + + let containerTag = UiSelector().textContains(keyword).className('com.lynx.tasm.behavior.ui.text.FlattenUIText').isVisibleToUser(true).findOne(); + + Log.log('神器:', containerTag); + + if (!containerTag) { + containerTag = UiSelector().textContains(keyword.substring(0, 6)).className('com.lynx.tasm.behavior.ui.text.FlattenUIText').isVisibleToUser(true).findOne(); + if (!containerTag) { + Log.log('没有找到店铺'); + FloatDialogs.show('提示', '没有找到门店,请确保名称完全一致~'); + return -1; + } + } + + Log.log(containerTag); + + Gesture.click(containerTag.bounds().left + 5 + Math.random() * 20, containerTag.bounds().top + 5 + Math.random() * 20); + tCommon.sleep(3000 + 3000 * Math.random()); + + let i = 12; + let commentTag; + while (i-- > 0) { + commentTag = UiSelector().textContains(V.GroupBuy.shopContainer[1]).textContains(V.GroupBuy.shopContainer[2]).isVisibleToUser(true).findOne(); + if (commentTag) { + break; + } + + let shopContainer = tCommon.id(V.GroupBuy.shopContainer[0]).isVisibleToUser(true).filter(v => { + return v && v.bounds() && v.bounds().top > Device.height() - v.bounds().height(); + }).findOne(); + if (!shopContainer) { + tCommon.swipe(0, 0.5);//慢慢滑动 + tCommon.sleep(1000 + 500 * Math.random()); + } else { + Log.log('没有找到shopContainer'); + } + } + + if (!commentTag) { + FloatDialogs.show('提示', '没有找到评论列表~'); + return -1; + } + + Gesture.click(commentTag.bounds().left + 200 + 400 * Math.random(), commentTag.bounds().top + 20 * Math.random()); + tCommon.sleep(3000 + 2000 * Math.random()); + + //最新点击 + let newTag = new UiSelector().textContains('最新').className('com.lynx.tasm.behavior.ui.text.UIText').findOne() || new UiSelector().textContains('最新').className('com.lynx.tasm.behavior.ui.text.FlattenUIText').findOne();; + if (newTag) { + tCommon.click(newTag); + tCommon.sleep(3000 + 2000 * Math.random()); + } + + return true; + }, + + testTask() { + let keyword = machine.get('task_dy_team_buy_text'); + let zanRate = machine.get('task_dy_team_buy_zan_rate', 'int'); + let privateRate = machine.get('task_dy_team_buy_private_rate', 'int'); + let commentRate = machine.get('task_dy_team_buy_comment_rate', 'int'); + let opCount = machine.get('task_dy_team_buy_op_count') * 1; + let waitSecond = machine.get('task_dy_team_buy_wait', 'int'); + + Log.log([ + keyword, zanRate, privateRate, commentRate, opCount, waitSecond + ]); + + //首先进入页面 + let res = DyIndex.intoGroupBuy(keyword); + if (!res) { + return res; + } + + tCommon.sleep(3000); + res = this.search(keyword); + if (true !== res) { + return res; + } + + let containers = []; + let rpContainers = []; + + while (true) { + try { + // ntoUser = UiSelector().textContains('帮助更多用户决策').isVisibleToUser(true).findOne() ? false : true; + let tags = UiSelector().textMatches("[\\s\\S]+").isVisibleToUser(true).clickable(true).filter(v => { + return v && v.bounds() && v.bounds().width() == Device.width() && v.bounds().height() > 0 && v.bounds().left == 0 && v.bounds().top + v.bounds().height() < Device.height(); + }).find(); + + if (tags.length == 0) { + Log.log('无内容'); + return true; + } + + if (containers.length >= 3) { + if (tags[0].text() == containers[0]) { + Log.log('完成'); + return true; + } + + containers.shift(); + } + + containers.push(tags[0].text()); + + for (let i in tags) { + if (rpContainers.indexOf(tags[i].text()) != -1) { + Log.log('重复'); + continue; + } + + rpContainers.push(tags[i].text()); + if (rpContainers.length > 20) { + rpContainers.shift(); + } + + if (tags[i].text() && (tags[i].text().indexOf('**') !== -1 || tags[i].text().indexOf('帮助更多用户决策') !== -1) || !tags[i].desc()) { + Log.log('隐私或者底部'); + continue; + } + + if(tags[i].text().indexOf('写评价,吃喝玩乐免费体验') !== -1){ + Log.log('评价'); + continue; + } + + Log.log('进入用户中心', tags[i], tags[i].bounds().top, tags[i].bounds().height()); + //tags[i].click(); + let top = tags[i].bounds().top; + if (top < 0) { + top = tags[i].bounds().top + tags[i].bounds().height() - 10 * Math.random(); + } else { + top += 20 * Math.random(); + } + + Gesture.click(tags[i].bounds().left + 20 * Math.random(), top); + tCommon.sleep(3000 + 1000 * Math.random()); + + let commentDetailHead = UiSelector().className('com.lynx.tasm.ui.image.FlattenUIImage').clickable(false).filter(v => { + return v && v.bounds() && v.bounds().left < Device.width() * 0.3 && v.bounds().height() == v.bounds().width(); + }).findOne(); + + if (!commentDetailHead) { + Log.log('没有头像,返回'); + tCommon.back(); + continue; + } + + tCommon.click(commentDetailHead); + tCommon.sleep(3000 + 1000 * Math.random()); + if (UiSelector().textContains('用户评价').descContains('用户评价').isVisibleToUser(true).findOne()) { + Log.log('点击失效'); + continue; + } + + intoUser = UiSelector().textContains('评价数').descContains('评价数').isVisibleToUser(true).findOne() ? true : false; + if (!intoUser) { + tCommon.back(); + Log.log('没有进入到主页,可能是设置隐私了-1'); + continue; + } + + let currentCommentRate = Math.random() * 100; + let currentPrivateRate = Math.random() * 100; + let currentZanRate = Math.random() * 100; + + if (zanRate >= currentZanRate || commentRate >= currentCommentRate || privateRate >= currentPrivateRate) { + Log.log('进入主页留痕了'); + let header = UiSelector().className('com.lynx.tasm.ui.image.FlattenUIImage').clickable(false).filter(v => { + return v && v.bounds() && v.bounds().left > Device.width() * 0.6 && v.bounds().height() == v.bounds().width(); + }).findOne(); + + Log.log('头像', header); + if (!header) { + tCommon.back(); + Log.log('没有看见头,返回'); + continue; + } + + tCommon.click(header); + tCommon.sleep(3000 + 1000 * Math.random()); + + let douyin = DyUser.getDouyin(); + if (rpContainers.indexOf(douyin) != -1) { + tCommon.back(2); + tCommon.sleep(1000); + Log.log('重复'); + continue; + } + + rpContainers.push(douyin); + + if (!DyVideo.intoUserVideo()) { + tCommon.back(2); + tCommon.sleep(1000); + Log.log('没有进入视频,返回3次') + continue; + } + + let opC = 0; + tCommon.sleep(5000 + 5000 * Math.random()); + if (zanRate >= currentZanRate) { + DyVideo.clickZan(); + tCommon.sleep(1000 + Math.random() * 3000); + opC = 1; + } + + if (commentRate >= currentCommentRate) { + DyComment.commentMsg(this.getMsg(0, DyVideo.getContent()).msg); + tCommon.sleep(1000 + Math.random() * 3000); + opC = 1; + } + + tCommon.back();//返回到用户界面 + + if (privateRate >= currentPrivateRate) { + tCommon.sleep(500); + Log.log('滑动'); + tCommon.swipe(1, 0.8); + //Gesture.swipe(200, Device.height() * 0.3, 200, Device.height() * 0.7, 100); + tCommon.sleep(500); + DyUser.privateMsg(this.getMsg(1, DyUser.getNickname()).msg); + opC = 1; + } + + opCount -= opC; + if (opCount <= 0) { + Log.log('opCount', opCount); + return true; + } + + tCommon.sleep(waitSecond * 1000); + Log.log('操作完了,返回') + tCommon.back(3);//用户评论主页,再返回一次,才是列表页 + } + + //用户评论页,回到列表页 + if (intoUser) { + Log.log('进入了用户-'); + let isTrueIntoUserTag = UiSelector().textContains('评价数').descContains('评价数').isVisibleToUser(true).findOne(); + if (isTrueIntoUserTag) { + tCommon.back(2); + tCommon.sleep(1000); + } + } + } + + Log.log('下一页评论'); + let l = 300 * Math.random(); + let rd = Device.height() * 0.1; + Gesture.swipe(l + 200, Device.height() * 0.6 + rd, l + 200, Device.height() * (0.2 + 0.1 * Math.random()), 200); + tCommon.sleep(1500 + 500 * Math.random()); + } catch (e) { + Log.log('报错了', e); + let runTimes = 5; + let resolve = false; + do { + let bottomTag = UiSelector().textContains('用户评价').descContains('用户评价').isVisibleToUser(true).findOne();//底部栏 + if (bottomTag) { + resolve = true; + break; + } + + if (runTimes-- > 0) { + tCommon.back(); + tCommon.sleep(500); + Log.log('尝试返回'); + continue; + } + break; + } while (true); + + if (!resolve) { + throw new Error('5次没有解决异常'); + } + } + } + }, +} + +tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); + +while (true) { + task.log(); + try { + let r = task.run(); + if (r == -1 || r == false) { + break;//异常的情况 + } + + if (r) { + FloatDialogs.show('提示', '完成'); + break; + } + + tCommon.sleep(3000); + } catch (e) { + Log.log(e); + tCommon.closeAlert(1); + tCommon.backHome(10); + } +} diff --git a/tasks/task_dy_toker.js b/tasks/task_dy_toker.js index 54d2398..80dfc0e 100644 --- a/tasks/task_dy_toker.js +++ b/tasks/task_dy_toker.js @@ -1,7 +1,8 @@ -import { Common as tCommon } from "app/dy/Common"; -import { iDy as dy } from 'app/iDy'; -import { config } from 'config/config'; -import { machine } from "common/machine"; +let tCommon = require("app/dy/Common"); +let dy = require('app/iDy'); +let config = require('config/config'); +let machine = require("common/machine"); +// let baiduWenxin = require("service/baiduWenxin"); let task = { me: {},//我的抖音号和昵称 @@ -25,30 +26,41 @@ let task = { }, } -tCommon.openApp(); +// let a = System.getDataFrom('setting_baidu_wenxin_role', 'role', 'content'); +// Log.log(a); +// Log.log(baiduWenxin.testChat('你好啊')); + //开启线程 自动关闭弹窗 Engines.executeScript("unit/dialogClose.js"); while (true) { task.log(); try { + tCommon.openApp();//兜底,防止跑到外面去了 let code = task.run(); if (code === 101) { // tCommon.closeApp(); tCommon.showToast('不在任务时间,休息一会儿'); + Log.log('不在任务时间,休眠一会儿'); + tCommon.backApp(); + //App.notifySuccess('通知', '即将返回到App'); let hours = machine.getTokerData(0).toker_run_hour; - console.log(hours, (new Date()).getHours(), hours.includes("0")); + console.log(Array.isArray(hours), hours, (new Date()).getHours(), hours.includes("0")); while (true) { - tCommon.sleep(1 * 60 * 1000); + tCommon.sleep(1 * 60 * 1000 / 6); if (hours.includes((new Date()).getHours().toString())) { break; } } + Log.log("内存清理"); + System.cleanUp(); + throw new Error('重新进入'); } - tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + System.cleanUp(); + tCommon.closeAlert(1); tCommon.backHome(); } } diff --git a/tasks/task_dy_toker_accurate_placement.js b/tasks/task_dy_toker_accurate_placement.js index c7fec93..1de108f 100644 --- a/tasks/task_dy_toker_accurate_placement.js +++ b/tasks/task_dy_toker_accurate_placement.js @@ -1,12 +1,12 @@ -import {Common as tCommon} from "app/dy/Common"; -import {Index as DyIndex} from "app/dy/Index"; -import {Search as DySearch} from "app/dy/Search"; -import {User as DyUser} from "app/dy/User"; -import {Video as DyVideo} from "app/dy/Video"; -import {Comment as DyComment} from "app/dy/Comment"; +let tCommon = require("app/dy/Common"); +let DyIndex = require("app/dy/Index"); +let DySearch = require("app/dy/Search"); +let DyUser = require("app/dy/User"); +let DyVideo = require("app/dy/Video"); +let DyComment = require("app/dy/Comment"); let Http = require('unit/mHttp'); -import {storage} from "common/storage"; -import {machine} from "common/machine"; +let storage = require("common/storage"); +let machine = require("common/machine"); // let dy = require('app/iDy'); // let config = require('config/config'); diff --git a/tasks/task_dy_toker_city.js b/tasks/task_dy_toker_city.js index 58aad8e..5731cdc 100644 --- a/tasks/task_dy_toker_city.js +++ b/tasks/task_dy_toker_city.js @@ -1,7 +1,7 @@ -import { Common as tCommon } from "app/dy/Common"; -import { iDy as dy } from 'app/iDy'; -import { config } from 'config/config'; -import { machine } from "common/machine"; +let tCommon = require("app/dy/Common"); +let dy = require('app/iDy'); +let config = require('config/config'); +let machine = require("common/machine"); let task = { me: {},//我的抖音号和昵称 @@ -32,23 +32,31 @@ Engines.executeScript("unit/dialogClose.js"); while (true) { task.log(); try { + tCommon.openApp(); let code = task.run(); if (code === 101) { // tCommon.closeApp(); tCommon.showToast('不在任务时间,休息一会儿'); + Log.log('不在任务时间,休眠一会儿'); let hours = machine.getTokerData(1).toker_run_hour; console.log(hours, (new Date()).getHours(), hours.includes("0")); + tCommon.backApp(); while (true) { tCommon.sleep(1 * 60 * 1000); if (hours.includes((new Date()).getHours().toString())) { break; } } + Log.log("内存清理"); + System.cleanUp(); + throw new Error('重新进入'); } tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + System.cleanUp(); + tCommon.closeAlert(1); tCommon.backHome(); } } diff --git a/tasks/task_dy_toker_comment.js b/tasks/task_dy_toker_comment.js index af33e97..9a99df6 100644 --- a/tasks/task_dy_toker_comment.js +++ b/tasks/task_dy_toker_comment.js @@ -1,12 +1,13 @@ -import { Common as tCommon } from "app/dy/Common"; -import { Index as DyIndex } from "app/dy/Index"; -import { Search as DySearch } from "app/dy/Search"; -import { User as DyUser } from "app/dy/User"; -import { Video as DyVideo } from "app/dy/Video"; -import { Comment as DyComment } from "app/dy/Comment"; -import { storage } from "common/storage"; -import { machine } from "common/machine"; -import { baiduWenxin } from "service/baiduWenxin"; +let tCommon = require("app/dy/Common"); +let DyIndex = require("app/dy/Index"); +let DySearch = require("app/dy/Search"); +let DyUser = require("app/dy/User"); +let DyVideo = require("app/dy/Video"); +let DyComment = require("app/dy/Comment"); +let storage = require("common/storage"); +let machine = require("common/machine"); +let baiduWenxin = require("service/baiduWenxin"); +let statistics = require("common/statistics"); let task = { index: -1, @@ -17,7 +18,7 @@ let task = { }, getMsg(type, title, age, gender) { - if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; } return machine.getMsg(type) || false;//永远不会结束 @@ -42,39 +43,53 @@ let task = { testTask(input, kw, sleepSecond) { //首先进入页面 let intoUserFansList = input.indexOf('+') === 0; - if (intoUserFansList) { - input = input.substring(1); - DyIndex.intoMyPage(); - DyUser.intoFocusList(); - tCommon.sleep(3000); + let hasRemark = tCommon.getRemark(input); + this.index++; + let douyin; + if (!hasRemark) { + if (intoUserFansList) { + input = input.substring(1); + DyIndex.intoMyPage(); + DyUser.intoFocusList(); + tCommon.sleep(3000); + } else { + DyIndex.intoSearchPage(); + } + input = tCommon.splitKeyword(input); + douyin = input[this.index]; } else { - DyIndex.intoSearchPage(); + input = input.substring(1); + input = tCommon.splitKeyword(input); + douyin = input[this.index]; + App.gotoIntent('snssdk1128://user/profile/' + douyin); + tCommon.sleep(5000 + 2000 * Math.random()); + DyVideo.intoUserVideo(); } - input = tCommon.splitKeyword(input); kw = tCommon.splitKeyword(kw); Log.log('账号:', input); Log.log('关键词:', kw); - this.index++; + if (this.index >= input.length) { this.index = 0; } - let douyin = input[this.index]; let res; - if (intoUserFansList) { - res = DyUser.focusListSearch(douyin); - } else { - res = DySearch.intoUserVideoPage(input[this.index], 1); - } + if (!hasRemark) { + if (intoUserFansList) { + res = DyUser.focusListSearch(douyin); + } else { + res = DySearch.intoUserVideoPage(input[this.index], 1); + } - if (!res) { - System.toast('找不到用户账号:' + input); - return 'exit'; - } + if (!res) { + System.toast('找不到用户账号:' + input); + return 'exit'; + } - if (intoUserFansList) { - DyVideo.intoUserVideo(); + if (intoUserFansList) { + DyVideo.intoUserVideo(); + } } //获取最新的前三视频 @@ -89,6 +104,9 @@ let task = { continue; } + statistics.viewVideo(); + statistics.viewTargetVideo(); + DyVideo.openComment(commentCount); tCommon.sleep(2000 + 1000 * Math.random()); let rp = 0; @@ -188,9 +206,9 @@ let task = { } if (intoUserFansList) { - tCommon.back(4, 1500); + tCommon.back(5, 1500); } else { - tCommon.back(4, 1500); + tCommon.back(5, 1500); } tCommon.backApp(); @@ -229,18 +247,13 @@ if (sleepSecond <= 0) { System.exit(); } -if (!sleepSecond) { - System.toast('你取消了任务'); - System.exit(); -} - tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); while (true) { task.log(); try { - //开启线程 自动关闭弹窗 - Engines.executeScript("unit/dialogClose.js"); let r = task.run(input, kw, sleepSecond); if (r === 'exit') { if (thr) { @@ -256,7 +269,8 @@ while (true) { tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } \ No newline at end of file diff --git a/tasks/task_dy_toker_dominating_screen.js b/tasks/task_dy_toker_dominating_screen.js index 3ee68d5..29e1425 100644 --- a/tasks/task_dy_toker_dominating_screen.js +++ b/tasks/task_dy_toker_dominating_screen.js @@ -1,9 +1,9 @@ -import {Common as tCommon} from "app/dy/Common"; -// import { Index as DyIndex } from 'app/dy/Index.js'; -// import { Search as DySearch } from 'app/dy/Search.js'; +let tCommon = require("app/dy/Common"); +// let DyIndex = require('app/dy/Index.js'); +// let DySearch = require('app/dy/Search.js'); // const DyUser = require('app/dy/User.js'); -// import { Video as DyVideo } from 'app/dy/Video.js'; -// import { Comment as DyComment } from 'app/dy/Comment.js'; +// let DyVideo = require('app/dy/Video.js'); +// let DyComment = require('app/dy/Comment.js'); let dy = require('app/iDy'); let config = require('config/config'); diff --git a/tasks/task_dy_toker_fans.js b/tasks/task_dy_toker_fans.js index a80adbe..4b79ef9 100644 --- a/tasks/task_dy_toker_fans.js +++ b/tasks/task_dy_toker_fans.js @@ -1,13 +1,12 @@ -import { Common as tCommon } from 'app/dy/Common.js'; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; -import { User as DyUser } from 'app/dy/User.js'; -import { Video as DyVideo } from 'app/dy/Video.js'; -import { storage } from 'common/storage.js'; -import { machine } from 'common/machine.js'; -import { Comment as DyComment } from 'app/dy/Comment.js'; -import { mHttp as Http } from 'unit/mHttp.js'; -import { baiduWenxin } from 'service/baiduWenxin.js'; +let tCommon = require('app/dy/Common.js'); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); +let DyUser = require('app/dy/User.js'); +let DyVideo = require('app/dy/Video.js'); +let storage = require('common/storage.js'); +let machine = require('common/machine.js'); +let DyComment = require('app/dy/Comment.js'); +let baiduWenxin = require('service/baiduWenxin.js'); let task = { contents: [], @@ -25,7 +24,7 @@ let task = { //type 0 评论,1私信 getMsg(type, title, age, gender) { - if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; } @@ -48,15 +47,21 @@ let task = { })); DyIndex.intoHome(); - if (settingData.account.indexOf('+') === 0) { - DyIndex.intoMyPage(); + if (tCommon.getRemark(settingData.account)) { + settingData.account = settingData.account.substring(1); + App.gotoIntent('snssdk1128://user/profile/' + settingData.account); + tCommon.sleep(5000 + 2000 * Math.random()); } else { - DyIndex.intoSearchPage(); - } - - let res = DySearch.homeIntoSearchUser(settingData.account); - if (res) { - return res; + if (settingData.account.indexOf('+') === 0) { + DyIndex.intoMyPage(); + } else { + DyIndex.intoSearchPage(); + } + + let res = DySearch.homeIntoSearchUser(settingData.account); + if (res) { + return res; + } } return DyUser.focusUserList(1, this.getMsg, DyVideo, DyComment, machine, settingData, this.contents, this.me.nickname); @@ -77,14 +82,14 @@ if (!settingData.account) { } tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); let thr = undefined; while (true) { Log.log('日志开始'); task.log(); try { - //开启线程 自动关闭弹窗 - Engines.executeScript("unit/dialogClose.js"); let res = task.run(settingData); if (res) { tCommon.sleep(3000); @@ -99,7 +104,8 @@ while (true) { tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } diff --git a/tasks/task_dy_toker_focus.js b/tasks/task_dy_toker_focus.js index e9faf4b..f7d1912 100644 --- a/tasks/task_dy_toker_focus.js +++ b/tasks/task_dy_toker_focus.js @@ -1,12 +1,12 @@ -import { Common as tCommon } from 'app/dy/Common.js'; -import { Index as DyIndex } from 'app/dy/Index.js'; -import { Search as DySearch } from 'app/dy/Search.js'; -import { User as DyUser } from 'app/dy/User.js'; -import { Video as DyVideo } from 'app/dy/Video.js'; -import { storage } from 'common/storage.js'; -import { machine } from 'common/machine.js'; -import { Comment as DyComment } from 'app/dy/Comment.js'; -import { baiduWenxin } from 'service/baiduWenxin.js'; +let tCommon = require('app/dy/Common.js'); +let DyIndex = require('app/dy/Index.js'); +let DySearch = require('app/dy/Search.js'); +let DyUser = require('app/dy/User.js'); +let DyVideo = require('app/dy/Video.js'); +let storage = require('common/storage.js'); +let machine = require('common/machine.js'); +let DyComment = require('app/dy/Comment.js'); +let baiduWenxin = require('service/baiduWenxin.js'); let task = { contents: [], @@ -23,7 +23,7 @@ let task = { //type 0 评论,1私信 getMsg(type, title, age, gender) { - if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; } return machine.getMsg(type) || false;//永远不会结束 @@ -32,14 +32,21 @@ let task = { testTask(settingData) { //首先进入点赞页面 DyIndex.intoHome(); - if (settingData.account.indexOf('+') === 0) { - DyIndex.intoMyPage(); + + if (tCommon.getRemark(settingData.account)) { + settingData.account = settingData.account.substring(1); + App.gotoIntent('snssdk1128://user/profile/' + settingData.account); + tCommon.sleep(5000 + 2000 * Math.random()); } else { - DyIndex.intoSearchPage(); - } - let res = DySearch.homeIntoSearchUser(settingData.account); - if (res) { - return res; + if (settingData.account.indexOf('+') === 0) { + DyIndex.intoMyPage(); + } else { + DyIndex.intoSearchPage(); + } + let res = DySearch.homeIntoSearchUser(settingData.account); + if (res) { + return res; + } } return DyUser.focusUserList(0, this.getMsg, DyVideo, DyComment, machine, settingData, this.contents); @@ -59,12 +66,12 @@ if (!settingData.account) { } tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); while (true) { task.log(); try { - //开启线程 自动关闭弹窗 - Engines.executeScript("unit/dialogClose.js"); let res = task.run(settingData); if (res) { tCommon.sleep(3000); @@ -78,7 +85,8 @@ while (true) { tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } diff --git a/tasks/task_dy_toker_invite.js b/tasks/task_dy_toker_invite.js new file mode 100644 index 0000000..2b37e81 --- /dev/null +++ b/tasks/task_dy_toker_invite.js @@ -0,0 +1,90 @@ +let tCommon = require("app/dy/Common"); +const DyUser = require('app/dy/User.js'); +let storage = require("common/storage"); +let machine = require("common/machine"); + +let task = { + index: 0, + run(accounts, second) { + return this.testTask(accounts, second); + }, + + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-dy-toker-uid-" + file + ".txt"; + Log.setFile(allFile); + }, + + //type 0 评论,1私信 + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + + //return { msg: ['厉害', '六六六', '666', '拍得很好', '不错哦', '关注你很久了', '学习了', '景色不错', '真的很不错', '太厉害了', '深表认同', '来过了', '茫茫人海遇见你', '太不容易了', '很好', '懂了', '我看到了', '可以的', '一起加油', '真好', '我的个乖乖'][Math.round(Math.random() * 20)] }; + return machine.getMsg(type) || false;//永远不会结束 + }, + + testTask(accounts, second) { + //首先进入点赞页面 + Log.log('账号:', accounts, second); + for (let i in accounts) { + if (i < this.index) { + continue; + } + + try { + //进入用户主页,私信,关注 + Log.log('开始进入主页', 'snssdk1128://user/profile/' + accounts[i]); + App.gotoIntent('snssdk1128://user/profile/' + accounts[i]); + tCommon.sleep(5000 + 3000 * Math.random()); + Log.log('发送卡片'); + DyUser.privateMsgCard(1); + tCommon.sleep(500 + 1000 * Math.random()); + } catch (e) { + Log.log("报错捕获:", e); + tCommon.sleep(500 + 1000 * Math.random()); + } + + this.index++; + let s = (second / 2 + second / 2 * Math.random()); + Log.log('休眠' + s + '秒') + tCommon.sleep(s * 1000); + } + + if (this.index >= accounts.length) { + return true; + } + }, +} + +let accounts = storage.get('task_dy_toker_invite_account'); +Log.log('accounts', accounts); +if (!accounts) { + tCommon.showToast('你取消了执行'); + //console.hide();(); + System.exit(); +} +accounts = accounts.split("\n"); + +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); +tCommon.openApp();//兜底,防止跑到外面去了 + +task.log(); +try { + //开启线程 自动关闭弹窗 + if (task.run(accounts, storage.get('task_dy_toker_invite_interval', 'int'))) { + FloatDialogs.show('提示', '执行完成'); + } + tCommon.sleep(3000); +} catch (e) { + Log.log(e); + try { + tCommon.showToast("遇到错误,即将自动重启"); + tCommon.sleep(3000); + } catch (e) { + Log.log('启停bug', e); + } +} diff --git a/tasks/task_dy_toker_live.js b/tasks/task_dy_toker_live.js index 9cbbed2..e88de0e 100644 --- a/tasks/task_dy_toker_live.js +++ b/tasks/task_dy_toker_live.js @@ -1,13 +1,13 @@ -import { Common as tCommon } from "app/dy/Common"; -import { Index as DyIndex } from "app/dy/Index"; -import { Search as DySearch } from "app/dy/Search"; -import { Comment as DyComment } from "app/dy/Comment"; -import { User as DyUser } from "app/dy/User"; -import { Video as DyVideo } from "app/dy/Video"; -import { storage } from "common/storage"; -import { machine } from "common/machine"; -import { Live as DyLive } from "app/dy/Live"; -import { baiduWenxin } from "service/baiduWenxin"; +let tCommon = require("app/dy/Common"); +let DyIndex = require("app/dy/Index"); +let DySearch = require("app/dy/Search"); +let DyComment = require("app/dy/Comment"); +let DyUser = require("app/dy/User"); +let DyVideo = require("app/dy/Video"); +let storage = require("common/storage"); +let machine = require("common/machine"); +let DyLive = require("app/dy/Live"); +let baiduWenxin = require("service/baiduWenxin"); let task = { index: -1, @@ -18,7 +18,7 @@ let task = { }, getMsg(type, title, age, gender) { - if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; } return machine.getMsg(type) || false;//永远不会结束 @@ -41,20 +41,30 @@ let task = { }, testTask(douyin, preIndex) { - //首先进入页面 - DyIndex.intoSearchPage(); Log.log('账号:', douyin); Log.log('preIndex:', preIndex); - let res = DySearch.intoUserLiveRoom(douyin, 1); - if (!res) { - System.toast('找不到用户账号:' + douyin); - this.intoErrorCount++; - Threads.shutDownAll(); - tCommon.sleep(500); - if (this.intoErrorCount >= 3) { - return true;//完成了 + if (!tCommon.getRemark(douyin)) { + //首先进入页面 + DyIndex.intoSearchPage(); + let res = DySearch.intoUserLiveRoom(douyin, 1); + if (!res) { + System.toast('找不到用户账号:' + douyin); + this.intoErrorCount++; + Threads.shutDownAll(); + tCommon.sleep(500); + if (this.intoErrorCount >= 3) { + return true;//完成了 + } + throw new Error('找不到用户账号:' + douyin); + } + } else { + douyin = douyin.substring(1); + App.gotoIntent('snssdk1128://user/profile/' + douyin); + tCommon.sleep(5000 + 2000 * Math.random()); + if (!DyUser.intoLive()) { + return true; } - throw new Error('找不到用户账号:' + douyin); + tCommon.sleep(5000 + 2000 * Math.random()); } this.intoErrorCount = 0; @@ -62,21 +72,24 @@ let task = { let rp = 0; while (true) { DyLive.openUserList(); - let onlineTag = new UiSelector().descContains('在线观众').textContains('在线观众').filter((v) => { + let onlineTag = UiSelector().descContains('在线观众').textContains('在线观众').filter((v) => { return v && v.bounds() && v.bounds().top && v.bounds().width() && v.bounds().height() && v.bounds().top + v.bounds().height() < Device.height(); - }).findOne(2000); + }).findOneBy(2000); if (!onlineTag) { throw new Error('找不到“在线观众”tag'); } - let lastUser = undefined; + let addr = undefined; + let hiddenI = 0; + let ignoreIndex = 0; while (true) { let users = DyLive.getUsers(); - if (JSON.stringify(users) === lastUser) { - rp++; - } else { - rp = 0; + if (users.length == 0) { + tCommon.back(); + tCommon.sleep(1000); + Log.log('无数据'); + break; } if (rp >= 3) { @@ -86,51 +99,80 @@ let task = { break; } - lastUser = JSON.stringify(users); for (let k in users) { - if (this.nicknames.includes(users[k].title)) { + Log.log('index', ignoreIndex); + if (ignoreIndex++ <= preIndex) { continue; } - Log.log('index', users[k].index * 1); - if (users[k].index * 1 <= preIndex) { + if (!tCommon.clickRange(users[k].tag, onlineTag.bounds().top, Device.height() - users[k].tag.bounds().height())) { + Log.log('边界超出'); continue; } - let tmp = /第\d+名/.exec(users[k].title); - let title = users[k].title; - if (tmp && tmp[0]) { - title = title.replace(tmp[0], ''); + tCommon.sleep(1000 + 2000 * Math.random()); + let nickname = DyLive.getNickname(); + if (nickname == '') { + Log.log('没有点击成功'); + if (hiddenI++ >= 3) { + break; + } + continue; } + hiddenI = 0; - if (title.indexOf('***') !== -1) { - return -1; + if (k == 0) { + if (nickname === addr) { + rp++; + } else { + rp = 0; + } + addr = nickname; } - if (machine.get('task_dy_toker_live_' + douyin + '_' + title, 'bool')) { - Log.log('重复'); + if (this.nicknames.includes(nickname)) { + tCommon.back(); + Log.log('重复-'); continue; } - if (users[k].tag.bounds().top <= onlineTag.bounds().top + onlineTag.bounds().height()) { - Log.log('边界超出'); + if (machine.get('task_dy_toker_live_' + douyin + '_' + nickname, 'bool')) { + Log.log('重复'); + tCommon.back(); continue; } - Log.log('开始操作用户:', title, machine.get('task_dy_toker_live_' + douyin + '_' + title, 'bool')); - this.nicknames.push(users[k].title); - machine.set('task_dy_toker_live_' + douyin + '_' + title, true); - Log.log('设置后:' + machine.get('task_dy_toker_live_' + douyin + '_' + title, 'bool')); + Log.log('开始操作用户:', nickname, machine.get('task_dy_toker_live_' + douyin + '_' + nickname, 'bool')); + this.nicknames.push(nickname); + machine.set('task_dy_toker_live_' + douyin + '_' + nickname, true); + Log.log('设置后:' + machine.get('task_dy_toker_live_' + douyin + '_' + nickname, 'bool')); Log.log('进入粉丝列表'); - DyLive.intoFansPage(users[k]); + DyLive.intoFansPage(); if (DyUser.isPrivate()) { Log.log('私密账号'); tCommon.back(1, 1000); continue; } + try { + if (machine.get('task_dy_toker_live_focus_switch', 'bool')) { + DyUser.focus(); + } + + if (machine.get('task_dy_toker_live_private_switch', 'bool')) { + let msg = this.getMsg(1, DyUser.getNickname(), DyUser.getAge(), DyUser.getGender()); + if (msg) { + DyUser.privateMsg(msg.msg); + } + } + + } catch (e) { + Log.log(e); + } + //开始操作评论 - if (DyVideo.intoUserVideo()) { + let comment_user_video_rate = machine.get('task_dy_toker_live_comment_user_video_rate', 'int'); + if (comment_user_video_rate > Math.random() * 100 && DyVideo.intoUserVideo()) { Log.log('有视频,直接操作视频引流'); DyVideo.clickZan(); tCommon.sleep(1000); @@ -144,22 +186,17 @@ let task = { } else { tCommon.back();//从视频页面到用户页面 } - } else { - Log.log('无视频,直接操作关注和私信引流'); - try { - DyUser.focus(); - let msg = this.getMsg(1, DyUser.getNickname(), DyUser.getAge(), DyUser.getGender()); - if (msg) { - DyUser.privateMsg(msg.msg); - } - } catch (e) { - Log.log(e); - } } + tCommon.sleep(1000); Log.log('back 1'); tCommon.back(); - tCommon.sleep(2000); + System.toast('操作间隔:' + machine.get('task_dy_toker_live_focus_rate', 'int')); + tCommon.sleep(machine.get('task_dy_toker_live_focus_rate', 'int') * 1000); + } + + if (hiddenI++ >= 3) { + break; } Log.log('下一页'); DyLive.swipeFansList(); @@ -185,13 +222,14 @@ if (!preIndex) { } tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); + while (true) { task.log(); try { - //开启线程 自动关闭弹窗 - Engines.executeScript("unit/dialogClose.js"); let res = task.run(input, preIndex); - if (res) { + if (res == true) { tCommon.sleep(5000); FloatDialogs.show('提示', '任务完成了'); break; @@ -205,13 +243,8 @@ while (true) { } tCommon.sleep(3000); } catch (e) { - Log.log(e.stack); + Log.log(e); + tCommon.closeAlert(1); tCommon.backHome(); } } - -try { - Engines.closeAll(true); -} catch (e) { - Log.log('停止脚本'); -} diff --git a/tasks/task_dy_toker_test.js b/tasks/task_dy_toker_test.js index 024b69a..9f03b7e 100644 --- a/tasks/task_dy_toker_test.js +++ b/tasks/task_dy_toker_test.js @@ -1,10 +1,10 @@ const tDyCommon = require('app/dy/Common.js'); -import { Index as DyIndex } from 'app/dy/Index.js'; +let DyIndex = require('app/dy/Index.js'); const DyUser = require('app/dy/User.js'); -import { Video as DyVideo } from 'app/dy/Video.js'; -import { Comment as DyComment } from 'app/dy/Comment.js'; -import {storage} from "common/storage"; -import {baiduWenxin} from "service/baiduWenxin"; +let DyVideo = require('app/dy/Video.js'); +let DyComment = require('app/dy/Comment.js'); +let storage = require("common/storage"); +let baiduWenxin = require("service/baiduWenxin"); let task = { me: {},//我的抖音号和昵称 diff --git a/tasks/task_dy_toker_uid.js b/tasks/task_dy_toker_uid.js new file mode 100644 index 0000000..73de3f2 --- /dev/null +++ b/tasks/task_dy_toker_uid.js @@ -0,0 +1,106 @@ +let tCommon = require("app/dy/Common"); +const DyUser = require('app/dy/User.js'); +let storage = require("common/storage"); +let machine = require("common/machine"); + +let task = { + index: 0, + run(accounts, second, ops) { + return this.testTask(accounts, second, ops); + }, + + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-dy-toker-uid-" + file + ".txt"; + Log.setFile(allFile); + }, + + //type 0 评论,1私信 + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + + //return { msg: ['厉害', '六六六', '666', '拍得很好', '不错哦', '关注你很久了', '学习了', '景色不错', '真的很不错', '太厉害了', '深表认同', '来过了', '茫茫人海遇见你', '太不容易了', '很好', '懂了', '我看到了', '可以的', '一起加油', '真好', '我的个乖乖'][Math.round(Math.random() * 20)] }; + return machine.getMsg(type) || false;//永远不会结束 + }, + + testTask(accounts, second, ops) { + //首先进入点赞页面 + Log.log('账号:', accounts, ops); + for (let i in accounts) { + if (i < this.index) { + continue; + } + + try { + //进入用户主页,私信,关注 + App.gotoIntent('snssdk1128://user/profile/' + accounts[i]); + tCommon.sleep(5000 + 3000 * Math.random()); + if (ops.includes("1")) { + Log.log('私信'); + DyUser.privateMsg(this.getMsg(1).msg); + tCommon.sleep(500 + 1000 * Math.random()); + } + + if (ops.includes("0")) { + Log.log('关注'); + DyUser.focus(); + } + } catch (e) { + Log.log(e); + } + + this.index++; + let s = (second / 2 + second / 2 * Math.random()); + Log.log('休眠' + s + '秒') + tCommon.sleep(s * 1000); + tCommon.backHomeOnly(); + tCommon.sleep(2000 * Math.random() + 500); + } + + if (this.index >= accounts.length) { + return true; + } + }, +} + +let accounts = storage.get('task_dy_toker_uid_account'); +Log.log('accounts', accounts); +if (!accounts) { + tCommon.showToast('你取消了执行'); + //console.hide();(); + System.exit(); +} +accounts = accounts.split("\n"); + +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); +tCommon.openApp();//兜底,防止跑到外面去了 + +while (true) { + task.log(); + try { + //开启线程 自动关闭弹窗 + if (task.run(accounts, storage.get('task_dy_toker_uid_interval', 'int'), storage.getArray('task_dy_toker_uid_op'))) { + FloatDialogs.show('提示', '执行完成'); + break; + } + tCommon.sleep(3000); + } catch (e) { + Log.log(e); + try { + tCommon.showToast("遇到错误,即将自动重启"); + tCommon.sleep(3000); + } catch (e) { + Log.log('启停bug', e); + } + } +} + +try { + Engines.closeAll(); +} catch (e) { + Log.log('停止脚本'); +} diff --git a/tasks/task_dy_toker_video.js b/tasks/task_dy_toker_video.js new file mode 100644 index 0000000..325cde1 --- /dev/null +++ b/tasks/task_dy_toker_video.js @@ -0,0 +1,209 @@ +let tCommon = require("app/dy/Common"); +let DyUser = require("app/dy/User"); +let DySearch = require("app/dy/Search"); +let DyVideo = require("app/dy/Video"); +let DyComment = require("app/dy/Comment"); +let storage = require("common/storage"); +let machine = require("common/machine"); +let baiduWenxin = require("service/baiduWenxin"); +let statistics = require("common/statistics"); + +let task = { + nicknames: [], + contents: [], + run(input, sleepSecond) { + return this.testTask(input, sleepSecond); + }, + + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + return machine.getMsg(type) || false;//永远不会结束 + }, + + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-comment-" + file + ".txt"; + Log.setFile(allFile); + }, + + includesKw(str, kw) { + for (let i in kw) { + if (str.includes(kw[i])) { + return true; + } + } + return false; + }, + + testTask(input, sleepSecond) { + //首先进入页面 + let commentKw = tCommon.splitKeyword(input); + Log.log('评论关键词:', commentKw); + DySearch.intoSearchVideo(); + + let rateCount = storage.get('task_dy_toker_live_video_zan_head_rate', 'int') + storage.get('task_dy_toker_live_video_focus_rate', 'int') + storage.get('task_dy_toker_live_video_zan_comment_rate', 'int'); + let zanHeadRate = 0; + let zanCommentRate = 0; + let focuRate = 0; + if (rateCount > 0) { + zanHeadRate = storage.get('task_dy_toker_live_video_zan_head_rate', 'int') / rateCount; + zanCommentRate = storage.get('task_dy_toker_live_video_zan_comment_rate', 'int') / rateCount; + focuRate = storage.get('task_dy_toker_live_video_focus_rate', 'int') / rateCount; + } + Log.log('总的点赞:', rateCount, zanCommentRate, zanHeadRate, focuRate); + + while (true) { + tCommon.sleep(4000 + Math.random() * 2000); + let title = DyVideo.getContent(); + let commentCount = DyVideo.getCommentCount(); + statistics.viewVideo(); + if (commentCount === 0 || this.contents.includes(title)) { + Log.log('下一个视频'); + DyVideo.next(); + continue; + } + + statistics.viewTargetVideo(); + DyVideo.openComment(commentCount); + tCommon.sleep(2000 + 1000 * Math.random()); + + let rp = 0; + let lastComment = []; + let firstComment = true; + while (true) { + let comments = DyComment.getList(); + if (comments.length == 0) { + tCommon.back(); + tCommon.sleep(1000); + Log.log('没有评论内容'); + break; + } + + if (lastComment.length == 2 && lastComment[0] == lastComment[1]) { + rp++; + } else { + rp = 0; + } + + lastComment.push(comments[0].nickname + ':' + comments[0].content); + if (lastComment.length > 2) { + lastComment.shift(); + } + + if (rp >= 3) { + tCommon.back(); + tCommon.sleep(1000); + Log.log('评论扫描完了'); + break; + } + + for (let k in comments) { + if (firstComment && Math.random() * 100 <= storage.get('task_dy_toker_live_video_comment_first_comment_rate', 'int')) { + DyComment.backMsg(comments[k], this.getMsg(0, comments[k].content).msg); + Log.log('首评'); + tCommon.sleep(1000); + comments = DyComment.getList(); + firstComment = false; + continue; + } + firstComment = false; + Log.log('comments[k]', comments[k]); + if (!comments[k]) { + continue; + } + + if (comments[k]['content'] == "" || !this.includesKw(comments[k]['content'], commentKw) || this.nicknames.includes(comments[k].nickname)) { + Log.log('数据:', comments[k]['content'], !this.includesKw(comments[k]['content'], commentKw), this.nicknames.includes(comments[k].nickname)); + continue; + } + + if (machine.get('task_dy_toker_video_' + comments[k].nickname, 'bool')) { + Log.log('重复'); + continue; + } + + Log.log('找到了关键词', comments[k]['content']); + let opRate = Math.random(); + if (opRate <= zanHeadRate) { + DyComment.intoUserPage(comments[k]); + if (DyUser.isPrivate()) { + tCommon.back(); + } else { + DyUser.zanHead(); + tCommon.sleep(1000 + 1000 * Math.random()); + tCommon.back(); + } + } else if (opRate <= zanHeadRate + zanCommentRate) { + try { + Log.log('点赞'); + if (!DyComment.isZan()) { + DyComment.clickZan(comments[k]); + tCommon.sleep(1000 + 1000 * Math.random()); + } + } catch (e) { + Log.log('异常处理:', e); + continue; + } + } else { + DyComment.intoUserPage(comments[k]); + if (DyUser.isPrivate()) { + tCommon.back(); + } else { + DyUser.focus(); + Log.log('关注'); + tCommon.sleep(1000 + 1000 * Math.random()); + tCommon.back(); + } + } + + this.nicknames.push(comments[k].nickname); + machine.set('task_dy_toker_video_' + comments[k].nickname, true); + tCommon.sleep(sleepSecond * 1000); + } + + Log.log('下一页评论'); + tCommon.swipeCommentListOp(); + tCommon.sleep(1500 + 500 * Math.random()); + } + Log.log('下一个视频'); + this.contents.push(title); + DyVideo.next(); + } + }, +} + +let input = machine.get('task_dy_toker_live_video_comment_keyword'); +Log.log("input内容:" + machine.get('task_dy_toker_live_video_comment_keyword', 'string')); +if (!input) { + System.toast('请输入评论关键词'); + System.exit(); +} + +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); + +while (true) { + task.log(); + try { + let r = task.run(input, storage.get('task_dy_toker_live_video_second', 'int')); + if (r === 'exit') { + if (thr) { + tCommon.sleep(3000); + FloatDialogs.show('找不到用户,停止执行'); + } + break; + } + + if (r) { + throw new Error('一个任务完成,重启,进入新的账号'); + } + + tCommon.sleep(3000); + } catch (e) { + Log.log(e); + tCommon.closeAlert(1); + } +} \ No newline at end of file diff --git a/tasks/task_dy_zan_back.js b/tasks/task_dy_zan_back.js new file mode 100644 index 0000000..2e7136c --- /dev/null +++ b/tasks/task_dy_zan_back.js @@ -0,0 +1,231 @@ +let tCommon = require('app/dy/Common.js'); +let DyUser = require('app/dy/User.js'); +let DyVideo = require('app/dy/Video.js'); +let storage = require('common/storage.js'); +let machine = require('common/machine.js'); +let baiduWenxin = require('service/baiduWenxin.js'); +let statistics = require('common/statistics'); +let V = require("version/V.js"); + +// let dy = require('app/iDy'); +// let config = require('config/config'); + +/** + * 赞回访 + */ + +let videoCount = 500; + +let task = { + contents: [], + run() { + return this.testTask(); + }, + + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-dy-zan-back-" + file + ".txt"; + Log.setFile(allFile); + }, + + //type 0 评论,1私信 + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + return machine.getMsg(type) || false;//永远不会结束 + }, + + getConfig() { + return { + runTimes: machine.get('task_dy_zan_back_run_count', 'int'),//运行次数 + intevalSecond: machine.get('task_dy_zan_back_interval', 'int'),//操作间隔 + homeWait: machine.get('task_dy_zan_back_home_wait', 'int') || 5,//主页停留时间 + workWait: machine.get('task_dy_zan_back_work_wait', 'int') || 5,//作品停留时间 + fansMin: machine.get('task_dy_zan_back_min_fans', 'int') || 0, //最小粉丝数 + fansMax: machine.get('task_dy_zan_back_max_fans', 'int') || 1000000000,//最大粉丝数 + workMin: machine.get('task_dy_zan_back_min_work', 'int') || 1,//最小作品数 + op: machine.getArray('task_dy_zan_back_op'), // "0","1","2" 分别是 关注、私信、点赞 + } + }, + + testTask() { + //查看是不是进入了指定页面,是的话才开始运行 + let config = this.getConfig(); + Log.log("配置信息:", config); + tCommon.id(V.C.userListTop).isVisibleToUser(true).waitFindOne(); + + let arr = [];//存储最新的20个 + let count = 0; + let repeatCount = 0; + let errorCount = 0; + let errorContainsCount = 0; + + while (true) { + try { + tCommon.sleep(3000); + System.toast('开始执行,剩余数量:' + (config.runTimes - count)); + let contains = tCommon.id(V.Comment.getList[0]).isVisibleToUser(true).find(); + Log.log("找到的内容数量:", contains.length); + if (contains.length == 0) { + if (errorContainsCount++ >= 3) { + throw new Error("3次找不到container内容"); + } + continue; + } + errorContainsCount = 0; + + for (let i in contains) { + tCommon.sleep(config.intevalSecond * 1000); + let nicknameTag = contains[i].children().findOne(tCommon.id(V.Video.zanList[0]).isVisibleToUser(true)); + Log.log(nicknameTag); + if (!nicknameTag) { + System.generateWindowElements(); + Log.log('找不到昵称标签', contains[i]); + if (errorCount++ > 3) { + errorCount = 0; + throw new Error("3次找不到昵称"); + } + continue; + } + errorCount = 0; + + tCommon.click(nicknameTag); + tCommon.sleep(2000); + statistics.viewUser(); + let nickname = nicknameTag.text(); + count++; + Log.log('操作次数:' + count + "/" + config.runTimes); + if (count >= config.runTimes) { + System.toast('运行次数达到了'); + return true; + } + + if (DyUser.isPrivate()) { + tCommon.back(); + System.toast('私密账号'); + continue; + } + + let account = DyUser.getDouyin(); + if (machine.get("task_dy_zan_back_" + account, 'bool')) { + tCommon.back(); + System.toast('已经操作过了'); + continue; + } + + Log.log("抖音号:", account); + machine.set("task_dy_zan_back_" + account, true); + if (arr.indexOf(account) != -1) { + repeatCount++; + if (repeatCount >= 2) { + System.toast('运行结束'); + return true; + } + tCommon.back(); + continue; + } else { + repeatCount = 0; + } + + arr.push(account); + + let fansCount = DyUser.getFansCount(); + Log.log("粉丝数量:", fansCount); + if (fansCount < config.fansMin || fansCount > config.fansMax) { + tCommon.back(); + System.toast('粉丝数不符合要求'); + continue; + } + + let workCount = DyUser.getWorksCount(); + Log.log("作品数量:", workCount); + if (workCount < config.workMin) { + tCommon.back(); + System.toast('作品数不符合要求'); + continue; + } + + if (config.op.includes("2") && DyVideo.intoUserVideo()) { + Log.log("执行进入视频"); + tCommon.sleep(config.workWait * 1000); + if (DyVideo.isZan()) { + System.toast('已经点赞了'); + } else { + DyVideo.clickZan(); + tCommon.sleep(1000 + 1000 * Math.random()); + } + tCommon.back(); + } + + //查看是否关注 + if (config.op.includes("0")) { + Log.log("执行关注"); + if (DyUser.isFocus()) { + System.toast('已关注,不操作'); + } else { + DyUser.focus(); + tCommon.sleep(1000 + Math.random() * 1000); + } + } + + if (config.op.includes("1")) { + Log.log("执行私信"); + DyUser.privateMsg(this.getMsg(1, nickname).msg); + } + + tCommon.sleep(config.homeWait * 1000);//主页停留 + tCommon.swipe(0, 0.5); + tCommon.sleep(500); + if (tCommon.id(V.Comment.getList[0]).isVisibleToUser(true).findOne()) { + Log.log('在列表页面了'); + } else { + tCommon.back();//返回 + } + } + + tCommon.sleep(1000); + Log.log("执行滑动"); + task.swipe(); + System.cleanUp(); + } catch (e) { + Log.log(e); + if (!tCommon.id(V.Comment.getList[0]).isVisibleToUser(true).findOne()) { + Log.log("找不到标签,返回了"); + tCommon.back(); + tCommon.sleep(2000); + } else { + Log.log('滑动一下,解决问题'); + task.swipe(); + } + } + } + }, + + swipe() { + let scrolls = tCommon.id(V.Common.swipeCommentListOp[0]).scrollable(true).find(); + for (let i in scrolls) { + scrolls[i].scrollForward(); + } + } +} + +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); + +while (true) { + task.log(); + try { + let res = task.run(); + if (res) { + tCommon.sleep(3000); + FloatDialogs.show('提示', '已完成'); + break; + } + + tCommon.sleep(3000); + } catch (e) { + Log.log(e); + } +} diff --git a/tasks/task_xhs_fans.js b/tasks/task_xhs_fans.js new file mode 100644 index 0000000..0d509f8 --- /dev/null +++ b/tasks/task_xhs_fans.js @@ -0,0 +1,215 @@ +let storage = require("common/storage.js"); +let machine = require("common/machine.js"); +let Common = require("app/xhs/Common.js"); +let V = require("version/XhsV.js"); +let User = require("app/xhs/User.js"); +let Work = require("app/xhs/Work.js"); +let baiduWenxin = require('service/baiduWenxin.js'); + +let task = { + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-xhs-fans-" + file + ".txt"; + Log.setFile(allFile); + }, + + //type 0 评论,1私信 + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + + //return { msg: ['厉害', '六六六', '666', '拍得很好', '不错哦', '关注你很久了', '学习了', '景色不错', '真的很不错', '太厉害了', '深表认同', '来过了', '茫茫人海遇见你', '太不容易了', '很好', '懂了', '我看到了', '可以的', '一起加油', '真好', '我的个乖乖'][Math.round(Math.random() * 20)] }; + return machine.getMsg(type) || false;//永远不会结束 + }, + + run() { + let config = { + runCount: storage.get('task_xhs_fans_run_count', 'int'), + interval: storage.get('task_xhs_fans_interval', 'int') * 1000, + homeWait: storage.get('task_xhs_fans_home_wait', 'int') * 1000, + workWait: storage.get('task_xhs_fans_work_wait', 'int') * 1000, + minFans: storage.get('task_xhs_fans_min_fans', 'int'), + maxFans: storage.get('task_xhs_fans_max_fans', 'int'), + minWork: storage.get('task_xhs_fans_min_work', 'int'), + op: storage.getArray('task_xhs_fans_op'),//0关注,1私信,2首作品点赞 + } + + Log.log('config', config); + this.log(); + this.tokerFans(config); + }, + + tokerFans(config) { + Common.id(V.User.fans[0]).descContains(V.User.fans[1]).isVisibleToUser(true).waitFindOne();//粉丝或者关注界面 + let nicknameErrorCount = 0; + + let selectedTag = Common.id(V.User.fans[0]).isVisibleToUser(true).descContains(V.User.fans[4]).findOne(); + Log.log("选择的内容", selectedTag); + + let selectText = selectedTag.desc().replace(V.User.fans[4], '');//根据内容 【关注、粉丝、推荐】选择对应的滑动 + let arr = []; + let stopMarkCount = 0; + Log.log('总数量:' + config.runCount); + let showAll = false;//还没有点击 “查看全部” + let minTop = selectedTag.bounds().top + selectedTag.bounds().height(); + Log.log('最低top是:', minTop); + let containsCountError = 0; + + while (true) { + try { + let contains = Common.id(V.User.fans[5]).isVisibleToUser(true).find(); + Log.log('容器数量:' + contains.length); + if (contains.length === 0) { + if (containsCountError++ >= 3) { + throw new Error('3次容器数量为0'); + } + } + + containsCountError = 0; + for (let i in contains) { + let nicknameTag = contains[i].children().findOne(Common.id(V.User.fans[6]).filter(v => { + return v && v.bounds() && v.bounds().height() > 0 && v.bounds().top >= minTop; + })); + if (!nicknameTag) { + Log.log("找不到昵称", contains[i]); + if (nicknameErrorCount++ >= 3) { + return true;//完成 + } + continue; + } + + nicknameErrorCount = 0; + let nickname = nicknameTag.text(); + Log.log('开始操作昵称', nickname, nicknameTag); + if (arr.indexOf(nickname) != -1) { + Log.log('重复昵称', nickname); + if (stopMarkCount++ >= 3) { + return true; + } + continue; + } + + arr.push(nickname); + if (arr.length >= 20) { + arr.shift(); + } + + //作品数和粉丝数,仅仅针对“粉丝列表” + if (selectText == V.User.fans[2]) { + let countTag = contains[i].children().findOne(Common.id(V.User.fans[8])); + let workCount = User.getListWorkCount(countTag); + if (workCount < config.minWork) { + Log.log('作品数量不合格:', workCount, config.minWork); + continue; + } + + let fansCount = User.getListFansCount(countTag); + if (fansCount < config.minFans || fansCount > config.maxFans) { + Log.log('粉丝数量不合格:', fansCount, config.minFans, config.maxFans); + continue; + } + } + + Common.click(nicknameTag); + Common.sleep(2000 + 1000 * Math.random());//进入了主页 + let fansCount = User.getFansCount(); + if (fansCount < config.minFans || fansCount > config.maxFans) { + Log.log('作品:数量不合格:', fansCount, config.minFans, config.maxFans); + Common.back(); + continue; + } + + //首先进入视频,不管是关注,私信,还是首作品点赞; 进入视频主要是为了防止风控 + + if (User.intoVideo()) { + //有视频 进入了视频 假装休眠 + Common.sleep(config.workWait * 0.7); + Common.swipe(0, 0.5); + + //是否点赞 + if (config.op.indexOf('2') != -1) { + Log.log('点赞了'); + Work.zan(); + } + + Common.sleep(config.workWait * 0.3); + Common.back();//有时候会出现不能返回的情况,小红薯的设计bug 比如点击关注之后,出现了 “关注他的人也关注了”的列表,返回之后,只是关闭了这个,而没有真正返回 + Common.sleep(1000 + 1000 * Math.random()); + Log.log('从视频页面返回到主页'); + } + + //这里防止视频页面没有进去,但是已经返回到了列表页 + if (!Common.id(V.User.nickname[0]).findOne()) { + continue; + } + + //正常情况下,在用户页,进行返回操作 + Common.sleep(config.homeWait * 0.8); + + if (config.op.indexOf('0') != -1) { + Log.log('准备关注'); + User.focus(); + Common.sleep(1500 + 1000 * Math.random()); + } + + if (config.op.indexOf('1') != -1) { + let ttt = this.getMsg(1, nickname); + let msg = ttt ? ttt.msg : ''; + Log.log('准备私信', msg); + User.privateMsg(msg); + Common.sleep(1500 + 1000 * Math.random()); + } + + Log.log('剩余数量:' + config.runCount); + + if (config.runCount-- <= 0) { + return true; + } + + Common.sleep((config.interval || 1000) * 0.8); + Common.swipe(0, 0.2); + Common.sleep((config.interval || 1000) * 0.2);//假装滑动 + Common.back(); + Common.sleep(500); + + if (Common.id(V.User.nickname[0]).findOne()) { + Common.back();//有时候会出现不能返回的情况,小红薯的设计bug + } + Log.log('返回到了主界面'); + } + + if (!showAll) { + let showAllTag = Common.id(V.User.showAllFans[0]).textContains(V.User.showAllFans[1]).isVisibleToUser(true).findOne(); + if (showAllTag) { + Log.log('点击“查看全部”'); + Common.click(showAllTag); + Common.sleep(2000 + 1000 * Math.random()); + showAll = true; + } + } + + let likeTag = Common.id(V.Work.like[0]).textContains(V.Work.like[1]).isVisibleToUser(true).findOne(); + if (likeTag) { + return true;//操作完成了,下面都是“你可能感兴趣的人” + } + + User.swipeFans(selectText); + Common.sleep(1000 + 1000 * Math.random()); + } catch (e) { + Log.log('异常了~', e); + if (Common.id(V.User.fans[0]).descContains(V.User.fans[1]).isVisibleToUser(true).findOne()) { + User.swipeFans(selectText); + } else { + Common.back(); + } + Common.sleep(1000 + 1000 * Math.random()); + } + } + } +} + +if (task.run()) { + FloatDialogs.show('提示', '已完成'); +} diff --git a/tasks/task_xhs_toker.js b/tasks/task_xhs_toker.js new file mode 100644 index 0000000..b7d4695 --- /dev/null +++ b/tasks/task_xhs_toker.js @@ -0,0 +1,34 @@ +let storage = require("common/storage.js"); +let machine = require("common/machine.js"); +let Common = require("app/xhs/Common.js"); +let xhs = require("app/xhs/xhs.js"); +let baiduWenxin = require('service/baiduWenxin.js'); + +let task = { + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-xhs-toker-" + file + ".txt"; + Log.setFile(allFile); + }, + + //type 0 评论,1私信 + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + + //return { msg: ['厉害', '六六六', '666', '拍得很好', '不错哦', '关注你很久了', '学习了', '景色不错', '真的很不错', '太厉害了', '深表认同', '来过了', '茫茫人海遇见你', '太不容易了', '很好', '懂了', '我看到了', '可以的', '一起加油', '真好', '我的个乖乖'][Math.round(Math.random() * 20)] }; + return machine.getMsg(type) || false;//永远不会结束 + }, + + run() { + this.log(); + Common.openApp(); + xhs.run(this.getMsg); + } +} + +if (task.run()) { + FloatDialogs.show('提示', '已完成'); +} diff --git a/tasks/task_xhs_toker_uid.js b/tasks/task_xhs_toker_uid.js new file mode 100644 index 0000000..76abcb4 --- /dev/null +++ b/tasks/task_xhs_toker_uid.js @@ -0,0 +1,106 @@ +let tCommon = require("app/xhs/Common"); +const DyUser = require('app/xhs/User.js'); +let storage = require("common/storage"); +let machine = require("common/machine"); + +let task = { + index: 0, + run(accounts, second, ops) { + return this.testTask(accounts, second, ops); + }, + + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-xhs-toker-uid-" + file + ".txt"; + Log.setFile(allFile); + }, + + //type 0 评论,1私信 + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + + //return { msg: ['厉害', '六六六', '666', '拍得很好', '不错哦', '关注你很久了', '学习了', '景色不错', '真的很不错', '太厉害了', '深表认同', '来过了', '茫茫人海遇见你', '太不容易了', '很好', '懂了', '我看到了', '可以的', '一起加油', '真好', '我的个乖乖'][Math.round(Math.random() * 20)] }; + return machine.getMsg(type) || false;//永远不会结束 + }, + + testTask(accounts, second, ops) { + //首先进入点赞页面 + Log.log('账号:', accounts, ops); + for (let i in accounts) { + if (i < this.index) { + continue; + } + + try { + //进入用户主页,私信,关注 + App.gotoIntent('xhsdiscover://user/' + accounts[i]);//5f12d8cf0000000001004c15 + tCommon.sleep(5000 + 3000 * Math.random()); + if (ops.includes("1")) { + Log.log('私信'); + DyUser.privateMsg(this.getMsg(1).msg); + tCommon.sleep(500 + 1000 * Math.random()); + } + + if (ops.includes("0")) { + Log.log('关注'); + DyUser.focus(); + } + } catch (e) { + Log.log(e); + } + + this.index++; + let s = (second / 2 + second / 2 * Math.random()); + Log.log('休眠' + s + '秒') + tCommon.sleep(s * 1000); + tCommon.backHomeOnly(); + tCommon.sleep(2000 * Math.random() + 500); + } + + if (this.index >= accounts.length) { + return true; + } + }, +} + +let accounts = storage.get('task_xhs_toker_uid_account'); +Log.log('accounts', accounts); +if (!accounts) { + tCommon.showToast('你取消了执行'); + //console.hide();(); + System.exit(); +} +accounts = accounts.split("\n"); + +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); +tCommon.openApp();//兜底,防止跑到外面去了 + +while (true) { + task.log(); + try { + //开启线程 自动关闭弹窗 + if (task.run(accounts, storage.get('task_xhs_toker_uid_interval', 'int'), storage.getArray('task_xhs_toker_uid_op'))) { + FloatDialogs.show('提示', '执行完成'); + break; + } + tCommon.sleep(3000); + } catch (e) { + Log.log(e); + try { + tCommon.showToast("遇到错误,即将自动重启"); + tCommon.sleep(3000); + } catch (e) { + Log.log('启停bug', e); + } + } +} + +try { + Engines.closeAll(); +} catch (e) { + Log.log('停止脚本'); +} diff --git a/tasks/task_xhs_yanghao.js b/tasks/task_xhs_yanghao.js new file mode 100644 index 0000000..d3cd1d6 --- /dev/null +++ b/tasks/task_xhs_yanghao.js @@ -0,0 +1,160 @@ +let tCommon = require("app/xhs/Common"); +let DyIndex = require('app/xhs/Index.js'); +let DySearch = require('app/xhs/Search.js'); +let Work = require('app/xhs/Work.js'); +let storage = require("common/storage"); +let machine = require("common/machine"); +let baiduWenxin = require("service/baiduWenxin"); +let statistics = require("common/statistics"); +let V = require("version/XhsV.js"); + +let task = { + contents: [], + count: storage.get('task_xhs_yanghao_count', 'int'), + zanRate: storage.get('task_xhs_yanghao_zan_rate', 'int'), + commentRate: storage.get('task_xhs_yanghao_comment_rate', 'int'), + collectRate: storage.get('task_xhs_yanghao_collect_rate', 'int'), + run(keyword) { + return this.testTask(keyword); + }, + + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-search-vertical-" + file + ".txt"; + Log.setFile(allFile); + }, + + //type 0 评论,1私信 + getMsg(type, title, age, gender) { + if (storage.getMachineType() === 1) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + return machine.getMsg(type) || false;//永远不会结束 + } + }, + + testTask(keyword) { + //首先进入点赞页面 + DyIndex.intoIndex(); + DyIndex.intoSearchPage(); + DySearch.intoSearchList(keyword); + tCommon.sleep(4000 + 2000 * Math.random()); + + let topTag = tCommon.id(V.Search.searchTop).isVisibleToUser(true).findOne(); + let top = topTag ? topTag.bounds().top + topTag.bounds().height() : 210; + let interval = storage.get('task_xhs_yanghao_interval', 'int'); + while (true) { + let tags = DySearch.getList(); + for (let i in tags) { + try { + let text = tags[i].text(); + if (this.contents.includes(text)) { + continue; + } + + if (machine.get('task_xhs_yanghao_' + text, 'bool')) { + Log.log('重复视频'); + continue; + } + + tCommon.clickRange(tags[i], top, Device.height()); + tCommon.sleep(3000 + 2000 * Math.random()); + + let title = Work.getContent(); + Log.log('title:' + title); + //let nickname = Work.getNickname(); + statistics.viewVideo(); + statistics.viewTargetVideo(); + + let sleepSec = (interval / 2 + interval / 2 * Math.random()) * 1000; + Log.log('休眠' + sleepSec + 'ms'); + tCommon.sleep(sleepSec);//最后减去视频加载时间 和查询元素的时间 + + if (this.count-- <= 0) { + return true; + } + Log.log('剩余多少个:' + this.count); + + if (Math.random() * 100 <= task.commentRate) { + Work.msg(Work.getType(), this.getMsg(0, title).msg); + tCommon.sleep(2000 + 1000 * Math.random()); + } + + if (Math.random() * 100 <= task.zanRate) { + Log.log('点赞'); + Work.zan(); + tCommon.sleep(2000 + 1000 * Math.random()); + } + + if (Math.random() * 100 <= task.collectRate) { + Log.log('收藏'); + Work.collect(); + tCommon.sleep(2000 + 1000 * Math.random()); + } + + machine.set('task_xhs_yanghao_' + text, true); + this.contents.push(text); + if (!tCommon.id(V.Search.searchTop).isVisibleToUser(true).findOne()) { + tCommon.back(); + } + tCommon.sleep(1000 + 500 * Math.random()); + } catch (e) { + //判断是否在日记页面 + if (Work.getType() != -1) { + tCommon.back(); + tCommon.sleep(1000); + } + Log.log('错误:' + e); + } + } + + Log.log('开始滑动'); + tCommon.swipeWorkOp(); + tCommon.sleep(3000 + 2000 * Math.random()); + } + }, +} + +let keyword = storage.get('task_xhs_yanghao_keyword'); +if (!keyword) { + tCommon.showToast('请设置关键词'); + //console.hide();(); + System.exit(); +} + +task.count = storage.get('task_xhs_yanghao_count', 'int'); +if (!task.count) { + tCommon.showToast('请设置刷视频数量'); + //console.hide();(); + System.exit(); +} + +tCommon.openApp(); +//开启线程 自动关闭弹窗 +Engines.executeScript("unit/dialogClose.js"); + +while (true) { + task.log(); + try { + let res = task.run(keyword); + if (res) { + tCommon.sleep(3000); + FloatDialogs.show('提示', '已完成'); + break; + } + + if (res === false) { + tCommon.sleep(3000); + FloatDialogs.show('提示', '已完成'); + break; + } + + tCommon.sleep(3000); + } catch (e) { + Log.log(e); + tCommon.closeAlert(1); + tCommon.backHome(); + } +} diff --git a/tasks/task_xhs_zan_back.js b/tasks/task_xhs_zan_back.js new file mode 100644 index 0000000..0061c35 --- /dev/null +++ b/tasks/task_xhs_zan_back.js @@ -0,0 +1,141 @@ +let storage = require("common/storage.js"); +let Common = require("app/xhs/Common.js"); +let User = require("app/xhs/User.js"); +let V = require("version/XhsV.js"); + +let Work = require("app/xhs/Work.js"); + +let task = { + log() { + let d = new Date(); + let file = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); + let allFile = "log/log-xhs-zan-back-" + file + ".txt"; + Log.setFile(allFile); + }, + + //type 0 评论,1私信 + getMsg(type, title, age, gender) { + if (storage.get('setting_baidu_wenxin_switch', 'bool')) { + return { msg: type === 1 ? baiduWenxin.getChat(title, age, gender) : baiduWenxin.getComment(title) }; + } + + //return { msg: ['厉害', '六六六', '666', '拍得很好', '不错哦', '关注你很久了', '学习了', '景色不错', '真的很不错', '太厉害了', '深表认同', '来过了', '茫茫人海遇见你', '太不容易了', '很好', '懂了', '我看到了', '可以的', '一起加油', '真好', '我的个乖乖'][Math.round(Math.random() * 20)] }; + return machine.getMsg(type) || false;//永远不会结束 + }, + + run() { + let config = { + runCount: storage.get('task_xhs_zan_back_run_count', 'int'), + interval: 5 * 1000, + homeWait: 5 * 1000, + workWait: 5 * 1000 + } + + return this.zanBack(config); + }, + + zanBack(config) { + Log.log('开始'); + Log.log(Common.id(V.Work.zanCollectionHead[0]).descContains(V.Work.zanCollectionHead[1]).findOne()); + Common.id(V.Work.zanCollectionHead[0]).descContains(V.Work.zanCollectionHead[1]).isVisibleToUser(true).waitFindOne(); + Log.log('进入'); + + let noNicknameTagCount = 0; + let arr = []; + let repeatNicknameCount = 0; + Log.log('操作总次数:' + config.runCount); + + while (true) { + try { + let containers = Common.id(V.Work.zanUserList[0]).findOne().children().find(Common.id(V.Work.zanUserList[2]).isVisibleToUser(true));//获取列表外层 + for (let i in containers) { + let nicknameTag = containers[i]; + if (!nicknameTag) { + if (noNicknameTagCount++ >= 3) { + throw new Error('3次找不到昵称'); + } + } + + let nickname = nicknameTag.text(); + Log.log('准备操作昵称:' + nickname); + + if (arr.indexOf(nickname) != -1) { + if (repeatNicknameCount++ >= 3) { + Log.log('重复3次,都是同一个昵称'); + return true;//完成了 + } + continue; + } + + repeatNicknameCount = 0; + arr.push(nickname); + if (arr.length >= 20) { + arr.shift(); + } + + try { + if (containers[i].parent().children().findOne(Common.id(V.Work.zanUserList[3])).text() == V.Work.zanUserList[4]) { + continue; + } + } catch (e) { + Log.log('作者判断'); + } + + Common.click(nicknameTag); + Common.sleep(2000 + 2000 * Math.random()); + + Log.log('即将进入视频'); + let intoVideo = false; + if (User.intoVideo()) { + Log.log('进入视频'); + Common.sleep(config.workWait * 0.9); + Work.zan(); + if (config.runCount-- <= 0) { + Log.log('剩余数量:' + config.runCount); + return true; + } + + intoVideo = true; + Common.sleep(config.workWait * 0.1); + Common.back(); + } + + //判断是否在用户页面 有作品的才操作,没有作品 + if (intoVideo) { + if (Common.id(V.User.account[0]).findOne()) { + Common.sleep(config.homeWait * 0.8); + Common.swipe(0, 0.5); + Common.sleep(config.homeWait * 0.2); + Common.back(); + Log.log('返回列表'); + } else { + Log.log('问题'); + //可能是列表页面 不做任何返回操作 + } + } else { + Common.sleep(config.homeWait * 0.2); + Common.back(); + } + + Common.sleep(config.interval); + } + + Work.zanUserListSwipe(); + } catch (e) { + let a = Common.id(V.Work.zanCollectionHead[0]).descContains(V.Work.zanCollectionHead[1]).findOne(); + if (a) { + Log.log(a); + Work.zanUserListSwipe(); + } else { + Log.log('其他页面,返回'); + Common.back();//其他页面,则返回 + } + Log.log('异常了~', e); + } + } + } +} + +if (task.run()) { + FloatDialogs.show('提示', '已完成'); +} diff --git a/tasks/tool.js b/tasks/tool.js index 4c98433..c65c1ca 100644 --- a/tasks/tool.js +++ b/tasks/tool.js @@ -1 +1,5 @@ -FloatDialogs.show('功能开发中···'); \ No newline at end of file +//import { Common } from "app/dy/Common.js" + + +console.log('哈哈哈'); +console.log(UiSelector()); diff --git a/test.js b/test.js new file mode 100644 index 0000000..5a112ff --- /dev/null +++ b/test.js @@ -0,0 +1,288 @@ +const Common = { + //封装的方法 + logs: [], + id(name) { + return id('com.ss.android.ugc.aweme:id/' + name); + }, + aId(name) { + //android:id/text1 + return id('android:id/' + name); + }, +} + +// let tjTag = DyCommon.id('yic').text('推荐').findOne().parent(); +// if (tjTag && tjTag.desc().indexOf("已选中") != -1) { +// console.log('32423423432'); +// } + + +// let tag = descMatches(/自定义表情[\\s\\S]+/).findOne().parent(); +// console.log(tag); + +// let tagParent = desc('表情').clickable(true).findOne(); + +// if (tagParent) { +// let imgTag = tagParent.parent(); +// console.log(imgTag); +// } + +// let tag = Common.id('o-8').findOne(); +// console.log(tag); +// let img = tag.children().findOne(desc('表情')); + +// img.click(); + +// let submitTag = Common.id('dj2').findOne(); + +// console.log(submitTag); +// console.log(submitTag.click()); + + + +// let header = Common.id('pgn').findOne(); + +// console.log(header.parent()); + +// console.log(desc('取消').find()); +// console.log(desc('关闭').find()); + +//console.log(Common.id('pgx').findOne().children()); +// console.log(Common.id('title_bar').findOne()); + +// console.log(Common.id('vq7').findOne()); + +// console.log(Common.id('u+m').findOne()); + + +// let a = scrollable(true).find(); +// console.log(a); +// console.log(a.scrollForward()); + + +// console.log(Common.id('wl0').find()); + + + +// console.log(textContains('59').findOne()); +// console.log(descContains('59').findOne()); + + +// console.log(Common.id('content').find()); +// console.log(Common.id('tv_name').find()); + +// console.log(textContains("作品").findOne()); + +// console.log(Common.id('wk5').findOne()); + +// console.log(descContains('表情').findOne().parent()); + +// let a = Common.id('i7r').findOne().children().findOne(descContains('表情')); +// console.log(a); + + +// console.log(descContains('自定义表情').find()); + +// let tag = textContains("中国").filter((v) => { +// return v && v._id == null; +// }).findOnce().parent().children().findOne(textContains("直播")); + +// console.log(tag); + +// let tags = Common.id("_a").findOnce().children().find(textMatches(/[\s\S]+/)).filter((v) => { +// return v && !v.text().includes('我的信息') && v.bounds().top > 0 && v.bounds().top + v.bounds().height() < device.height - 300 && v.bounds().left < 10 && v.bounds().width() >= device.width - 10; +// }); + +// console.log(tags); + + +// let swipeSearchUserOpTarge = Common.id("syq").scrollable(true).filter((v) => { +// return v && v.bounds() && v.bounds().top > 0 && v.bounds().left >= 0 && v.bounds().width() == device.width && v.bounds().top >= 0; +// }).findOnce(); + +// if (swipeSearchUserOpTarge) { +// swipeSearchUserOpTarge.scrollForward(); +// } else { +// console.log('滑动失败'); +// } + +// console.log(Common.id('syq').scrollable(true).find()); + +// console.log(Common.id('desc').find()); + +// console.log(textContains('大品牌').find()); + +// console.log(Common.id('ero').findOne()); + +// let a = scrollable(true).find(); + +// console.log(a); + +// Common.id('rw3').findOne().scrollForward(); + +// console.log(descContains('点击进入直播间').find()); + +// let container = descContains('美女').findOne(); +// console.log(container); + +// console.log(text("取消关注").findOne()); + +// let tags = Common.id('p=u').findOnce().children().find(textMatches("[\\s\\S]+")); + +// log(tags); + + +// console.log(textContains('直播按钮').findOne().parent().children()); + + +// let tag = textContains('zhang').textContains('抖音号').filter((v) => { +// return v && v._id == null && v.bounds().left > 0;; +// }).findOnce().parent().children().findOne(textContains('直播').filter((v) => { +// return v && v.bounds() && v.bounds().width() < device.width();//过滤其他,应该能获取当前的头像 +// })); + +// log(tag); + +// let tags = Common.aId("text1").textContains("作品").findOne();//rj5 或者 ptm +// console.log(tags); + + +// let containers = className('android.widget.FrameLayout').focusable(true).filter((v) => { +// return v && v.bounds() && v.bounds().left === 0 && v.bounds().top > 400 && v.bounds().top + v.bounds().height() < device.height && !!v.children() && !!v.children().findOne(textContains('粉丝')); +// }).find(); + +// for (let i in containers) { +// if (isNaN(i)) { +// continue; +// } +// let titleTag = containers[i].children().findOne(textContains('粉丝')); +// console.log(titleTag); +// } + +// sleep(5000); +// let douyin = textContains("抖音").findOnce(); +// if (douyin && douyin.text()) { +// console.log(douyin.text()); +// } + + + +// console.log(Common.id('rw3').scrollable(true).find()); + +// console.log(Common.id('rw3').scrollable(true).find()[0].scrollForward()); +// console.log(Common.id('rw3').scrollable(true).find()[1].scrollForward()); + +// console.log(textContains('有限公司').findOne().parent()); + +// console.log(clickable(false).find()); + +// console.log(Common.id('v9f').findOne(1000));//Rect(0, 0 - 1080, 120); boundsInScreen: Rect(0, 1401 - 1080, 1521) + +// console.log(Common.id('dsc').findOne(1000)); + + +// console.log(Common.id('d6s').filter(v=>{ +// return v && v.bounds() && v.bounds() && v.bounds().width()>0; +// }).findOne(1000)); + +// console.log(Common.id('bj').findOne(1000)); + +// let contains = Common.id('root_layout').find(); +// for (let i in contains) { +// if (isNaN(i)) { +// continue; +// } + +// let nicknameTag = contains[i].children().findOne(Common.id('0bq')); +// console.log(contains[i]); +// console.log(nicknameTag); +// } + + +// let scrolls = Common.id("1").scrollable(true).find(); +// console.log(scrolls); + + +// for (let i in scrolls) { +// if(isNaN(i)){ +// continue; +// } + + +// scrolls[i].scrollForward(); +// } + +//console.log(textContains('置顶').find()); + +// let contains = Common.id('container').find(); +// for(let i in contains){ +// if(isNaN(i)){ +// continue; +// } + +// log(contains[i].children().find(Common.id('z5t'))); +// } + +// let containers = scrollable(true).find(); +// log(textContains('取消关注').findOne().parent().click()); + +// Common.id('explorer_item_list').findOne().scrollForward(); + +// console.log(id('u-o').findOne().scrollForward()); + + +// console.log(id('wk5').findOne().scrollForward()); + + +// console.log(textMatches(/[\s\S]+/).clickable(true).filter(v => { +// return v && v.bounds() && v.bounds().width() == device.width; +// }).find()); + + +// log(scrollable(true).find()[0].scrollForward()); + + +// swipe(200, device.height * 0.3, 200, device.height * 0.7, 100); + +let ass = '漾YOUNG男士发型22'; +// let a = textContains('漾YOUNG男士发型2').findOne(); + +// log(ass.substring(0, ass.length/2)); +// a = textContains(ass.substring(0, ass.length/2)).findOne(); +// log(a); + + +// log(textContains('查看详情').findOne()); + +// log(textContains('点击重播').findOne()); + + +// log(id('container').filter(v=>{ +// log(v.bounds().width(), device.width); +// return v && v.bounds() && v.bounds().width() <= device.width/3; +// }).find()); + +// console.log(scrollable(true).findOne().scrollForward()); + +// // id('oc8').findOne().scrollForward(); +// id('nrj').findOne().scrollForward(); + +// let a = textMatches(/.+/).find(); + +// console.log(a); + +// let a = className('android.widget.FrameLayout').filter((v) => { +// return v && v.bounds() && v.bounds().width() >= device.width - 10 && v.bounds().left >= 0 && v.bounds().top + v.bounds().height() < device.height; +// }).find(); +// log(a); + +// log(descContains('蒙').find()); + +// log(descMatches(/[\s\S]*/).find()); + + +// console.log(scrollable(true).find()); + +// id('fhj').findOne().scrollForward(); + +log(id('s4y').findOne().parent()); + diff --git a/test.md b/test.md new file mode 100644 index 0000000..9ff387c --- /dev/null +++ b/test.md @@ -0,0 +1,15 @@ + + diff --git a/test2.js b/test2.js new file mode 100644 index 0000000..16baef0 --- /dev/null +++ b/test2.js @@ -0,0 +1,8 @@ +let user = textContains('用户').id('android:id/text1').findOne(); + +log(user); + +click(user.bounds().centerX(), user.bounds().centerY()); + + +log(Math.random(22.33)); diff --git a/unit/dialogClose.js b/unit/dialogClose.js index 8027909..8857cab 100644 --- a/unit/dialogClose.js +++ b/unit/dialogClose.js @@ -1,3 +1,3 @@ -import { Common as tCommon } from "app/dy/Common"; +let tCommon = require("app/dy/Common"); tCommon.closeAlert(); diff --git a/unit/engineCondition.js b/unit/engineCondition.js index 263dd90..1378ab8 100644 --- a/unit/engineCondition.js +++ b/unit/engineCondition.js @@ -1,4 +1,4 @@ -export let condition = { +let condition = { dailyLastHour: function(){ let dt = new Date(); if(dt.getHours() >= 22){ @@ -14,3 +14,5 @@ export let condition = { return false; } }; + +module.exports = condition; diff --git a/unit/mHttp.js b/unit/mHttp.js index baf68b7..77e0515 100644 --- a/unit/mHttp.js +++ b/unit/mHttp.js @@ -1,13 +1,10 @@ -import { storage } from 'common/storage.js'; -import { config as mConfig } from 'config/config.js'; +let storage = require('common/storage.js'); +let mConfig = require('config/config.js'); -export let mHttp = { +let mHttp = { getConfig() { let config = { url: mConfig.domain, - token: storage.getToken(), - mobile: storage.getMobile(), - machine_id: storage.getMachineId(), }; //dev环境判断 @@ -24,8 +21,6 @@ export let mHttp = { post(controller, action, data, type) { let result = this.postBase(controller, action, data, type); if (result.code === 401) { - //生成新的token并且继续上传内容 - storage.removeToken(); return result; } return result; @@ -200,3 +195,5 @@ export let mHttp = { }); }, } + +module.exports = mHttp; diff --git a/version/27.3.0.js b/version/27.3.0.js new file mode 100644 index 0000000..2d0826b --- /dev/null +++ b/version/27.3.0.js @@ -0,0 +1,154 @@ +const C = {//G表示全局的,比如弹窗 + iptTag: 'dg0', //A0000 + submitTag: 'dj2', //A0010 + swipeWindow: '1',//A0020 + indexBottomMenu: 'u+h',//A0030 + text1: 'android:id/text1',//A0040 + text1a: 'text1',//A0040A + container: 'container',//A0050 + indexTopMenu: 'yic',//A0060 + searchTag: 'et_search_kw',//A0070 + focusTag: ['q1y', 'q1z'],//A0080 A0081 + userTag: 'pgx',//A0090 + focusText: ['已关注', '互相关注', '取消关注', '关注'],//A0100 A0101 A0102 A0103 + userMainTag: ['y=3', 'y=7'],//关注数量,粉丝数量 tag // A0110 A0111 + fansNickTag: 'yq3',//很多地方使用 // A0120 + rootLayout: 'root_layout', //A0130 + privateAccount: '私密账号',// A0140 + userListTop: 'u-o', //粉丝、关注、用户列表头部,防止列表滑动超出 + userListHead: 'bj', +} + +const C270301 = { + C: C, + Index: { + //首页 + intoHome: [C.indexBottomMenu, '首页'], //B0000 B0001 + intoMyMessage: [C.indexBottomMenu, '消息'],//B0010 B0011 + intoMyPage: [C.indexBottomMenu, '我'],//B0020 B0021 + intoMyLikeVideo: [C.text1, '喜欢', C.container],//B0030 B0031 B0032 + intoLocal: [C.indexTopMenu, 'close', C.indexBottomMenu],//B0040 B0041 B0042 + intoRecommend: [C.indexTopMenu, '推荐'],//B0050 B0051 + getMsgCount: ['u_z', '[\\d]+'],//B0060 B0061 + intoSearchPage: ['hfr'],//B0070 + inRecommend: ['yic', '推荐', '已选中,推荐,按钮']//B0080 B0081 B0082 + }, + + Message: { + //消息页面 + showAll: ['text', '查看全部'], //C0000 C0001 + ////C0010 C0011 C0012 C0013 C0014 C0015 C0016 // C0017 C0018 C0019 C0010A C0010B + backMsg: ['red_tips_count_view', '未读消息', 'tv_title', '互动消息', 'jf', 'android.view.ViewGroup', 'c2s', '赞', 'c5f', '回复评论', C.iptTag, 'ti6'], + search: ['k0t', '搜索', C.searchTag],//C0020 C0021 + intoFansGroup: ['c6k', '群聊', 'content_container', 'ojv'],//C0030 C0031 C0032 C0033 + intoGroupUserList: ['r=7', '更多', '群成员按钮', '查看群成员', 'content', 'tv_name', 'ojv'],//C0040 C0041 C0042 C0043 // C0044 C0045 C0046 + fansSwipe: ['nrj'], + }, + + User: { + //用户页面 + //D0000 D0001 D0002 D0003 D0004 // D0005 D0006 D0007 D0008 + privateMsg: ['title', C.privateAccount, 'v0f', '更多', 'desc', '发私信', 'n-v', 'j2', '私信功能已被封禁'], + getNickname: ['oth', ',复制名字'],// D0010 D0011 + getDouyin: ['y1j', '抖音号:', 'y_7'],//D0020 D0021 D0022 + getZanCount: ['y=0'],//D0030 + getFocusCount: [C.userMainTag[0]],//D0040 + getFansCount: [C.userMainTag[1]],//D0050 + getIntroduce: [C.userTag],//D0060 + getIp: [C.userTag],//D0070 + getAge: [C.userTag],//D0080 + getWorksTag: ['作品', C.text1a],//D0090 + isPrivate: [C.privateAccount, '封禁', '账号已经注销'],//D0100 D0101 D0102 + isFocus: [C.focusTag[1], C.focusText[0], C.focusText[1]],//D0110 D0111 D0112 + focus: [C.focusTag[0], C.focusTag[1], C.focusText[0], C.focusText[1]],//D0120 D0121 D0122 D0123 + cancelFocus: [C.focusTag[1], 'l2+', C.focusText[2], C.focusTag[0]],//D0130 D0131 D0132 D0133 + ////D0140 D0141 D0142 D0143 //D0144 D0145 D0146 D0147 //D0148 D0149 D0140A D0140B + cancelFocusList: [C.userMainTag[1], 'yp-', C.rootLayout, C.fansNickTag, 'title_bar', 'br+', 'n=y', 'title', C.focusText[2], C.focusText[1], C.focusText[3], C.focusText[0]], + ////D0150 D0151 D0152 D0153 //D0154 D0155 D0156 D0157 + fansIncList: [C.userMainTag[1], 'u-o', C.rootLayout, C.fansNickTag, 'r94', 'pgn', 'l_f', '点赞'], + ////D0160 D0161 D0162 D0163 //D0164 D0165 D0166 + focusUserList: [C.userMainTag[0], C.userMainTag[1], 'u-o', C.rootLayout, C.fansNickTag, 'r94', 'v0f'], + intoFocusList: [C.userMainTag[1], 'yp-'],//D0170 D0171 + focusListSearch: ['gly', C.fansNickTag, 'txt_desc'],//搜索框,昵称 ,账号 //D0180 D0181 D0182 + viewFansList: ['y=w', 'xcr', C.rootLayout, C.fansNickTag, 'title_bar'], //D0190 D0191 D0192 D0193 D0194 + hasAlertInput: ['n-v'], //D0200 + }, + + Comment: { + //评论页面 + getAvatarTag: ['avatar'],//E0000 + getNicknameTag: ['title'],//E0010 + getTimeTag: ['dls'],//E0030 + getIpTag: ['did'],//E0040 + getZanTag: ['e3b', 'lo+'],//E0050 E0051 + isAuthor: ['d6s', '作者'],//E0060 E0061 + getContent: [',,,,'],//E0070 + isZan: ['已选中'],//E0080 + swipeTop: [C.swipeWindow],//E0090 + getList: ['d6s'],//E0100 + closeCommentWindow: ['back_btn', '关闭'],//E0110 E0111 + backMsg: [C.iptTag, C.submitTag],//E0120 E0121 + commentMsg: [C.iptTag, C.submitTag],//E0130 E0131 + iptEmoj: ['gbx', 'gbi'],//E0140 E0141 + commentAtUser: [C.iptTag, 'at', 'tv_name', '最近@', C.submitTag],//E0150 E0151 E0152 E0153 E0154 + commentImage: ['o-8', '表情', 'u-n', '自定义表情', C.swipeWindow],//E0160 E0161 E0162 E0163 E0164 + zanComment: ['title', '评论'],//E0170 E0171 + }, + + Search: { + //搜索页面 + intoSearchList: [C.searchTag, 'x=2', '搜索', '视频', '用户', C.text1a],//F0000 F0001 F0002 F0003 F0004 F0005 + intoSearchLinkVideo: [C.searchTag, 'x=2', '搜索'],//F0010 F0011 F0012 + intoSearchVideo: ['desc', 'sg6', 'j='],//F0020 F0021 F0022 + intoSeachUser: ['抖音号:', '抖音号'],//F0030 F0031 + intoLiveRoom: ['抖音号:', '抖音号'],//F0040 F0041 + intoUserLiveRoom: ['直播', '抖音号'],//F0050 + userList: ['u-o', 'android.widget.FrameLayout', '粉丝', '抖音号:', 'v0f'] //F0060 F0061 F0062 F0063 + }, + + Live: { + //直播页面 + getUserCountTag: ['o4u'], // G0000 + getUserTags: ['ah0', '[\\s\\S]+'], // G0010 G0011 + intoFansPage: ['opq'],// G0020 + listenBarrage: ['text', 'android.widget.TextView'], // G0030 G0031 + loopClick: ['关闭'], // G0040 + // G0050 G0051 G0052 G0053 // G0054 G0055 G0056 + comment: ['f9h', 'android.widget.EditText', 'x_9', '发送', 'd+g', 'list', 'android.widget.FrameLayout'], + }, + + Common: { + backHome: [C.indexBottomMenu],//H0000 + swipeSearchUserOp: ['l_a'],//H0010 + swipeFansListOp: ['l5'],//H0020 + swipeFocusListOp: ['l5'],//H0030 + swipeCommentListOp: [C.swipeWindow],//H0040 + }, + + Video: { + //视频页面 主页视频、用户视频、搜索视频。 用户视频和搜索视频一致 + getZanTag: ['e3z'],//I0000 + isZan: ['已点赞'],//I0010 + getCommentTag: ['dms'],//I0020 + getCollectTag: ['dcx'],//I0030 + isCollect: ['未选中'],//I0040 + getShareTag: ['tu3'],//I0050 + getContentTag: ['desc'],//I0060 + getTitleTag: ['title'],//I0070 + getAtNickname: ['@'],//I0080 + getTimeTag: ['a=6'],//I0090 + isLiving: ['mdo', '点击进入直播间', 'yz4', '直播中'],//I0110 I0111 I0112 I0113 + getAvatar: ['user_avatar'],// I0120 + getLivingAvatarTag: ['yz4', '直播中'],//I0130 I0131 + getLivingNickname: ['直播中'],//I0140 + viewDetail: ['查看详情'],//I0150 + getDistanceTag: ['p_j', 'qj3'],//I0160 I0161 + getInTimeTag: ['x19'],//I0170 + intoUserVideo: ['android:id/text1', '作品', 'container', 'yh1'],//I0180 I0181 I0182 + isFocus: ['hrg'],//I0190 + zanList: ['yj6'], + }, +} + + +module.exports = C270301; diff --git a/version/29.7.0.js b/version/29.7.0.js new file mode 100644 index 0000000..ecd57c1 --- /dev/null +++ b/version/29.7.0.js @@ -0,0 +1,162 @@ +const C = {//G表示全局的,比如弹窗 + iptTag: 'c4g', //A0000 + submitTag: 'c7u', //A0010 + swipeWindow: '1',//A0020 + indexBottomMenu: 'wl0',//A0030 + text1: 'android:id/text1',//A0040 + text1a: 'text1',//A0040A + container: 'container',//A0050 + indexTopMenu: 'z5+',//A0060 + searchTag: 'et_search_kw',//A0070 + focusTag: ['ryd', 'rye'],//A0080 A0081 + userTag: 'p=u',//A0090 用户承载年龄、IP等标签的容器 + focusText: ['已关注', '互相关注', '取消关注', '关注'],//A0100 A0101 A0102 A0103 + userMainTag: ['0xh', '0xl'],//关注数量,粉丝数量 tag // A0110 A0111 + fansNickTag: '0bq',//很多地方使用 // A0120 + rootLayout: 'root_layout', //A0130 + privateAccount: '私密账号',// A0140 + userListTop: 'wk5', //粉丝、关注、用户列表头部,防止列表滑动超出 + userListHead: 'v9f', +} + +const C290701 = { + C: C, + Index: { + //首页 + intoHome: [C.indexBottomMenu, '首页'], //B0000 B0001 + intoMyMessage: [C.indexBottomMenu, '消息'],//B0010 B0011 + intoMyPage: [C.indexBottomMenu, '我'],//B0020 B0021 + intoMyLikeVideo: [C.text1, '喜欢', C.container],//B0030 B0031 B0032 + intoLocal: [C.indexTopMenu, 'close', C.indexBottomMenu],//B0040 B0041 B0042 + intoRecommend: [C.indexTopMenu, '推荐', '团购'],//B0050 B0051 + getMsgCount: ['wj+', '[\\d]+'],//B0060 B0061 + intoSearchPage: ['hcm'],//B0070 + inRecommend: [C.indexTopMenu, '推荐', '已选中,推荐,按钮']//B0080 B0081 B0082 + }, + + Message: { + //消息页面 + showAll: ['text', '查看全部'], //C0000 C0001 + ////C0010 C0011 C0012 C0013 C0014 C0015 C0016 // C0017 C0018 C0019 C0010A C0010B 目前无相关功能模块,暂时不用处理 + backMsg: ['red_tips_count_view', '未读消息', 'tv_title', '互动消息', 'jf', 'android.view.ViewGroup', 'c2s', '赞', 'c5f', '回复评论', C.iptTag, 'ti6'], + search: ['lb8', '搜索', C.searchTag],//C0020 C0021 + intoFansGroup: ['cok', '群聊', 'content_container', 'o-l'],//C0030 C0031 C0032 C0033 + //tv_name未发现在哪,貌似不存在了 + intoGroupUserList: ['s-s', '更多', '群成员按钮', '查看群成员', 'content', 'tv_name', 'o-l'],//C0040 C0041 C0042 C0043 // C0044 C0045 C0046 + fansSwipe: ['oc8'], + }, + + User: { + //用户页面 + //D0000 D0001 D0002 D0003 D0004 // D0005 D0006 D0007 D0008 + privateMsg: ['title', C.privateAccount, 'xct', '更多', 'desc', '发私信', 'o0x', 'ji-', '私信功能已被封禁'],//1094474339私密账号 + getNickname: ['pi9'],// D0010 + getDouyin: ['0m7', '抖音号:', '0yf'],//D0020 D0021 D0022 + getZanCount: ['0xe'],//D0030 + getFocusCount: [C.userMainTag[0]],//D0040 + getFansCount: [C.userMainTag[1]],//D0050 + getIntroduce: [C.userTag],//D0060 + getIp: [C.userTag],//D0070 + getAge: [C.userTag],//D0080 + getWorksTag: ['作品', C.text1a],//D0090 D0091 + isPrivate: [C.privateAccount, '封禁', '账号已经注销'],//D0100 D0101 D0102 + isFocus: [C.focusTag[1], C.focusText[0], C.focusText[1]],//D0110 D0111 D0112 + focus: [C.focusTag[0], C.focusTag[1], C.focusText[0], C.focusText[1]],//D0120 D0121 D0122 D0123 + cancelFocus: [C.focusTag[1], 'lx4', C.focusText[2], C.focusTag[0]],//D0130 D0131 D0132 D0133 + ////D0140 D0141 D0142 D0143 //D0144 D0145 D0146 D0147 //D0148 D0149 D0140A D0140B + cancelFocusList: [C.userMainTag[1], '0a0', C.rootLayout, C.fansNickTag, 'title_bar', '0az', 'n-2', 'title', C.focusText[2], C.focusText[1], C.focusText[3], C.focusText[0]], + ////D0150 D0151 D0152 D0153 //D0154 D0155 D0156 D0157 + fansIncList: [C.userMainTag[1], 'wk5', C.rootLayout, C.fansNickTag, 'XXX', 'p=k', 'mnj', '点赞'],//XXX表示不再使用,只是占位 + ////D0160 D0161 D0162 D0163 //D0164 D0165 D0166 + focusUserList: [C.userMainTag[0], C.userMainTag[1], 'wk5', C.rootLayout, C.fansNickTag, 'XXX', 'xct'], + intoFocusList: [C.userMainTag[1], '0a0'],//D0170 D0171 + focusListSearch: ['fwe', C.fansNickTag, 'txt_desc'],//搜索框,昵称 ,账号 //D0180 D0181 D0182 + viewFansList: ['0w+', 'yxj', C.rootLayout, C.fansNickTag, 'title_bar'], //D0190 D0191 D0192 D0193 D0194 + hasAlertInput: ['YYY'], //D0200 //YYY 表示暂未发现对应内容 + head: ['p=k', 'mnj', '点赞'],// + more: ['jzz', '更多面板', 'y7y', '经营工具', '高级在线预约', '预览', '发送'], + }, + + Comment: { + //评论页面 + getAvatarTag: ['avatar'],//E0000 + getNicknameTag: ['title'],//E0010 + getTimeTag: ['c9s'],//E0030 + getIpTag: ['dsc'],//E0040 + getZanTag: ['ero'],//E0050 E0051(第二个已被移除,后续发现再补充) + isAuthor: ['dsc', ',作者,'],//E0060 E0061 + getContent: [','],//E0070 + isZan: ['已选中'],//E0080 + //swipeTop: [C.swipeWindow],//E0090 + getList: ['dsc'],//E0100 + closeCommentWindow: ['back_btn', '关闭'],//E0110 E0111 + backMsg: [C.iptTag, C.submitTag],//E0120 E0121 + commentMsg: [C.iptTag, C.submitTag],//E0130 E0131 + iptEmoj: ['gbx', 'gbi'],//E0140 E0141 暂未使用,忽略掉了 + commentAtUser: [C.iptTag, 'at', 'tv_name', '最近@', C.submitTag],//E0150 E0151 E0152 E0153 E0154 + commentImage: ['i7r', '表情', 'wk3', '自定义表情', 'rw3'],//E0160 E0161 E0162 E0163 E0164 + zanComment: ['title', '评论'],//E0170 E0171 + getBackMsg: ['s4y'] + }, + + Search: { + //搜索页面 + intoSearchList: [C.searchTag, 'zt0', '搜索', '视频', '用户', C.text1a],//F0000 F0001 F0002 F0003 F0004 F0005 + intoSearchLinkVideo: [C.searchTag, 'zt0', '搜索'],//F0010 F0011 F0012 + intoSearchVideo: ['desc', 'ti=', 'aj6'],//F0020 F0021 F0022 + intoSeachUser: ['抖音号:', '抖音号'],//F0030 F0031 + intoLiveRoom: ['抖音号:', '抖音号'],//F0040 F0041 + intoUserLiveRoom: ['直播', '抖音号'],//F0050 + userList: ['wk5', 'android.widget.FrameLayout', '粉丝', '抖音号:', 'xct'], //F0060 F0061 F0062 F0063 + searchFilter: ['g5z', '筛选',] + }, + + Live: { + //直播页面 + getUserCountTag: ['puh'], // G0000 + getUserTags: ['_a', '[\\s\\S]+', 'android.widget.FrameLayout'], // G0010 G0011 列表元素,列表元素点击后的昵称控件 + intoFansPage: ['pes'],// G0020 + listenBarrage: ['text', 'android.widget.TextView'], // G0030 G0031 + loopClick: ['关闭'], // G0040 + // G0050 G0051 G0052 G0053 // G0054 G0055 G0056 + comment: ['fz0', 'android.widget.EditText', 'zu6', '发送', 'f50', 'list', 'android.widget.FrameLayout'], + }, + + Common: { + backHome: [C.indexBottomMenu],//H0000 + swipeSearchUserOp: ['mne'],//H0010 + swipeFansListOp: ['syq'],//H0020 + swipeFocusListOp: ['syq'],//H0030 + swipeCommentListOp: ['rw3'],//H0040 + }, + + Video: { + //视频页面 主页视频、用户视频、搜索视频。 用户视频和搜索视频一致 + getZanTag: ['er-'],//I0000 + isZan: ['已点赞'],//I0010 + getCommentTag: ['c=t'],//I0020 + getCollectTag: ['c0e'],//I0030 + isCollect: ['未选中'],//I0040 + getShareTag: ['u25'],//I0050 + getContentTag: ['desc'],//I0060 + getTitleTag: ['title'],//I0070 + getAtNickname: ['@'],//I0080 + getTimeTag: ['a4y'],//I0090 当前版本不准确,包含了IP信息:“2024-04-09 01:33 IP属地:湖北” + isLiving: ['nqn', '点击进入直播间', '0lo', '直播中'],//I0110 I0111 I0112 I0113 + getAvatar: ['user_avatar'],// I0120 + getLivingAvatarTag: ['0lo', '直播中'],//I0130 I0131 + getLivingNickname: ['直播中'],//I0140 + viewDetail: ['查看详情'],//I0150 + getDistanceTag: ['reh', 'q43'],//I0160 I0161 + getInTimeTag: ['zkh'],//I0170 + intoUserVideo: ['android:id/text1', '作品', 'container', 'z5t'],//I0180 I0181 I0182 + isFocus: ['hpt'],//I0190 + zanList: ['z7+'] //点赞列表昵称 + }, + + GroupBuy: { + shopContainer: ['eu=', '用户评价', '查看全部'], + } +} + +module.exports = C290701; diff --git a/version/V.js b/version/V.js new file mode 100644 index 0000000..792fb9f --- /dev/null +++ b/version/V.js @@ -0,0 +1,26 @@ +let C270301 = require("version/27.3.0.js"); +let C290701 = require("version/29.7.0.js"); + +let VERSION = { + "270301": C270301, + "290701": C290701 +} + +let version = App.getAppVersionCode('com.ss.android.ugc.aweme'); +let value = undefined; +for (let key in VERSION) { + if (version === parseInt(key)) { + value = VERSION[key]; + break; + } +} + +if (!value) { + //版本号不对,直接停止 + FloatDialogs.show('提示', '当前抖音版本号不支持!') + System.exit(); +} + +let V = value; + +module.exports = V; diff --git a/version/XhsV.js b/version/XhsV.js new file mode 100644 index 0000000..6889bfc --- /dev/null +++ b/version/XhsV.js @@ -0,0 +1,25 @@ +let C8380 = require("version/xhs.8.38.0.js"); + +let VERSION = { + "8380830": C8380, +} + +let version = App.getAppVersionCode('com.xingin.xhs'); +let value = undefined; +for (let key in VERSION) { + console.log('版本号比较:', version, key);//版本号比较: 8380830 8.38.0 + if (version === parseInt(key)) { + value = VERSION[key]; + break; + } +} + +if (!value) { + //版本号不对,直接停止 + FloatDialogs.show('提示', '当前小红薯版本号不支持!') + System.exit(); +} + +let XhsV = value; + +module.exports = XhsV; diff --git a/version/help.md b/version/help.md new file mode 100644 index 0000000..7cff9d5 --- /dev/null +++ b/version/help.md @@ -0,0 +1,321 @@ +## 抖音标注说明 + +#### A0000 +> 首页输入框的控件,可以点击 + +#### A0010 +> 首页输入框的输入内容后,出现的“发送”按钮,可以点击 + +#### A0020 +> 滑动窗口 + +#### A0030 +> 主界面底部菜单,父级可以被点击 + +#### A0040 和 A0040A +> 一般的textView文本,如果使用Common.aId()方法,则使用A0040A + +#### A0050 +> 用户主页的视频容器 + +#### A0060 +> 主界面顶部的导航元素,比如“同城”,“推荐”等;父级可以被点击 + +#### A0070 +> 搜索输入框元素,可以被点击和输入 + +#### A0070 +> 搜索输入框元素,可以被点击和输入 + +#### A0080 和 A0081 +> 用户主页关注按钮,分别表示“关注”按钮,和“已关注”按钮;都可以被点击 + +#### A0090 +> 用户界面的详情介绍,这个控件的子控件包含了:用户介绍,IP,年龄,性别等控件 + +#### A0100 A0101 A0102 A0103 +> 这几个描述为关注相关的控件内容,各个版本应该是一致的 + +#### A0110 A0111 +> 用户主页的,关注数量和粉丝数量控件;注意,如果是读取当前账号内容,则不一样。 + +#### A0120 +> 粉丝昵称控件,比如当前账号的粉丝列表的控件,关注列表控件等;也包括别人的粉丝和关注列表 + +#### A0130 +> 粉丝列表,关注列表的container;应该各个版本不会有变化 + +#### A0140 +> 私密账号控件描述,基本各个版本不会有变化 + + + +#### B0001 +> 主界面“首页”的底部导航 + +#### B0011 +> 主界面“消息”的底部导航 + +#### B0021 +> 主界面“我”的底部导航 + +#### B0031 +> 当前账号主页,“喜欢”Tab(和“作品”并列的位置) + +#### B0041 +> 打开同城,选择城市的左上角“关闭”控件 + +#### B0051 +> 主界面,上方的“推荐”Tab控件 + +#### B0060 B0061 +> 两个联合,表示主界面“消息”Tab的消息数量控件 + +#### B0070 +> 主界面的搜索图标控件,注意是外部的可以点击的,不是不能点击的那个ID + +#### B0080 B0081 B0082 +> 组合使用,表示主界面上方的“推荐”Tab控件被选中 + + + +#### C0000 C0001 +> 消息界面,查看所有消息的;各个版本应该有所变化;但是目前这个没有使用,可以不写 + +#### C0010 C0011 +> 消息页,未读消息控件,两个联合使用;目前未使用 + +#### C0012 C0013 +> 消息页,互动消息控件,两者联合使用;目前未使用 + +#### C0014 C0015 +> 表示多少分钟,小时前的消息控件 + +#### C0016 C0017 +> 互动消息详情,“赞”他人给当前账号的评论的“回赞”控件,两者联合使用 + +#### C0018 C0019 +> 互动消息详情,“评论“他人给当前账号的评论的“回复评论”控件,两者联合使用 + +#### C0020 C0021 +> 消息Tab页的,搜索图标控件;两个组合使用查找一个控件 + +#### C0030 C0031 +> 群聊搜索结果标题控件,介于“输入框”和“搜索结果”之间的文本标题控件 + +#### C0032 C0033 +> 群聊搜索结果记录控件,和记录对应的群名称控件;搜索结果会对应N个这样的控件 + +#### C0040 C0041 +> 粉丝群右上角的更多按钮控件 + +#### C0042 C0043 +> 查看群成员的连续的两个控件 + +#### C0044 C0045 C0046 +> 群成员列表控件; +> 群成员昵称控件; + + +#### D0000 D0001 +> 用户主页“私密账号”控件查找,两者同时使用 + +#### D0002 D0003 +> 用户页面“更多”按钮 + +##### D0004 D0005 +> 发私信控件 + +#### D0006 +> 私信输入框控件 + +#### D0007 +> 私信发送按钮控件 + +#### D0008 +> 私信功能已被封禁控件,版本迭代不会变动 + +#### D0010 D0011(29.7.0已经移除) +> 用户中心,获取用户昵称,D0011是昵称中携带的“额外”文字,需要移除 + +#### D0020 D0021 D0022 +> 一版账号的抖音号控件,D0021是“额外”的文字,D0022是特殊的抖音账号 + +#### D0030 +> 用户中心,点赞数控件 + +#### D0090 D0091(29.7.0添加,联合使用) +> 作品数控件 + +#### D0101 D0102 +> 封禁、账号已注销控件,基本不会变化 + +#### D0131 +> 取消关注控件(用户中心取消) + +#### D0141 +> 关注数量控件(标题上的) + +#### D0144 D0145 D0146 D0147 +> 顶部tab容器控件,防止用户列表划到最上方的判断; +> 是否已关注(含“已关注”、“互相关注”)控件; +> “已关注”后面的“三个点”控件; +> “取消关注”控件的ID + +#### D0154 D0155 D0156 D0157 +> 第一个用户很可能是自己判断控件; +> 头像控件 +> 头像点赞控件(D0156和D0157) + +#### D0165 D0166 +> 第一个用户很可能是自己判断控件; +> 用户界面更多按钮,同D0002 + +#### D0171 +> 关注列表,关注数控件:“我的关注(22人)” + +#### D0180 D0182 +> 关注列表,搜索框控件; +> 关注列表搜索结果,账号控件; + +#### D0190 D0191 +> 我的粉丝控件(最外层,可以点击的); +> 我的粉丝列表,粉丝总数控件 + +#### D0194 +> 粉丝列表顶部tab容器控件,用于判断粉丝用户滑动的top距离 + +#### D0200 +> 用户中心弹窗控件(部分企业账号,进入用户中心,直接弹出对话窗口) + +#### E0000 E0010 +> 评论列表头像控件;评论列表昵称控件; + +#### E0030 E0040 +> 评论列表时间控件;评论列表IP控件; + +#### E0050 E0051 +> 点赞控件;不同机型略有差异;需要适配两种机型 + +#### E0060 E0061 +> 是否是作者 + +#### E0070 +> 评论内容切割字符串 + +#### E0080 +> 是否已点赞 + +#### E0100 +> 获取评论列表控件;多个评论container; + +#### E0110 E0111 +> 关闭评论窗口控件 + +#### E0140 E0141 +> 在大的容器控件中找到emoji控件; + +#### E0151 E0152 E0153 +> 联合使用,@对应的账号控件;暂未使用,可以忽略; + +#### E0160 E0161 E0162 E0163 +> 输入框右侧的表情控件 +> 输入框展开后,下面的收藏表情(心形图标)控件; +> 自定义表情控件; + +#### E0170 E0171 +> 评论窗口标题控件,组合使用; + + + +#### F0001 F0002 F0003 F0004 +> 前两个控件是组合使用,搜索框控件; +> 搜索结果的“视频”、“用户”列表控件; + +#### F0011 F0012 +> 同F0001、F0002 + +#### F0020 F0021 F0022 +> 进入搜索视频的三种方式:descTag,container,titleTag + +#### F0030 F0031 +> 查找抖音号 + +#### F0040 F0041 +> 查找抖音号 + +#### F0050 +> 直播视频搜索 + +#### F0060 F0061 F0062 F0063 +> 搜索框头部tab控件,用于判断用户列表滑动,是否超出顶部 +> 用户列表容器控件; +> 内容控件,过滤粉丝数量;”粉丝数:2323“; +> 内容控件,过滤抖音账号;”抖音号:23423“; + + + +#### G0000 +> 粉丝在线数量控件 + +#### G0010 G0011 +> 获取粉丝列表,两个字段组合使用 + +#### G0020 +> 粉丝头像,点击进入粉丝主页控件; + +#### G0030 G0031 +> 粉丝弹幕控件,组合使用; + +#### G0040 +> 弹窗和输入框等控件,遇到直接关闭; + +#### G0050 G0051 G0052 G0053 +> 直播间输入框控件,点击弹出输入框控件 +> 输入框控件,可以设置内容; +> G0052和G0053,发送控件,组合使用; + +#### G0054 G0055 G0056 +> 点击表情控件;表情容器控件;表情控件className + + + +#### H0010 H0020 H0030 +> 滑动搜索用户列表控件;滑动粉丝类别控件;滑动关注列表控件; + + + +#### I0001 I0010 I0020 I0030 I0040 +> 点赞控件;是否已点赞判断文字,一般不会变化;评论控件;收藏控件;是否收藏判断; + +#### I0050 I0060 I0070 +> 分享控件;内容控件;标题控件; + +#### I0080 I0090 +> 通过@获取用户昵称控件;视频发布时间控件; + +#### I0110 I0111 I0112 I0113 +> I0110 I0111:头像直播控件; +> I0112 I0113:屏幕中心直播提示控件; + +#### I0120 +> 用户头像控件; + +#### I0130 I0131 +> 正在直播中用户头像,第一个ID查找昵称,第二个判断直播中控件;组合使用; + +#### I0140 +> 获取直播昵称控件; + +#### I0150 +> 广告控件,”查看详情“,一般不会变化; + +#### I0160 I0161 +> 同城距离获取,两种方式 + +#### I0170 +> 同城时间获取控件 + +#### I0180 I0181 I0182 +> 点击用户主页”作品“控件,组合使用; +> 进入用户作品控件 \ No newline at end of file diff --git a/version/xhs.8.38.0.js b/version/xhs.8.38.0.js new file mode 100644 index 0000000..4e76833 --- /dev/null +++ b/version/xhs.8.38.0.js @@ -0,0 +1,64 @@ +const C8380 = { + Common: { + backHome: ['iqq', '首页'], + swipeSearchUserOp: ['暂时无相关逻辑'], + swipeFansListOp: ['k11'], + swipeCommentListOp: ['gdo'], + swipeFocusListOp: ['g5d'], + swipeRecommendListOp: ['hf5'], + }, + + User: { + fans: ['iqg', '关注', '粉丝', '推荐', '已选定', 'cms', 'jqy', 'as2', 'jnz'],//粉丝列表 + account: ['h5g'], + nickname: ['h5e'], + focus: ['jz0', '关注', '发消息'], //关注按钮 和 发消息按钮,两者ID是一样的,关注之后,关注按钮变为发消息 + sendMsg: ['jz1', '发消息'],//没有关注的时候,关注按钮右侧的“发消息”按钮 + msgBtn: ['awc'], + sendBtn: ['f7c'],//消息发送按钮 + fansText: ['ccd'], + showAllFans: ['ixu', '查看全部'], //粉丝页面 ,需要点击才能查看全部 + back: ['h45', '返回'], + }, + + Work: { + zan: ['gef', 'fpp'],//图文赞,视频赞 + collect: ['gcm', 'fpk'], + zanCollectionHead: ['iqg', '赞和收藏'], //赞和收藏12 + zanUserList: ['jq', 'android.view.ViewGroup', 'nickNameTV', 'jm8', '作者'],//我的作品下面的赞用户列表 + head: ['ejz'],//ejz是nickNameTV外层的标签,用于判断是否进入了笔记页面 + zanCount: ['gcr'], + commentCount: ['gcx'], + zanCommentList: ['gdo', 'ezl'],//评论赞列表,第一个是滑动容器,第二是赞控件 + intoBottom: ['f0_', '到底了'], + comment: ['e1d', 'f9d'],//初始的输入框,最下面的,不是笔记内的;第二个是点击输入框之后的输入框元素 + sendBtn: ['fif', '发送'], + videoComment: ['commentLayout', 'b98'],//评论按钮;评论区滑动 + videoCommentOpen: ['e1c'], + like: ['g1_', '你可能感兴趣的人'], + videoNickname: ['matrixNickNameView'], + videoFocus: ['matrixFollowView'], + focus: ['followTV'], + nickname: 'nickNameTV', + VideoNickname: 'jzg',//desc:作者 XXX + title: 'gfd', + }, + + Index: { + intoIndex: ['发现'], + container: ['fcc', '视频 ', '笔记 ', '赞'], // 【视频 南阳知府衙门:一镜到底沉浸式体验明清地牢 来自安西承宣布政使 7663赞】 + containerCity: ['f09'], + zan: ['ecs'],//主页笔记视频点赞 + swipe: ['fcc', 'f09'], //分别是“发现”、“武汉” 两个类目中的滑动 + intoSearchPage: ['hw4', '搜索'], + }, + + Search: { + container: 'fhj',//可滑动 + intoSearchList: ['fhw', 'fi1', '搜索'], + intoSearchVideo: ['gfb', 'ge2', 'a8t'],//标题,封面,昵称和头像整体 + searchTop: 'e30', + } +} + +module.exports = C8380; diff --git a/xhs.js b/xhs.js new file mode 100644 index 0000000..a41e20e --- /dev/null +++ b/xhs.js @@ -0,0 +1,133 @@ + +//console.log(textContains('小红薯').findOne().parent().parent()); + + +//console.log(scrollable(true).find()); + +//id('com.xingin.xhs:id/k9v').findOne().scrollForward(); + +//id('com.xingin.xhs:id/g5d').findOne().scrollForward();//关注滑动 +//id('com.xingin.xhs:id/k11').findOne().scrollForward();//粉丝滑动 +//id('com.xingin.xhs:id/hf5').findOne().scrollForward();//推荐滑动 + +// let contains = id('com.xingin.xhs:id/cms').find(); + +// console.log(contains[0].children().findOne(id('com.xingin.xhs:id/jqy'))); + +// console.log(contains[0].children().findOne(id('com.xingin.xhs:id/jnz'))); + +// let a = textContains('小达人').findOne(); + +// console.log(a); +// log(a.parent()); +// log(a.parent().parent()); + +// let containers = id('com.xingin.xhs:id/ks').findOne().children().find(className('android.view.ViewGroup')); + +// for (let i in containers) { +// log(containers[i].children()); +// console.log(containers[i].children().findOne(id('com.xingin.xhs:id/nickNameTV'))); +// break; +// } + + +// let a = scrollable(true).find(); +// console.log(a); + +// id('com.xingin.xhs:id/jq').findOne().scrollForward(); + +// let tag = descContains('发现').findOne(); +// console.log(tag.parent().children()); + +// console.log(textContains('39').findOne()); +// console.log(textContains('39').findOne().parent().parent()); +// console.log(textContains('39').findOne().parent().parent().children()); + +// let tag = id('com.xingin.xhs:id/f05').filter(v => { +// return v && v.bounds() && v.bounds().left > 0 && v.bounds().top > 0; +// }).findOne(); + +// log(tag.children()); +// log(tag.parent().parent().parent().parent()); + +// let tag = id('fcc').findOne(); +// log(tag); +// log(tag.children()); + + +// let a = scrollable(true).find(); +// console.log(a); + +// id('com.xingin.xhs:id/gdo').findOne().scrollForward(); + +// id('com.xingin.xhs:id/b98').findOne().scrollForward(); + +// console.log(textContains('小红书').find()); + +// log(scrollable(true).find()); +// let tag = id('com.xingin.xhs:id/jq').findOne(); +// tag.scrollForward(); + + + +// log(id('com.xingin.xhs:id/jq').findOne().children().find(id('com.xingin.xhs:id/nickNameTV'))); + + +// console.log(scrollable(true).find()); +// id('com.xingin.xhs:id/gdo').findOne().scrollForward(); + +let Common = { + id(idName) { + return id('com.xingin.xhs:id/' + idName); + }, + + click(tag) { + click(tag.bounds().centerX(), tag.bounds().centerY()); + }, + + sleep(second) { + sleep(second); + } +} + +// function privateMsg() { +// let msg = '你好啊'; +// let sendIptTag = Common.id('awc').findOne(); +// console.log('开始设置私信', msg); +// sendIptTag.setText(msg); +// Common.sleep(500 + 500 * Math.random()); + +// //发送 +// let sendBtnTag = Common.id('f7c').findOne(); +// Common.click(sendBtnTag); +// console.log('点击发送'); +// } + +// privateMsg(); + +// function swipeFocusListOp() { +// let swipeFocusListOpTarge = this.id('g5d').scrollable(true).filter((v) => { +// return v && v.bounds() && v.bounds().top > 0 && v.bounds().left >= 0 && v.bounds().top >= 0; +// }).findOnce(); +// swipeFocusListOpTarge.scrollForward(); +// } + +// swipeFocusListOp(); + + +// console.log(scrollable(true).find()); +// id('com.xingin.xhs:id/fcc').findOne().scrollForward(); +// id('com.xingin.xhs:id/f09').findOne().scrollForward(); + +// let sendTag = Common.id('fif').textContains('发送').find(); +// log(sendTag.click()); + +// log(textContains('游泳').find()); + +// log(textContains('感觉').findOne().parent().parent()); + +let tag = Common.id('f09').findOne(); +log(tag); +if (tag) { + tag.scrollForward(); +}