使用python实现自动点赞和评论

简介: 使用python实现自动点赞和评论

主要使用python中控制键盘和鼠标的库pyautogui
random用于实现随机间隔时间

完整代码如下:

import pyautogui,time,random

pyautogui.PAUSE = 3
pyautogui.FAILSAFE = True

width, height = pyautogui.size()
#print(str(width))
#print(str(height))

def drawRct():
    for i in range(10):
        pyautogui.moveTo(300, 300, duration=0.25)
        pyautogui.moveTo(400, 300, duration=0.25)
        pyautogui.moveTo(400, 400, duration=0.25)
        pyautogui.moveTo(300, 400, duration=0.25)


def mouseScroll():
    time.sleep(5)
    for i in range(10):
        pyautogui.scroll(-200)
        time.sleep(2)

def getXy():
    try:
        while True:
            x, y = pyautogui.position()
            print(x,y)
    except KeyboardInterrupt:
        print('\nExit.')


def playVideo(x,y):
    for i in range(4):
        pyautogui.click(x,y)
        x=x+240
        playAndComment()

def clickVideoAndComment(x,y):
    pyautogui.click(x,y)
    time.sleep(random.randint(5,15))
    pyautogui.scroll(-1000)
    pyautogui.scroll(-400)
    pyautogui.click(220,590)
    time.sleep(random.randint(1,3))
    pyautogui.typewrite('it is a good movie!')
    time.sleep(random.randint(1,3))
    pyautogui.click(839,630)
    pyautogui.click(710,16)
    pyautogui.click(860,300)
    

def playAndComment():
    time.sleep(random.randint(5,15))
    pyautogui.scroll(-400)
    pyautogui.scroll(-400)
    pyautogui.click(200,300)
    pyautogui.typewrite('good! movie')
    pyautogui.click(900,400)
    pyautogui.click(710,16)

if __name__ == '__main__':
    time.sleep(5)
    pyautogui.scroll(-300)
    for i in range(500):
        print(str(i))
        time.sleep(random.randint(3,5))
        pyautogui.scroll(-180)
        time.sleep(random.randint(1,5))
        clickVideoAndComment(250,200)
        #playVideo(404,330)
相关文章
|
6月前
|
JSON 算法 API
Python采集淘宝商品评论API接口及JSON数据返回全程指南
Python采集淘宝商品评论API接口及JSON数据返回全程指南
|
7月前
|
自然语言处理 算法 数据安全/隐私保护
item_review - Lazada 商品评论列表接口深度分析及 Python 实现
Lazada商品评论接口(item_review)可获取东南亚多国用户评分、评论内容、购买属性等数据,助力卖家分析消费者偏好、优化产品与营销策略。
|
7月前
|
JSON API 数据安全/隐私保护
Python采集淘宝评论API接口及JSON数据返回全流程指南
Python采集淘宝评论API接口及JSON数据返回全流程指南
JSON 监控 API
299 0
|
7月前
|
搜索推荐 算法 关系型数据库
基于python评论分析的商品推荐系统设计
本文介绍了多种开发技术,包括Python集成开发环境PyCharm、自然语言处理工具SnowNLP、关系型数据库MySQL、Python语言特性、Django Web框架以及协同过滤算法。内容涵盖各技术的基本功能、特点及其在实际开发中的应用,适用于初学者和开发者了解相关工具与框架的使用与优势。
|
8月前
|
存储 数据采集 数据可视化
Python爬取懂车帝/汽车之家评论并做竞品分析
Python爬取懂车帝/汽车之家评论并做竞品分析
|
9月前
|
数据安全/隐私保护 Python Windows
抖音评论点赞协议工具,小红书快手哔哩哔哩微博评论协议,python评论协议代码
代码实现包含4个模块:主协议工具类、辅助工具函数、主程序入口和配置文件。这些代码模拟了主
|
9月前
|
JSON API 数据格式
Python采集京东商品评论API接口示例,json数据返回
下面是一个使用Python采集京东商品评论的完整示例,包括API请求、JSON数据解析

推荐镜像

更多
下一篇
开通oss服务