Python自动刷抖音视频 Python+uiautomator2实现自动刷抖音视频功能

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

Python自动刷抖音视频 Python+uiautomator2实现自动刷抖音视频功能

L.Sir   2021-04-29 我要评论
想了解Python+uiautomator2实现自动刷抖音视频功能的相关内容吗,L.Sir在本文为您仔细讲解Python自动刷抖音视频的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Python自动刷抖音视频,Python刷抖音视频,下面大家一起来学习吧。

工具准备

  • Python3.7.7
  • adb(Android debug bridge)
  • uiautomatorviewer

安装adb

官网地址:https://developer.android.google.cn/studio/command-line/adb

下载好解压后设置环境变量即可

在这里插入图片描述

安装uiautomatorviewer

参照此篇文章:https://www.cnblogs.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.csdn.net/plychoz/article/details/80231550

在这里插入图片描述

编写主程序

定位抖音位置

在这里插入图片描述

几种定位方式如下:

text:a(text=“抖音极速版”).click()resourceid:a(resourceId=“com.smartisanos.clock:id/text_stopwatch”).click()classname:a(className=“android.widget.TextView”).click()description :a(description="…").click()

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()

点击运行即可

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们