import pyautogui
import time
import random
def like_video():
# 模拟点击点赞按钮
# 注意:点赞按钮的位置需要根据屏幕分辨率和抖音界面进行调整
# 使用截图工具获取点赞按钮的位置
like_button_position = pyautogui.locateOnScreen(‘like_button.png’, confidence=0.8)
if like_button_position:
pyautogui.click(like_button_position)
print(“点赞成功”)
else:
print(“未找到点赞按钮”)
def comment_video(comment):
# 模拟点击评论框
# 使用截图工具获取评论框的位置
comment_box_position = pyautogui.locateOnScreen(‘comment_box.png’, confidence=0.8)
if comment_box_position:
pyautogui.click(comment_box_position)
time.sleep(1)
pyautogui.write(comment)
time.sleep(1)
pyautogui.press(‘enter’)
print(“评论成功”)
else:
print(“未找到评论框”)
def automate_douyin(comment_text):
for _ in range(5): # 假设对5个视频进行点赞和评论
try:
# 添加随机延迟避免被检测为机器人
time.sleep(random.uniform(1, 3))
like_video()
time.sleep(random.uniform(1, 3))
comment_video(comment_text)
time.sleep(random.uniform(1,

最低0.47元/天 解锁文章
1110

被折叠的 条评论
为什么被折叠?



