fix: 新增 Vue.js 模板頁面支援的策略 3 和策略 4
All checks were successful
CD Pipeline / deploy (push) Successful in 1m19s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m19s
This commit is contained in:
14
scheduler.py
14
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 []
|
||||
|
||||
Reference in New Issue
Block a user