from pynput import mouse, keyboard import subprocess import time import pyautogui import pyperclip import re import tkinter as tk from tkinter import simpledialog
# 全局变量来存储鼠标点击位置 mouse_positions = []
# 鼠标点击事件处理函数 defon_click(x, y, button, pressed): if pressed and button == mouse.Button.left: # 只处理左键点击 mouse_positions.append((x, y)) print(f"第 {len(mouse_positions)} 次点击的位置: ({x}, {y})")
for i in episode_range: if exit_flag: break url = base_url.format(i) process = subprocess.Popen([chrome_path, url]) time.sleep(3) move_and_click(first_click_position) time.sleep(0.5) move_and_click(second_click_position) time.sleep(0.5) copied_link = pyperclip.paste()
# 进入 while 循环,检查剪贴板内容是否更新 while copied_link == last_copied_link: time.sleep(1) move_and_click(first_click_position) move_and_click(second_click_position) time.sleep(0.5) copied_link = pyperclip.paste() if exit_flag: break
if copied_link != last_copied_link: last_copied_link = copied_link print(f"复制的链接: {copied_link}") withopen("copied_links.txt", "a") as file: file.write(copied_link + "\n") links_count += 1 else: print("剪贴板内容未更新,跳过写入。") time.sleep(0.5) pyautogui.hotkey('ctrl', 'w') time.sleep(0.5) if exit_flag: break