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>
- New mock: no-videodetails.player.json (player response without videoDetails)
- Test verifies fallback extraction from videoPrimaryInfoRenderer,
videoSecondaryInfoRenderer, and videoOwnerRenderer when
videoDetails is missing from the player response
* Remove sort by rating and date in video search filters
Closes https://github.com/iv-org/invidious/issues/5626
* Remove check of protobug generation of rating and date sort filters in Invidious spec
Summing the sizes of each cached file every time is very inefficient.
Instead we can simply store the cache size in an constant and increase
it everytime a file is added into the cache.
Running `crystal spec` without a file argument essentially produces one
big program that combines every single spec file, their imports, and
the files that those imports themselves depend on. Most of the types
within this combined program will get ignored by the compiler due to a
lack of any calls to them from the spec files.
But for some types, partially the HTTP module ones, using them within
the spec files will suddenly make the compiler enable a bunch of
previously ignored code. And those code will suddenly require the
presence of additional types, constants, etc. This not only make it
annoying for getting the specs working but also makes it difficult to
isolate behaviors for testing.
The `static_assets_handler_spec.cr` causes this issue and so will be
marked as an isolated spec for now. In the future all of the tests
should be organized into independent groupings similar to how the
Crystal compiler splits their tests into std, compiler, primitives and
interpreter.
* Fix 0 view count on related videos
* Remove view_count variable since it's unused by Innertube
* Remove view_count from specs and API
---------
Co-authored-by: Fijxu <fijxu@nadeko.net>