From 234f91a14a9de4901322b0a08e899354d6cc60e2 Mon Sep 17 00:00:00 2001 From: AutonetSellCar Deploy Date: Thu, 2 Apr 2026 12:53:37 +0900 Subject: [PATCH] fix: Parse actual image URLs from search HTML for thumbnails Extract main_image from HTML img tags instead of constructing from car_no pattern. Handles timestamp-based filenames (e.g., 1767925381_0.jpg) that differ from the default cmcar_0.jpg pattern. Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/app/api/carmodoo.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/backend/app/api/carmodoo.py b/backend/app/api/carmodoo.py index 9932ab1..d989e15 100644 --- a/backend/app/api/carmodoo.py +++ b/backend/app/api/carmodoo.py @@ -516,9 +516,23 @@ class CarmodooClient: except: pass - # 이미지 URL 생성 - car_no_padded = car_no.zfill(9) - main_image = f"{CARMODOO_BASE_URL}/data/__carPhoto/{car_no_padded[:3]}/{car_no_padded[3:6]}/{car_no_padded[6:]}/cmcar_0.jpg" + # 이미지 URL: HTML img 태그에서 실제 URL 추출 (타임스탬프 패턴 대응) + main_image = "" + img_elems = row.xpath('.//img[contains(@src, "__carPhoto")]/@src') + if img_elems: + img_src = img_elems[0] + # __THUM 접미사 제거하여 원본 이미지 URL 생성 + img_src = img_src.replace('__THUM', '') + if img_src.startswith('/'): + main_image = f"{CARMODOO_BASE_URL}{img_src}" + elif img_src.startswith('http'): + main_image = img_src + else: + main_image = f"{CARMODOO_BASE_URL}/{img_src}" + if not main_image: + # 폴백: 기존 패턴 + car_no_padded = car_no.zfill(9) + main_image = f"{CARMODOO_BASE_URL}/data/__carPhoto/{car_no_padded[:3]}/{car_no_padded[3:6]}/{car_no_padded[6:]}/cmcar_0.jpg" # 성능점검번호 및 key 추출 시도 check_num = ""