Python自动化完成tb喵币任务V2.0
生活随笔
收集整理的這篇文章主要介紹了
Python自动化完成tb喵币任务V2.0
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
今天刷tb的喵幣發(fā)現(xiàn)竟然更改了按鈕名稱(chēng),不知道是不是淘寶檢測(cè)到了規(guī)律性的訪問(wèn)還是。。。上有政策,下有對(duì)策,這次,我把全部坐標(biāo)獲取出來(lái),供選擇!這樣就可以不用進(jìn)開(kāi)發(fā)者模式找了。
import os,re import timedef go(x,y): for i in range(task):os.system('adb shell input tap {} {}'.format(x,y))#觸摸店鋪按鈕print('---開(kāi)始任務(wù)---')time.sleep(4)os.system('adb shell input tap {} {}'.format(1,1))#模擬滑動(dòng)界面print('---等待25秒---')time.sleep(25)print('---領(lǐng)取完成---')time.sleep(4)os.system('adb shell input keyevent 4')time.sleep(4)#os.system('adb shell input tap 518 2202')print('第{}任務(wù)領(lǐng)取完成'.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)#找到所有去瀏覽坐標(biāo) for i in e:g=re.search('\[(.*?)\]',i).group() print(g)print('以上是按照當(dāng)前淘寶所有排序的“去瀏覽”按鈕,請(qǐng)根據(jù)排序填入要刷取的任務(wù)')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會(huì)出現(xiàn)文件非淘寶xml c=open('123.txt',encoding='UTF-8')a=c.read()e=re.findall('<node index="2" text="去瀏覽"(.*?)/>',a)#找到所有去瀏覽坐標(biāo) for i in e:g=re.search('\[(.*?)\]',i).group()print(g)print('以下是按照當(dāng)前淘寶所有排序的“去瀏覽”按鈕,請(qǐng)根據(jù)排序填入要刷取的任務(wù)')else:print('xml文件錯(cuò)誤正在重新下載,請(qǐng)勿翻動(dòng)手機(jī)界面')os.remove('123.txt')go_2()except:print('錯(cuò)誤!正在回調(diào)函數(shù)')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('正在獲取頁(yè)面布局') print('----------------') go_2() print('author:劉秉哲') while 1:task=int(input('請(qǐng)輸入任務(wù)個(gè)數(shù):'))x=int(input('請(qǐng)輸入任務(wù)X坐標(biāo):'))y=int(input('請(qǐng)輸入任務(wù)y坐標(biāo):')) go(x+20,y+20)還有10天就要結(jié)束了,希望有所幫助,可以節(jié)約寶貴時(shí)間。
總結(jié)
以上是生活随笔為你收集整理的Python自动化完成tb喵币任务V2.0的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: VFP获取微信小程序用户openID,易
- 下一篇: Python中不为人知的四个特性