前言
读大学的表弟因为太勤快不想手动刷某通阅读叫我帮写个代码出来给他用,这不来了嘛。我记得
greasyfork网站不是有吗?
Python
1
| 正常写会报错,try一下就行。大致就是这样有其他需求可以调
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| import pyautogui import random
img_src = ('nextpage.png') sleep_time = random.randint(1, 5) def find_image(): pyautogui.sleep(sleep_time) click = pyautogui.locateOnScreen(img_src, confidence=0.9) center = pyautogui.center(click) pyautogui.click(center) print('点击') while True: try: click = pyautogui.locateOnScreen(img_src, confidence=0.9) if click: find_image() except Exception as e: pyautogui.sleep(sleep_time) scroll_amount = random.randint(-200, -150) pyautogui.scroll(scroll_amount) print('下移')
|