diff --git a/backend/app/downloads/backfill.py b/backend/app/downloads/backfill.py index af751966..3db13bf6 100644 --- a/backend/app/downloads/backfill.py +++ b/backend/app/downloads/backfill.py @@ -21,7 +21,7 @@ from app.db import SessionLocal from app.downloads import edit as editmod from app.downloads import formats, service from app.models import MediaAsset -from app.worker import uploader_url +from app.worker import build_uploader_url log = logging.getLogger("siftlode.backfill") @@ -73,7 +73,7 @@ def run() -> dict: if a.uploader_url is None and _should_refetch(a): url = a.source_webpage_url or service.source_url(a.source_kind, a.source_ref) info = _extract_meta(url) - uu = uploader_url(info) if info else None + uu = build_uploader_url(info) if info else None if uu: a.uploader_url = uu filled_url += 1 diff --git a/backend/app/worker.py b/backend/app/worker.py index aecd3432..c2949104 100644 --- a/backend/app/worker.py +++ b/backend/app/worker.py @@ -262,7 +262,7 @@ def _finish_from_cache(job_id: int, asset_id: int) -> None: db.commit() -def uploader_url(info: dict) -> str | None: +def build_uploader_url(info: dict) -> str | None: """The channel/uploader page URL for the auto-clickable channel line. YouTube gives a `channel_url`/`uploader_url` directly; Facebook gives neither but exposes a numeric `uploader_id` (the page id) that resolves at facebook.com/. Returns None for sources with @@ -290,7 +290,7 @@ def _fill_asset_meta_early(asset_id: int, info: dict) -> None: # the final title with its own source_ref fallback. asset.title = normalize_title(info.get("title")) or info.get("id") asset.uploader = info.get("uploader") or info.get("channel") - asset.uploader_url = uploader_url(info) + asset.uploader_url = build_uploader_url(info) asset.thumbnail_url = info.get("thumbnail") asset.duration_s = int(info["duration"]) if info.get("duration") else None asset.upload_date = _parse_upload_date(info.get("upload_date")) @@ -638,7 +638,7 @@ def _download(job_id: int, asset_id: int, source_kind: str, source_ref: str, spe asset.acodec = info.get("acodec") if info.get("acodec") not in (None, "none") else None asset.title = meta.title asset.uploader = meta.uploader - asset.uploader_url = uploader_url(info) + asset.uploader_url = build_uploader_url(info) asset.upload_date = meta.upload_date asset.thumbnail_url = meta.thumbnail_url # Record a self-hosted poster for every download: it's the reliable link-preview