当前位置:
首页 >
Python微信点赞
发布时间:2023/12/14
33
豆豆
生活随笔
收集整理的这篇文章主要介绍了
Python微信点赞
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
1.png
2.png
3.png
4.png
5.png
6.png
import pyautogui #导入鼠标键盘库 import time #进入微信 WX_location=pyautogui.locateCenterOnScreen('1.png',confidence=0.9) #查找精确度为1.0,即百分之百精准匹配——这其实很不方便,实际我们把精确度设为0.9更科学,既能保证不会找错对象,又不会因为默认的精确度太苛刻,明明对象存在代码却找不到而返回None pyautogui.click(WX_location.x,WX_location.y,clicks=2,interval=0.1,duration=0.2,button="left")#点击次数默认是1 while True:Logon_location=pyautogui.locateCenterOnScreen('2.png',confidence=0.9)if Logon_location is not None:pyautogui.click(Logon_location.x,Logon_location.y,clicks=1,interval=0.2,duration=0.2,button="left")#点击次数默认是1breakprint("未找到匹配图片,0.1秒后重试")time.sleep(0.1) #进入朋友圈 while True:Circle_location=pyautogui.locateCenterOnScreen('3.png',confidence=0.9)if Circle_location is not None:pyautogui.click(Circle_location.x,Circle_location.y,clicks=1,interval=0.2,duration=0.2,button="left")#点击次数默认是1breakprint("未找到匹配图片,0.1秒后重试")time.sleep(0.1) #进入点赞界面while True:Comment_location=pyautogui.locateCenterOnScreen('4.png',confidence=0.9)if Comment_location is not None:pyautogui.click(Comment_location.x,Comment_location.y,clicks=1,interval=0.2,duration=0.2,button="left")#点击次数默认是1breakprint("未找到匹配图片,0.1秒后重试")time.sleep(0.1) #点赞 roll = -100 while True:Like_location=pyautogui.locateCenterOnScreen('5.png',confidence=0.9)Liked_location=pyautogui.locateCenterOnScreen('6.png',confidence=0.9)if Liked_location is not None:while True:pyautogui.scroll(roll) # 向下滚动100Comment_location = pyautogui.locateCenterOnScreen('4.png', confidence=0.9)if Comment_location is not None:pyautogui.click(Comment_location.x, Comment_location.y, clicks=1, interval=0.2, duration=0.2,button="left")breakprint("未找到匹配图片,0.1秒后重试")time.sleep(0.5)roll=roll-500elif Like_location is not None:pyautogui.click(Like_location.x, Like_location.y, clicks=1, interval=0.2, duration=0.2,button="left")else:while True:Comment_location = pyautogui.locateCenterOnScreen('4.png', confidence=0.9)if Comment_location is not None:pyautogui.click(Comment_location.x, Comment_location.y, clicks=1, interval=0.2, duration=0.2,button="left") # 点击次数默认是1breakprint("未找到匹配图片,0.1秒后重试")time.sleep(0.1)参考:
哔哩哔哩: up主 不开心就喝水 的代码
哔哩哔哩视频链接
总结
以上是生活随笔为你收集整理的Python微信点赞的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Parsing error: No Ba
- 下一篇: python利用以下公式求π的值_Pyt