Emilien 8864b41b0f Harden /next fallback: fix null subreason, escaping, caching
Review fixes on top of the rebased /next-fallback work:

- Fix TypeCastError when subreason is stored as JSON null: accessors use
  as_s?, and error returns go through a helper that omits nil subreason.
- Restore graceful no-companion path by reverting player() to return nil,
  and drop the now-dead info.nil? branch in fetch_video.
- Re-enable video caching when Invidious Companion is not configured.
- Detect genuinely unavailable videos via playabilityStatus == "ERROR"
  instead of the localized "Video unavailable" string.
- HTML-escape reason/subreason coming from YouTube to avoid HTML injection,
  and guard against a missing "runs" key.
- Tidy published-date fallback and add a regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 18:35:51 +02:00
..