Collaboration videos (multiple authors) have an extra metadataRows entry
before the views/date one, containing the byline (e.g. "Channel A and
Channel B"). The video branch of LockupViewModelParser always read
metadataRows[0], which for these videos is the byline, not views/date,
so both silently defaulted to 0 views and the current time.
Fixed by searching every row's parts instead of assuming a fixed index,
mirroring the same reasoning already used a few lines below for the
playlist branch of this parser.
Verified against real, live-captured YouTube API responses for both a
single-author video and a real collaboration video (Veritasium x 2swap):
confirmed the bug reproduces against the original code (views: 0) and is
fixed by this change (views: 7900000). Full spec suite (174 examples)
passes.
Fixes: #5740
I want to be awarded the bounty associated to the issue this PR is fixing.
--
AI disclosure (per AI_POLICY.md): this change was written with assistance
from Claude Sonnet 5 (model id claude-sonnet-5), via Claude Code (Anthropic's
CLI agent). The human (Alison Moura) read the AI usage policy, reviewed the
diff, and reviewed the before/after test verification described above prior
to this commit being made.
* 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>