This commit is contained in:
HuangHai
2026-01-13 11:33:57 +08:00
parent 5d8db39b1f
commit a6f942f6e6
7 changed files with 43 additions and 16 deletions

View File

@@ -55,7 +55,18 @@ async def check_and_close_ad(d):
logger.info(f"检测到广告关闭按钮: ({x}, {y}) [Type: {ad_type}]")
if ad_type == "rabbit":
logger.info(">>> 检测到兔子广告。根据策略,我们不再尝试关闭它,直接继续。")
logger.info(">>> 检测到兔子广告。尝试使用图片识别关闭...")
try:
# 使用用户验证有效的图片点击方法
template_path = os.path.join(BASE_DIR, "Template", "X.jpg")
if d.image.click(template_path, timeout=3.0):
logger.info(">>> 成功通过图片识别关闭兔子广告。")
await asyncio.sleep(1.5)
else:
logger.warning(">>> 图片识别未找到兔子广告关闭按钮,跳过。")
except Exception as ex:
logger.error(f">>> 图片识别关闭兔子广告异常: {ex}")
if os.path.exists(screenshot_path): os.remove(screenshot_path)
return True
else: