本篇文章小编给大家分享一下Python+uiautomator2实现自动刷抖音视频功能代码示例,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
工具准备
Python3.7.7
adb(Android debug bridge)
uiautomatorviewer
安装adb
官网地址:https://developer.*an*droid.g*oogle.cn/studio/command-pne/adb
下载好解压后设置环境变量即可
安装uiautomatorviewer
参照此篇文章:https://www.*cnblog**s.com/corsacsherry/p/10609339.html
调试工具
手机通过USB连接到电脑上开启开发者选项和USB调试
在电脑上通过adb devices -l命令查看已连接的设备
打开UIAutomatorViewer连接手机即可
Python安装uiautomator2
pip install --pre -U uiautomator2
给设备安装atx-agent
python -m uiautomator2 init
注意打开设备,允许uiautomator.apk的安装
参考连接:https://blog.**c*sdn.net/plychoz/article/details/80231550
编写主程序
定位抖音位置
几种定位方式如下:
text:a(text=“抖音极速版”).cpck()resourceid:a(resourceId=“com.smartisanos.clock:id/text_stopwatch”).cpck()classname:a(className=“android.widget.TextView”).cpck()description :a(description="…").cpck()
import uiautomator2 as d import time def douyin(): #通过usb连接 a=d.connect_usb('3d51a18c') # 打开抖音 a(text="抖音极速版").click() while True: time.sleep(10) # 滑动视频 a.swipe(313,1370,313,110) if __name__=='__main__': douyin()
点击运行即可
一亿小目标手游
如果让你的人生从来,你可以像王健林一样霸气的表示一亿小目标吗
一亿小目标手机版2019
一亿小目标手机版2019趣味休闲模拟游戏,玩家在游戏中将会通
巴啦啦梦幻餐厅
巴啦啦梦幻餐厅是一款充满魔幻色彩的二次元模拟经营手游,游戏界
恋爱进行时九游版
恋爱进行时九游版是一款以模拟恋爱玩法为核心的角色扮演手游,精
皇室对决fr(Null’s Royale)
皇室对决fr,即皇室战争的私服变态版本,在该版本中玩家能够拥