From d1fc71c6a359e7d068a66324eaa8acd4646af30d Mon Sep 17 00:00:00 2001 From: OoO Date: Tue, 28 Apr 2026 14:26:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=B0=E5=A2=9E=20Vue.js=20=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E9=A0=81=E9=9D=A2=E6=94=AF=E6=8F=B4=E7=9A=84=E7=AD=96?= =?UTF-8?q?=E7=95=A5=203=20=E5=92=8C=E7=AD=96=E7=95=A5=204?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scheduler.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scheduler.py b/scheduler.py index 6b276d4..10da552 100644 --- a/scheduler.py +++ b/scheduler.py @@ -843,6 +843,20 @@ def _find_component_areas_with_diagnostic(driver_or_element): logging.info(f"[Crawler] [Helper] ✅ 策略 2 成功 | Found: {len(areas)} blocks") return areas + # 策略 3: Vue.js 模板頁面 - 查找包含商品的 Area div + logging.info("[Crawler] [Helper] ⚠️ 策略 2 失敗 | Action: 嘗試查找 Vue.js 模板頁面的商品區塊 '[class*=\"Area_boxstyle\"]'...") + areas = driver_or_element.find_elements(By.CSS_SELECTOR, '[class*="Area_boxstyle"]') + if areas: + logging.info(f"[Crawler] [Helper] ✅ 策略 3 成功 | Found: {len(areas)} blocks") + return areas + + # 策略 4: 直接查找包含商品的 ul/li 列表(某些頁面沒有包裝區塊) + logging.info("[Crawler] [Helper] ⚠️ 策略 3 失敗 | Action: 嘗試直接查找商品列表 '.Area_swiper'...") + areas = driver_or_element.find_elements(By.CSS_SELECTOR, '.Area_swiper, .Area_boxstyle_icon, .swiper-wrapper') + if areas: + logging.info(f"[Crawler] [Helper] ✅ 策略 4 成功 | Found: {len(areas)} blocks") + return areas + # 如果所有策略都失敗,返回空列表 logging.warning("[Crawler] [Helper] ❌ 所有策略均失敗 | Info: 未能找到任何商品區塊") return []