|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
首先PC端安装ADB包(安卓调试桥),手机连接电脑(USB连接)打开发者模式,开启USB调试,打开抖音首页中随便选取一名用户,点开他的粉丝,点击运行代码(没有权限上传不了图片,所以大家只能去理解文字了)
代码如下:
- import os
- from PIL import Image
- import time
- #获取图片
- def screencap():
- #将手机截屏图片并保存在手机上
- os.system("adb shell screencap -p /sdcard/screen.png")
- #将保存图片上传到电脑上
- os.system("adb pull /sdcard/screen.png")
- def get_y_position():
- #y_list = [] #方法二列表方法
- #处理图片,点关注是横坐标不变,Y坐标变化-RGB=254,78,112
- image = Image.open("screen.png")
- #打印图片尺寸(1080,2340)
- print(image.size)
- # 打印以横坐标不变,纵坐标一直变化的值
- for i in [930]:
- for y in range(2340):
- if image.getpixel((i,y)) == (254,78,112,255):
- #y_list.oppend(y) #方法二:循环y并添加到列表里
- #生成器
- yield y
- #return y_list #方法二
- #运行函数
- print(get_y_position())
- #循环5次,可以更改数值
- for n in range(5):
- #截图
- screencap()
- #得到Y坐标
- y_position = get_y_position()
- #把得到的y值全部取出
- for y in y_position:
- #调用循环点击
- os.system("adb shell input tap 930 {}".format(y))
- #os.system(f"adb shell input tap 930 {y}") #另一种传入Y的方法
- #时间延迟,隔1秒关注一次
- time.sleep(1)
- print("正在关注.......................")
- #划动屏幕,选定一个坐标(x1 y1 x2 y2)
- os.system("adb shell input swipe 540 1500 540 645")
复制代码
ADB下载网址 |
|