'commit'
This commit is contained in:
@@ -57,13 +57,21 @@ async def check_and_close_ad(d):
|
||||
if ad_type == "rabbit":
|
||||
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)
|
||||
template_path_1 = os.path.join(BASE_DIR, "Template", "X1.jpg")
|
||||
template_path_2 = os.path.join(BASE_DIR, "Template", "X2.jpg")
|
||||
clicked = False
|
||||
if d.image.click(template_path_1, timeout=3.0):
|
||||
logger.info(">>> 成功通过图片识别关闭兔子广告 (X1 模板)。")
|
||||
clicked = True
|
||||
else:
|
||||
logger.warning(">>> 图片识别未找到兔子广告关闭按钮,跳过。")
|
||||
logger.warning(">>> X1 模板未找到兔子广告关闭按钮,尝试 X2 模板。")
|
||||
if d.image.click(template_path_2, timeout=3.0):
|
||||
logger.info(">>> 成功通过图片识别关闭兔子广告 (X2 模板)。")
|
||||
clicked = True
|
||||
else:
|
||||
logger.warning(">>> X2 模板也未找到兔子广告关闭按钮。")
|
||||
if clicked:
|
||||
await asyncio.sleep(1.5)
|
||||
except Exception as ex:
|
||||
logger.error(f">>> 图片识别关闭兔子广告异常: {ex}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user