# ---------------------------------------------------------------------- # Helper functions # ---------------------------------------------------------------------- def fetch_metadata(video_id: str) -> Optional[Dict[str, Any]]: """ Query JavDB for the given video_id. Returns a dictionary with selected fields or None if not found. """ # Normalise the ID – the API expects the raw alphanumeric string, # upper‑case, without hyphens. normalized = video_id.replace("-", "").upper()