python利用pyautogui自动刷抖音(或其它短视频)

不多废话,打开模拟器抖音

import pyautogui
import pyautogui as pg
from time import sleep
# 按照指定区域截屏
def Auto():
    ai = pg.screenshot(region=(自定,自定,自定,自定))  # region(截图x坐标,y坐标,宽度,高度),坐标为指定截图的左上角坐标
    sleep(3)
    while True:
        xy = pyautogui.locateOnScreen(ai, confidence=0.87)#(0.87表示相似程度,太高不好,太低也不行)
        if xy is not None:
            pyautogui.scroll(-600)#这里可以用pyautogui的滑动,具体自研
            print('滑动成功!')
            sleep(3)
            ai = pg.screenshot(region=(1543, 39, 745, 1324))
            sleep(3)
            pass
        else:
            sleep(0.04)
            #print('没匹配到')
if __name__ == '__main__':
    Auto()

结尾:用自动脚本容易导致软件闪退

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要使用Python实现自动抖音,你需要先准备好一些工具和环境。首先,你需要安装Python 3.7.7,并且安装adb(Android Debug Bridge)和uiautomatorviewer。可以通过访问官方网站https://developer.android.google.***www.cnblogs.com/corsacsherry/p/10609339.html 的指导安装uiautomatorviewer。接下来,将手机通过USB连接到电脑上,并在手机上开启开发者选项和USB调试。在电脑上运行adb devices -l命令来查看已连接的设备。打开UIAutomatorViewer连接手机即可。然后,使用pip工具安装uiautomator2库,命令为pip install --pre -U uiautomator2。接着,给设备安装atx-agent,命令为python -m uiautomator2 init。确保设备已打开并允许安装uiautomator.apk。接下来,可以编写主程序来实现自动抖音。可以使用不同的定位方式来定位抖音的位置,比如通过text、resourceid、classname或description。然后,使用uiautomator2库中的方法来实现滑动视频等操作。最后,通过点击运行即可开始自动抖音的过程。 总结来说,要使用Python实现自动抖音,你需要安装Python和相关工具,连接手机到电脑上,并编写脚本来控制手机进行相关操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Python+uiautomator2实现自动抖音视频](https://blog.csdn.net/qq_33235529/article/details/116228152)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Python骚操作—自动抖音](https://blog.csdn.net/wade1203/article/details/105108614)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值