This commit is contained in:
HuangHai
2026-01-12 22:59:53 +08:00
parent fa1beb3b3f
commit b07dca28b5
9 changed files with 226 additions and 12 deletions

View File

@@ -168,9 +168,25 @@ async def get_station_list(d, service, uploader, max_scrolls=MAX_SCROLLS):
logger.info("检查是否存在广告弹窗...")
ad_res = await ReadImageKit.detect_ad_popup(screenshot_path, device_info=device_info)
if ad_res:
logger.info(f"检测到广告弹窗,准备关闭: {ad_res}")
d.click(ad_res['x'], ad_res['y'])
await asyncio.sleep(1.5)
ad_type = ad_res.get("ad_type")
logger.info(f"检测到广告弹窗,准备关闭: {ad_res} [Type: {ad_type}]")
x, y = ad_res['x'], ad_res['y']
if ad_type == "rabbit":
logger.info(">>> 检测到顽固的兔子广告,执行强力双击策略...")
# 使用 u2 的 double_click,它比两次 click + sleep 更快
d.double_click(x, y, duration=0.05)
# 处理“误触背景卡片”的逻辑:既然可能进去了,就等一会儿再退出来
logger.info(">>> 考虑到可能误触背景卡片,等待 2s 后执行返回操作...")
await asyncio.sleep(2.0)
d.press("back")
await asyncio.sleep(1.0)
logger.info(">>> 已尝试从误触页面返回。")
else:
d.click(x, y)
await asyncio.sleep(1.5)
# 重新截图
if os.path.exists(screenshot_path): os.remove(screenshot_path)
screenshot_path = take_screenshot(d, image_uuid, save_dir=TEMP_IMAGE_DIR)