fix: lh3.googleusercontent.com 필터 추가, Google News 리다이렉트 head→get 수정

- _is_platform_logo(): lh3.googleusercontent.com (Google News CDN 썸네일) 스킵 패턴 추가
- _fetch_og_image(): requests.head() → requests.get() (head는 리다이렉트 미작동)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
JOUNGWOOK KWON
2026-03-30 17:33:24 +09:00
parent 07703a0f6b
commit ee91d83d37

View File

@@ -211,6 +211,7 @@ def _is_platform_logo(image_url: str) -> bool:
skip_patterns = [ skip_patterns = [
'logo', 'icon', 'avatar', 'banner', '/ad/', 'logo', 'icon', 'avatar', 'banner', '/ad/',
'google.com/images/branding', 'googlenews', 'google-news', 'google.com/images/branding', 'googlenews', 'google-news',
'lh3.googleusercontent.com', # Google News CDN 썸네일
'facebook.com', 'twitter.com', 'naver.com/favicon', 'facebook.com', 'twitter.com', 'naver.com/favicon',
'default_image', 'placeholder', 'noimage', 'no-image', 'default_image', 'placeholder', 'noimage', 'no-image',
'og-default', 'share-default', 'sns_', 'common/', 'og-default', 'share-default', 'sns_', 'common/',
@@ -223,11 +224,11 @@ def _fetch_og_image(url: str) -> str:
"""원본 기사 URL에서 og:image 메타태그 크롤링""" """원본 기사 URL에서 og:image 메타태그 크롤링"""
if not url or not url.startswith('http'): if not url or not url.startswith('http'):
return '' return ''
# Google 뉴스 리다이렉트인 경우 실제 기사 URL 추출 시도 # Google 뉴스 리다이렉트인 경우 실제 기사 URL 추출 시도 (head는 리다이렉트 안됨 → get 사용)
if 'news.google.com' in url: if 'news.google.com' in url:
try: try:
resp = requests.head(url, timeout=10, allow_redirects=True, resp = requests.get(url, timeout=15, allow_redirects=True,
headers={'User-Agent': 'Mozilla/5.0'}) headers={'User-Agent': 'Mozilla/5.0 (compatible; BlogBot/1.0)'})
if resp.url and 'news.google.com' not in resp.url: if resp.url and 'news.google.com' not in resp.url:
url = resp.url url = resp.url
except Exception: except Exception: