Appium之自动观看(刷)视频
作者:互联网
众所周知,目前某(kuai)些(shou)(ji su ban)App可以观看短视频来获取收益,从而提现,那么咱们就以此简单进行下技术交流,从而感受下技(zheng)术(qian)的乐趣。
全部代码奉上:
# coding=utf8
# App薅羊毛
from appium import webdriver
import time,traceback
import random
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '8'
desired_caps['deviceName'] = 'test'
# App包名、首页
desired_caps['appPackage'] = 'com.xxxx.xxxx'
desired_caps['appActivity'] = 'com.xxxx.xxxx.HomeActivity'
#desired_caps['unicodeKeyboard'] = True
#esired_caps['resetKeyboard'] = True
desired_caps['noReset'] = True
desired_caps['newCommandTimeout'] = 6000
#启动Remote RPC
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
time.sleep(5)
#获取屏幕宽度和高度
def getSize():
x = driver.get_window_size()['width']
y = driver.get_window_size()['height']
return (x, y)
#滑动
def swipeLeft():
l = getSize()
x1 = int(l[0] * 0.5)
y1 = int(l[1] * 0.9)
y2 = int(l[0] * 0.1)
driver.swipe(x1, y1, x1, y2)
NoX = 1
num = 1
while NoX > 0:
swipeLeft()
NoX = random.randint(15, 30)
time.sleep(NoX)
print(f"第{num}次,等待{NoX}秒")
num = num + 1
input('**** Press to quit..')
driver.quit()
注:本文仅用于技术交流,不得用于商业用途。不遵守者,与本文作者无关。
blingbling* 发布了23 篇原创文章 · 获赞 5 · 访问量 1万+ 私信 关注标签:视频,Appium,xxxx,driver,caps,desired,num,NoX,观看 来源: https://blog.csdn.net/qq_38112817/article/details/104629440