fix: 네이버 가게명 추출(og:title) + 뷰어 재생바 노출 + 생성 진행 UI 단순화
- naver.py: span.GHAhO 난독 클래스 변경으로 가게명이 'AI 브리핑'으로 잘못 잡히던 버그 수정. og:title 메타 우선 추출(_store_name/_clean_store), 섹션명·'네이버' 포함값 배제. 브리핑·사진 크롤 양쪽 적용. - 뷰어: 하단 제목/설명 오버레이가 네이티브 재생바를 가리던 문제 → 56px 위로 올리고 pointer-events:none 으로 탐색바 조작 가능하게. - 생성 진행: 시나리오/가게/로그 등 제거, '영상 생성 중' + 진행바 + 퍼센트만. step(0~4)→% (완료 전 96% 상한, 완성 100%), shimmer 애니메이션. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
39483e2bfb
commit
061d6b36b8
3 files changed
+62
-40
No files matched your search
+35
-14
@@ -55,6 +55,39 @@ def looks_like_naver_place(s: str) -> bool:
|
||||
return bool(s) and ("naver.me/" in s or "place.naver.com" in s or "map.naver.com" in s)
|
||||
|
||||
|
||||
def _clean_store(raw: str) -> str:
|
||||
"""og:title/title 값에서 실제 가게명만 정리. 예: '골목냉면 : 네이버\\x1c' → '골목냉면'."""
|
||||
if not raw:
|
||||
return ""
|
||||
s = re.sub(r"[\x00-\x1f]", "", raw) # 제어문자 제거
|
||||
s = re.split(r"\s*[:\-|]\s*네이버", s)[0] # ' : 네이버', ' - 네이버 지도' 접미사 제거
|
||||
s = re.sub(r"\s+", " ", s).strip()
|
||||
return s.splitlines()[0].strip() if s else ""
|
||||
|
||||
|
||||
async def _store_name(page) -> str:
|
||||
"""가게명 추출. og:title 메타(가장 안정적) 우선 → title → 화면 요소.
|
||||
섹션 헤딩('AI 브리핑' 등)이나 '네이버' 포함 값은 배제한다.
|
||||
(네이버가 span.GHAhO 같은 난독 클래스를 자주 바꿔 화면 셀렉터만으론 불안정하므로 메타 우선.)"""
|
||||
async def _meta():
|
||||
return await page.locator("meta[property='og:title']").first.get_attribute("content", timeout=1500)
|
||||
for getter in (_meta, page.title):
|
||||
try:
|
||||
name = _clean_store(await getter())
|
||||
if name and name != "AI 브리핑" and "네이버" not in name:
|
||||
return name
|
||||
except Exception:
|
||||
pass
|
||||
for sel in ("span.GHAhO", "#_title span", "h2"): # 최후 폴백(섹션명 배제)
|
||||
try:
|
||||
t = (await page.locator(sel).first.inner_text(timeout=1200)).strip().splitlines()[0]
|
||||
if t and t != "AI 브리핑" and not t.startswith("AI "):
|
||||
return t
|
||||
except Exception:
|
||||
pass
|
||||
return ""
|
||||
|
||||
|
||||
async def _new_page(p, headful=False, viewport=None, device_scale_factor=None):
|
||||
"""공통 브라우저 컨텍스트(스텔스 + 모바일 UA) → (browser, ctx, page)."""
|
||||
browser = await p.chromium.launch(
|
||||
@@ -136,15 +169,7 @@ async def _fetch(url, headful=False):
|
||||
await page.wait_for_timeout(600)
|
||||
await page.wait_for_timeout(800)
|
||||
|
||||
store = ""
|
||||
for sel in ["span.GHAhO", "h2", "title"]:
|
||||
try:
|
||||
t = await page.locator(sel).first.inner_text(timeout=1500)
|
||||
if t and t.strip():
|
||||
store = t.strip().splitlines()[0]
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
store = await _store_name(page)
|
||||
|
||||
res = await page.evaluate(_EXTRACT_JS)
|
||||
await browser.close()
|
||||
@@ -213,11 +238,7 @@ async def crawl_and_download(url, dst_dir, max_candidates=14, headful=False):
|
||||
if not pid:
|
||||
await browser.close()
|
||||
raise RuntimeError("place id 를 못 찾음.")
|
||||
try:
|
||||
store = (await page.locator("span.GHAhO, h2").first.inner_text(timeout=1500)).strip()
|
||||
store = store.splitlines()[0]
|
||||
except Exception:
|
||||
store = ""
|
||||
store = await _store_name(page)
|
||||
|
||||
await page.goto(f"https://m.place.naver.com/{cat}/{pid}/photo",
|
||||
wait_until="domcontentloaded", timeout=30000)
|
||||
|
||||
Reference in new issue
Block a user