python+adb命令实现自动刷视频脚本案例


Posted in Python onApril 23, 2020

python小白第一次发博客,自己自学了一下写了一个demo,可能语法啥的不够标准,毕竟没有真正学过python

主要用到的是

import os #os包用于运行cmd命令
adb shell #这个有很多命令我们主要是模拟滑动

直接看代码吧

手机要先连接电脑打开usb调试模式

# _*_ coding:utf-8 _*_
#
# @Version : 1.0
# @Time : 2019/9/10
# @Author :wang

import os
import time
b = 0

def video: 
 fun=os.system('adb shell input swipe 300 600 300 100') ##坐标根据需要自己修改
 time.sleep(13)

if __name__ == '__main__':
 os.chdir("D:\\adb")   ##切换到adb所在目录可以自己修改
 print("已连接设备名称如下:")
 fun= os.system('adb devices')
 a=input('输入次数需要滑动的次数:')
 a=int(a)
  while b<a:
   video()  ##循环结构中调用函数
   b=b+1
   print("任务完成",b,"次")
  else:
   print("任务全部完成")
   fun=os.system('adb kill-server') ##运行结束杀掉adb进程
   exit()

文章到这就结束啦!!有需要的人可以拿去!

补充知识:使用pip安装pocoui

废话不多说,直接看代码!

adog@E531:~$ pip3 install pocoui -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
Collecting pocoui
 Downloading http://pypi.doubanio.com/packages/79/b7/0a097349da63681463f62680b01b987e91af5804d59b9fbb33798ae2c614/pocoui-1.0.76.tar.gz (2.6MB)
 100% |????????????????????????????????| 2.6MB 12.1MB/s 
Collecting airtest (from pocoui)
 Downloading http://pypi.doubanio.com/packages/b7/57/3547f040fced101ba57a2360b134940adb0865aa00e5d1bc2b64750fb15f/airtest-1.0.27.tar.gz (16.9MB)
 100% |????????????????????????????????| 16.9MB 10.4MB/s 
Collecting hrpc>=1.0.5 (from pocoui)
 Downloading http://pypi.doubanio.com/packages/9a/15/8d518fc4d930d6a3e080663c1fe825ac9d63cf8ae1988ceab45c83cdf1ef/hrpc-1.0.8.tar.gz
Collecting requests (from pocoui)
 Downloading http://pypi.doubanio.com/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl (57kB)
 100% |????????????????????????????????| 61kB 18.2MB/s 
Collecting six (from pocoui)
 Downloading http://pypi.doubanio.com/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting websocket-client (from pocoui)
 Downloading http://pypi.doubanio.com/packages/29/19/44753eab1fdb50770ac69605527e8859468f3c0fd7dc5a76dd9c4dbd7906/websocket_client-0.56.0-py2.py3-none-any.whl (200kB)
 100% |????????????????????????????????| 204kB 12.1MB/s 
