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")#点击次数默认是1
        break
    print("未找到匹配图片,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")#点击次数默认是1
        break
    print("未找到匹配图片,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")#点击次数默认是1
        break
    print("未找到匹配图片,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)  # 向下滚动100
            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")
                break
            print("未找到匹配图片,0.1秒后重试")
            time.sleep(0.5)
            roll=roll-500
    elif 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")  # 点击次数默认是1
                break
            print("未找到匹配图片,0.1秒后重试")
            time.sleep(0.1)

参考:

        哔哩哔哩: up主   不开心就喝水  的代码

哔哩哔哩视频链接

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值