feat: 원본 RSS 소스 이미지를 대표 이미지로 우선 사용

- RSS 수집 시 media:thumbnail, media:content, enclosure, <img> 태그에서 이미지 추출
- source_image를 topic → article → publisher로 전달
- 발행 시 우선순위: 원본 소스 이미지 → Pexels → Unsplash

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
JOUNGWOOK KWON
2026-03-30 12:22:48 +09:00
parent 02484679e2
commit 9280be7e52
3 changed files with 45 additions and 2 deletions
+12 -2
View File
@@ -207,8 +207,18 @@ def build_json_ld(article: dict, blog_url: str = '') -> str:
def fetch_featured_image(article: dict) -> str:
"""글 키워드 기반 무료 대표 이미지 URL 가져오기 (Pexels → Unsplash fallback)"""
# 검색 키워드: 태그 또는 코너 기반
"""대표 이미지: 원본 소스 이미지 → Pexels → Unsplash 순으로 시도"""
# 1) 원본 RSS 소스 이미지 (가장 우선)
source_image = article.get('source_image', '')
if source_image and source_image.startswith('http'):
try:
resp = requests.head(source_image, timeout=5, allow_redirects=True)
if resp.status_code == 200:
return source_image
except Exception:
pass # 접근 불가면 다음 방법으로
# 2) 검색 키워드: 태그 또는 코너 기반
tags = article.get('tags', [])
if isinstance(tags, str):
tags = [t.strip() for t in tags.split(',')]