YouTube enricher: consistent log output with the other video workers
- Logger renamed video.youtube_enrichment -> video_enrichment.youtube (same namespace as video_enrichment.worker). - Per-item lines as it dates each video — 'Dated <channel> '<video>' -> <date>' / 'No date for …', mirroring the workers' 'Matched <kind> '<title>' -> TMDB ID: …'. (Phase lines kept for context: enriching / proxy returned / done.)
This commit is contained in:
parent
722b80001e
commit
220f2ad4de
1 changed files with 11 additions and 3 deletions
|
|
@ -20,7 +20,7 @@ import time
|
|||
|
||||
from utils.logging_config import get_logger
|
||||
|
||||
logger = get_logger("video.youtube_enrichment")
|
||||
logger = get_logger("video_enrichment.youtube") # same namespace as the other video workers
|
||||
|
||||
# Per-video fallback (used when the bulk proxy is down): dated in a small thread
|
||||
# pool so a channel finishes in ~30s instead of minutes, without bursting too hard.
|
||||
|
|
@ -146,10 +146,18 @@ class YoutubeDateEnricher:
|
|||
if missing:
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
|
||||
cur = self._current
|
||||
|
||||
def fetch_date(vid):
|
||||
try:
|
||||
v = yt.video_detail(vid)
|
||||
return vid, (v or {}).get("published_at")
|
||||
v = yt.video_detail(vid) or {}
|
||||
d = v.get("published_at")
|
||||
if d:
|
||||
# Per-item line, matching the other workers' "Matched … -> …".
|
||||
logger.info("Dated %s '%s' -> %s", cur, (v.get("title") or vid)[:70], d)
|
||||
else:
|
||||
logger.info("No date for %s video %s", cur, vid)
|
||||
return vid, d
|
||||
except Exception:
|
||||
return vid, None
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue