-
Notifications
You must be signed in to change notification settings - Fork 10
/
抖音.js
170 lines (143 loc) · 4.68 KB
/
抖音.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/**
* 点淘刷元宝autojs脚本
* author: walkingsky
* url:https://github.com/walkingsky/autojs_credit
*/
var _common_Fuction = require('common.js');
/**
* 应用
*/
var app_aweme = {};
/**
* 限时任务赚金币
*/
app_aweme.task = function () {
id('i4g').indexInParent(0).depth(18).findOne().click();
sleep(3000);
title = text('赚钱任务').depth(18).findOne();
console.log(title);
try {
if (title) {
getButton = textContains('限时任务赚金币20000').depth(18).findOne();
console.log(getButton);
if (getButton) {
getButton.click();
sleep(3000);
console.log(textContains('广告').depth(8).findOne());
if (textContains('广告').depth(8).exists()) {
while (true) {
lingQuChengGong = text('领取成功').depth(8).indexInParent(21).findOne();
guanBiButton = text('关闭 按钮').depth(8).findOne();
console.log(lingQuChengGong);
console.log(guanBiButton);
if (lingQuChengGong || guanBiButton) {
if (lingQuChengGong)
lingQuChengGong.click();
else
guanBiButton.click();
sleep(1000);
lingJiang = text('领取奖励').depth(8).indexInParent(47).findOne();
if (lingJiang)
lingJiang.click();
kaiXinShouXia = text('开心收下').depth(8).indexInParent(47).findOne();
if (kaiXinShouXia) {
kaiXinShouXia.click();
className('com.lynx.tasm.behavior.ui.view.UIView').depth(18).findOne().click();
break;
}
} else {
sleep(1000);
}
}
} else {
//未到任务执行时间
_common_Fuction.toast_console('未到任务执行时间,返回首页');
className('com.lynx.tasm.behavior.ui.view.UIView').indexInParent(17).findOne().click();
}
}
} else {
//没找到就返回首页
className('com.lynx.tasm.behavior.ui.view.UIView').indexInParent(17).findOne().click();
_common_Fuction.toast_console('没有进入到限时任务赚金币,返回首页');
}
} catch (error) {
_common_Fuction.toast_console('限时任务赚金币' + error);
}
_common_Fuction.toast_console('完成一次限时任务赚金币,返回首页');
className('com.lynx.tasm.behavior.ui.view.UIView').indexInParent(17).findOne().click();
}
/**
* 打开应用,
*/
function start() {
//let result = shell('am start com.taobao.live/com.taobao.live.home.activity.TaoLiveHomeActivity');
app.launch('com.ss.android.ugc.aweme.lite');
//阻断式等待
id('i4g').indexInParent(0).waitFor();
sleep(1500);
//每天第一次进入app ,有个青少年模式提示,点击任意地方会关闭这个弹层提示
if (textContains('青少年模式').exists())
_common_Fuction.click_by_text('我知道了');
_common_Fuction.toast_console('成功启动app,并且找到了赚钱按钮');
}
/**
* 结束应用
*/
function stop() {
_common_Fuction.toast_console('关闭应用');
app.openAppSetting('com.ss.android.ugc.aweme.lite');
sleep(500);
textContains('强行停止').waitFor();
textContains('强行停止').click();
sleep(500);
textContains('确定').waitFor();
textContains('确定').click();
sleep(1000);
back();
_common_Fuction.toast_console('成功关闭应用');
}
/**
* 重启应用
*/
function restart() {
stop();
start();
}
/**
* 转换时间字符串到秒钟
* @param {string} str 要转换的字符串
* @returns int 数字秒数
*/
function str_to_seconds(str) {
let arr = str.split(':');
if (arr.length == 3)
return parseInt(arr[0]) * 3600 + parseInt(arr[1]) * 60 + parseInt(arr[2]);
else
return false;
}
/**
* 设置调试模式
* @param {bool} debug
*/
function deubg(debug) {
_common_Fuction.debug = debug;
}
auto.waitFor()
//设置起始步骤
let start_step = 1;
//sleep(5000);
if (start_step <= 1)
start();
//sleep(5000);
//stop();
if (start_step <= 2) {
app_aweme.task();
}
if (start_step <= 3) {
}
if (start_step <= 4) {
}
if (start_step <= 5) {
}
if (start_step <= 6) {
}