Collecting Jinja2>=2.8 (from airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl (124kB)
 100% |????????????????????????????????| 133kB 12.0MB/s 
Collecting Pillow>=3.4.0 (from airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/14/41/db6dec65ddbc176a59b89485e8cc136a433ed9c6397b6bfe2cd38412051e/Pillow-6.1.0-cp36-cp36m-manylinux1_x86_64.whl (2.1MB)
 100% |????????????????????????????????| 2.1MB 11.0MB/s 
Collecting facebook-wda (from airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/7a/12/dde509bd5cca43c40b1a084b56980c1803d5cb46f4bf20bb0f2675350cfe/facebook_wda-0.3.4-py3-none-any.whl
Collecting mss (from airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/67/2a/8e26437bcc840e19ca5290897d47f5405e302af27d4a6401e0b0edc39942/mss-4.0.3-py2.py3-none-any.whl
Collecting opencv-contrib-python<=3.4.2.17 (from airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/61/29/fc60b2de1713aa92946992544329f20ccb5e4ba26290f403e04b7da44105/opencv_contrib_python-3.4.2.17-cp36-cp36m-manylinux1_x86_64.whl (30.6MB)
 100% |????????????????????????????????| 30.6MB 173kB/s 
Collecting pywinauto==0.6.3 (from airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/9c/08/4b04e2e1a7b1ee8ed03e79ac1acf2948d40de8f37bff3fa7d170420fa975/pywinauto-0.6.3.zip (515kB)
 100% |????????????????????????????????| 522kB 1.8MB/s 
Collecting certifi>=2017.4.17 (from requests->pocoui)
 Downloading http://pypi.doubanio.com/packages/69/1b/b853c7a9d4f6a6d00749e94eb6f3a041e342a885b87340b79c1ef73e3a78/certifi-2019.6.16-py2.py3-none-any.whl (157kB)
 100% |????????????????????????????????| 163kB 12.7MB/s 
Collecting idna<2.9,>=2.5 (from requests->pocoui)
 Downloading http://pypi.doubanio.com/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
 100% |????????????????????????????????| 61kB 17.5MB/s 
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->pocoui)
 Downloading http://pypi.doubanio.com/packages/e6/60/247f23a7121ae632d62811ba7f273d0e58972d75e58a94d329d51550a47d/urllib3-1.25.3-py2.py3-none-any.whl (150kB)
 100% |????????????????????????????????| 153kB 12.1MB/s 
Collecting chardet<3.1.0,>=3.0.2 (from requests->pocoui)
 Downloading http://pypi.doubanio.com/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
 100% |????????????????????????????????| 143kB 12.7MB/s 
Collecting MarkupSafe>=0.23 (from Jinja2>=2.8->airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/b2/5f/23e0023be6bb885d00ffbefad2942bc51a620328ee910f64abe5a8d18dd1/MarkupSafe-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting retry (from facebook-wda->airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/4b/0d/53aea75710af4528a25ed6837d71d117602b01946b307a3912cb3cfcbcba/retry-0.9.2-py2.py3-none-any.whl
Collecting numpy>=1.11.3 (from opencv-contrib-python<=3.4.2.17->airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/19/b9/bda9781f0a74b90ebd2e046fde1196182900bd4a8e1ea503d3ffebc50e7c/numpy-1.17.0-cp36-cp36m-manylinux1_x86_64.whl (20.4MB)
 100% |????????????????????????????????| 20.4MB 12.6MB/s 
Collecting python-xlib (from pywinauto==0.6.3->airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/f7/91/9f794491d1a8b810a9d4bb8fc9766a98354cb62bd6990685032b00f87001/python_xlib-0.25-py2.py3-none-any.whl (165kB)
 100% |????????????????????????????????| 174kB 2.4MB/s 
Collecting decorator>=3.4.2 (from retry->facebook-wda->airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/5f/88/0075e461560a1e750a0dcbf77f1d9de775028c37a19a346a6c565a257399/decorator-4.4.0-py2.py3-none-any.whl
Collecting py<2.0.0,>=1.4.26 (from retry->facebook-wda->airtest->pocoui)
 Downloading http://pypi.doubanio.com/packages/76/bc/394ad449851729244a97857ee14d7cba61ddb268dce3db538ba2f2ba1f0f/py-1.8.0-py2.py3-none-any.whl (83kB)
 100% |????????????????????????????????| 92kB 16.9MB/s 
Building wheels for collected packages: pocoui, airtest, hrpc, pywinauto
 Running setup.py bdist_wheel for pocoui ... done
 Stored in directory: /home/adog/.cache/pip/wheels/ea/20/dc/bbcabf53feb44ad7512a65ca26a93881f6dfcb26649a8c89fe
 Running setup.py bdist_wheel for airtest ... done
 Stored in directory: /home/adog/.cache/pip/wheels/2b/ce/30/7681374d47c352af5cff82dd99836dfa24eb7fabc28a0fb8c8
 Running setup.py bdist_wheel for hrpc ... done
 Stored in directory: /home/adog/.cache/pip/wheels/8d/ed/4f/1b65f18415284353e94c25484c8b5d21e6b0891da11c104666
 Running setup.py bdist_wheel for pywinauto ... done
 Stored in directory: /home/adog/.cache/pip/wheels/6b/dd/3e/6cb88548ba8d2a2cd9100758b761607601707b465362f34e84
Successfully built pocoui airtest hrpc pywinauto
Installing collected packages: MarkupSafe, Jinja2, Pillow, certifi, idna, urllib3, chardet, requests, decorator, py, retry, six, facebook-wda, mss, numpy, opencv-contrib-python, python-xlib, pywinauto, airtest, hrpc, websocket-client, pocoui
Successfully installed Jinja2-2.10.1 MarkupSafe-1.1.1 Pillow-6.1.0 airtest-1.0.27 certifi-2019.6.16 chardet-3.0.4 decorator-4.4.0 facebook-wda-0.3.4 hrpc-1.0.8 idna-2.8 mss-4.0.3 numpy-1.17.0 opencv-contrib-python-3.4.2.17 pocoui-1.0.76 py-1.8.0 python-xlib-0.25 pywinauto-0.6.3 requests-2.22.0 retry-0.9.2 six-1.12.0 urllib3-1.25.3 websocket-client-0.56.0

以上这篇python+adb命令实现自动刷视频脚本案例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。

Python 相关文章推荐
Python 自动安装 Rising 杀毒软件
Apr 24 Python
python基于xmlrpc实现二进制文件传输的方法
Jun 02 Python
Zabbix实现微信报警功能
Oct 09 Python
python cx_Oracle模块的安装和使用详细介绍
Feb 13 Python
只需7行Python代码玩转微信自动聊天
Jan 27 Python
Python实现微信中找回好友、群聊用户撤回的消息功能示例
Aug 23 Python
django框架forms组件用法实例详解
Dec 10 Python
Python各种扩展名区别点整理
Feb 27 Python
python GUI库图形界面开发之PyQt5单选按钮控件QRadioButton详细使用方法与实例
Feb 28 Python
Python装饰器结合递归原理解析
Jul 02 Python
推荐技术人员一款Python开源库(造数据神器)
Jul 08 Python
Python3利用scapy局域网实现自动多线程arp扫描功能
Jan 21 Python
python+adb+monkey实现Rom稳定性测试详解
Apr 23 #Python
通过python调用adb命令对App进行性能测试方式
Apr 23 #Python
python 将视频 通过视频帧转换成时间实例
Apr 23 #Python
Windows下Anaconda和PyCharm的安装与使用详解
Apr 23 #Python
如何实现在jupyter notebook中播放视频(不停地展示图片)
Apr 23 #Python
Django调用百度AI接口实现人脸注册登录代码实例
Apr 23 #Python
Anaconda和ipython环境适配的实现
Apr 22 #Python
You might like
锁定年轻人的双倍活力 星巴克推出星倍醇即饮浓咖啡
2021/03/03 咖啡文化
php使用ffmpeg获取视频信息并截图的实现方法
2016/05/03 PHP
Laravel 5.5 实现禁用用户注册示例
2019/10/24 PHP
javascript 页面划词搜索JS
2009/09/28 Javascript
JavaScript 对象成员的可见性说明
2009/10/16 Javascript
利用JQuery+EasyDrag 实现弹出可拖动的Div,同时向Div传值,然后返回Div选中的值
2009/10/24 Javascript
javascript 事件处理程序介绍
2012/06/27 Javascript
jquery 简单应用示例总结
2013/08/09 Javascript
方便实用的jQuery checkbox复选框全选功能简单实例
2013/10/09 Javascript
Area 区域实现post提交数据的js写法
2014/04/22 Javascript
js去除浏览器默认底图的方法
2015/06/08 Javascript
基于JS实现PHP的sprintf函数实例
2015/11/14 Javascript
将List对象列表转换成JSON格式的类实现方法
2016/07/04 Javascript
BootStrap Table 获取同行不同列元素的方法
2016/12/19 Javascript
微信小程序 基础知识css样式media标签
2017/02/15 Javascript
JS实现websocket长轮询实时消息提示的效果
2017/10/10 Javascript
node实现的爬虫功能示例
2018/05/04 Javascript
浅谈高大上的微信小程序中渲染html内容—技术分享
2018/10/25 Javascript
js实现黑白div块画空心的图形
2018/12/13 Javascript
node.js中 mysql 增删改查操作及async,await处理实例分析
2020/02/11 Javascript
js实现验证码干扰(静态)
2021/02/22 Javascript
[01:28:43]2014 DOTA2华西杯精英邀请赛5 24 DK VS CIS
2014/05/25 DOTA
[04:52]DOTA2亚洲邀请赛附加赛 TOP10精彩集锦
2015/01/29 DOTA
[49:27]2018DOTA2亚洲邀请赛 4.4 淘汰赛 TNC vs VG 第一场
2018/04/05 DOTA
[01:20:06]TNC vs VG 2018国际邀请赛小组赛BO2 第二场 8.16
2018/08/17 DOTA
python实现的简单FTP上传下载文件实例
2015/06/30 Python
使用python将微信image下.dat文件解密为.png的方法
2020/11/30 Python
韩国最大的购物网站:Gmarket
2019/06/20 全球购物
智能钱包:Ekster
2019/11/21 全球购物
艺术专业大学生自我评价
2013/09/22 职场文书
作风建设演讲稿
2014/05/23 职场文书
航海技术专业毕业生推荐信
2014/07/09 职场文书
2014年作风建设工作总结
2014/10/29 职场文书
2014年留守儿童工作总结
2014/12/10 职场文书
确保减税降费落地生根,用实实在在措施
2019/07/19 职场文书
Win11怎么把合并的任务栏分开 Win11任务栏合并分开教程
2022/04/06 数码科技