feat(crawling): 업체 공식 링크 수집·저장 및 official_site_url 응답 연동
- 네이버 placeDetail GraphQL base에 homepages 필드 추가, 대표(repr)
링크 우선으로 살아있는 URL을 추출한다 (실서비스 응답 구조 확인 완료)
- marketing 테이블에 official_site_url 컬럼 추가: 크롤링 시 플레이스
홈페이지 항목을 저장하고, 없으면 유저가 입력한 크롤링 소스 URL을 저장
- GET /video/{id}, /video/all의 official_site_url은 저장값 우선,
컬럼 도입 전 기존 행은 place_id 기반 플레이스 URL로 폴백
- 기존 테이블에는 수동 마이그레이션 필요:
ALTER TABLE marketing ADD COLUMN official_site_url VARCHAR(2048) NULL
COMMENT '업체 공식 링크' AFTER place_id;
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CVSeUT2pEmeHc6hG6gVXUS
This commit is contained in:
1 parent
61bdc27cd3
commit
1ef8e82638
5 files changed
+47
-10
No files matched your search
@@ -417,8 +417,16 @@ async def _crawling_logic(url: str, session: AsyncSession):
|
||||
)
|
||||
|
||||
# Step 4-3: 분석 결과 DB 저장 (industry는 Project로 흐르므로 여기엔 미저장)
|
||||
# 공식 링크: 플레이스 홈페이지 항목 우선, 없으면 유저가 입력한 크롤링 소스 URL
|
||||
# (컬럼 길이를 넘는 긴 검색 URL은 place_id 기반 표준 플레이스 URL로 대체)
|
||||
official_site_url = scraper.official_site_url or url
|
||||
if len(official_site_url) > 2048:
|
||||
official_site_url = (
|
||||
f"https://map.naver.com/p/entry/place/{scraper.place_id[2:]}"
|
||||
)
|
||||
marketing_intel = MarketingIntel(
|
||||
place_id=scraper.place_id,
|
||||
official_site_url=official_site_url,
|
||||
intel_result=marketing_analysis.model_dump(),
|
||||
)
|
||||
session.add(marketing_intel)
|
||||
|
||||
Reference in new issue
Block a user