This commit is contained in:
HuangHai
2026-01-17 07:55:20 +08:00
parent e8eda77cb1
commit b12c9de620
6 changed files with 63 additions and 37 deletions

View File

@@ -51,25 +51,20 @@ async def check_and_close_ad(d):
if ad_result:
x, y = ad_result["x"], ad_result["y"]
ad_type = ad_result.get("ad_type")
logger.info(f"检测到广告关闭按钮: ({x}, {y}) [Type: {ad_type}]")
# 根据新的策略:完全静默忽略 rabbit 类型广告
if ad_type == "rabbit":
logger.info(">>> 检测到兔子广告。使用模型返回的坐标关闭...")
try:
d.click(x, y)
await asyncio.sleep(1.5)
except Exception as ex:
logger.error(f">>> 坐标点击兔子广告关闭按钮异常: {ex}")
if os.path.exists(screenshot_path): os.remove(screenshot_path)
if os.path.exists(screenshot_path):
os.remove(screenshot_path)
return True
else:
logger.info(f">>> 正在点击关闭非兔子广告 ({ad_type})...")
logger.info(f"检测到广告关闭按钮: ({x}, {y}) [Type: {ad_type}]")
logger.info(f">>> 正在点击关闭非 rabbit 广告 ({ad_type})...")
d.click(x, y)
await asyncio.sleep(2.0) # 等待关闭动画
if os.path.exists(screenshot_path): os.remove(screenshot_path)
if os.path.exists(screenshot_path):
os.remove(screenshot_path)
# 继续下一轮循环,检查是否还有其他广告
continue
else: