【测开实战】adb+python自动化刷快手/抖音视频来赚金币

前置条件:电脑配置adb命令环境

import threading
import subprocess
import time
import datetime
import re

# 支持多个手机同时执行上滑操作刷视频
class myThread(threading.Thread):
    def __init__(self, did):
        threading.Thread.__init__(self)
        self.did = did

    def run(self):
        swipePhone(self.did)

# 执行shell命令
def ShellExecute(shellString):
    print(shellString,end=':::' + datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S')+'\n')
    subprocess.Popen(shellString, shell=True, stdout=subprocess.PIPE)

# 执行shell命令并拿到返回数据
def getShellExecuteReturn(shellString):
    print(shellString)
    sub = subprocess.Popen(shellString, shell=True, stdout=subprocess.PIPE)
    string = sub.stdout.read()
    results = string.decode().split('\n')
    results1 = []
    for i in results:
        if i is not None and i != '':
            results1.append(i)
    return results1

# 获取手机屏幕尺寸 x和y
def getFull(did):
    lenWig = []
    result = getShellExecuteReturn('adb -s ' + did + ' shell getevent -p | grep -e "0035" -e "0036"')
    for i in result:
        regex = 'max .*?(.*?),.*?'
        results = re.findall(regex, i, re.S)
        if len(results) > 0:
            lenWig.append(int(results[0]))
    return lenWig

# 滑动屏幕
def swipePhone(did):
    full = getFull(did)
    startx = str(full[0]/2)
    endx = str(full[0] / 2)
    starty = str(full[1]/10 * 8)
    endy = str(full[1] / 10)

    while True:
        shellString = 'adb -s ' + did + ' shell input swipe ' + startx + ' ' + starty + ' ' + endx + ' ' + endy + ' 500'
        ShellExecute(shellString)
        time.sleep(20)

didList = []
#荣耀x7
didList.append('A5R7N17C22001628')
#一加9r
didList.append('eeb3594b')

for i in didList:
    thread = myThread(i)
    thread.start()
  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值