今天刷tb的喵币发现竟然更改了按钮名称,不知道是不是淘宝检测到了规律性的访问还是。。。上有政策,下有对策,这次,我把全部坐标获取出来,供选择!这样就可以不用进开发者模式找了。
import os,re
import time
def go(x,y):
for i in range(task):
os.system('adb shell input tap {} {}'.format(x,y))#触摸店铺按钮
print('---开始任务---')
time.sleep(4)
os.system('adb shell input tap {} {}'.format(1,1))#模拟滑动界面
print('---等待25秒---')
time.sleep(25)
print('---领取完成---')
time.sleep(4)
os.system('adb shell input keyevent 4')
time.sleep(4)
#os.system('adb shell input tap 518 2202')
print('第{}任务领取完成'.format(i+1))
print('______________________')
def go_2():
if os.path.exists('123.txt'):
c=open('123.txt',encoding='UTF-8')
a=c.read()
e=re.findall('<node index="2" text="去浏览"(.*?)/>',a)#找到所有去浏览坐标
for i in e:
g=re.search('\[(.*?)\]',i).group()
print(g)
print('以上是按照当前淘宝所有排序的“去浏览”按钮,请根据排序填入要刷取的任务')
print('---------------------------')
else:
try:
os.system('adb shell uiautomator dump /sdcard/ui.xml')
time.sleep(2)
os.system('adb shell uiautomator dump /sdcard/ui.xml')
os.system('adb pull /sdcard/ui.xml 123.txt')
size=get_FileSize('123.txt')
if size>=0.03:#第一次获取ui会出现文件非淘宝xml
c=open('123.txt',encoding='UTF-8')
a=c.read()
e=re.findall('<node index="2" text="去浏览"(.*?)/>',a)#找到所有去浏览坐标
for i in e:
g=re.search('\[(.*?)\]',i).group()
print(g)
print('以下是按照当前淘宝所有排序的“去浏览”按钮,请根据排序填入要刷取的任务')
else:
print('xml文件错误正在重新下载,请勿翻动手机界面')
os.remove('123.txt')
go_2()
except:
print('错误!正在回调函数')
if os.path.exists('123.txt'):
os.remove('123.txt')
go_2()
def get_FileSize(filePath):
fsize = os.path.getsize(filePath)
fsize = fsize/float(1024 * 1024)
return round(fsize, 2)
print('正在获取页面布局')
print('----------------')
go_2()
print('author:刘秉哲')
while 1:
task=int(input('请输入任务个数:'))
x=int(input('请输入任务X坐标:'))
y=int(input('请输入任务y坐标:'))
go(x+20,y+20)
还有10天就要结束了,希望有所帮助,可以节约宝贵时间。