Skip to content

Conversation

Fijxu
Copy link
Member

@Fijxu Fijxu commented May 9, 2025

Fixes #5095

On some videos, label is missing from the video information. Invidious assumed that the label key existed.

Videos with label have this inside metadataBadgeRenderer:

{"style" => "BADGE_STYLE_TYPE_SIMPLE",
 "label" => "4K",
 "trackingParams" => "COMDENwwGAoiEwiCrebe6JWNAxWIxz8EHSQRFTU="}

but other videos, for some reason, look like this:

{"icon" => {"iconType" => "PERSON_RADAR"},
 "style" => "BADGE_STYLE_TYPE_SIMPLE",
 "trackingParams" => "CM4DENwwGAsiEwiCrebe6JWNAxWIxz8EHSQRFTU="}

As said in #5095 (comment), the labels seems to be stored somewhere else, so this fix is more like a lazy fix, but I'll leave it here just in case. Read #5282 (comment)

Fixes iv-org#5095

On some videos, `label` is missing from the video information. Invidious
assumed that the `label` key existed.

Videos with label have this inside `metadataBadgeRenderer`:

```
{"style" => "BADGE_STYLE_TYPE_SIMPLE",
 "label" => "4K",
 "trackingParams" => "COMDENwwGAoiEwiCrebe6JWNAxWIxz8EHSQRFTU="}
```

but other videos, for some reason, look like this:

```
{"icon" => {"iconType" => "PERSON_RADAR"},
 "style" => "BADGE_STYLE_TYPE_SIMPLE",
 "trackingParams" => "CM4DENwwGAsiEwiCrebe6JWNAxWIxz8EHSQRFTU="}
```
@Fijxu Fijxu requested a review from a team as a code owner May 9, 2025 07:18
@Fijxu Fijxu requested review from alexmaras and removed request for a team May 9, 2025 07:18
@unixfox unixfox requested review from syeopite and removed request for alexmaras May 9, 2025 18:52
@Fijxu
Copy link
Member Author

Fijxu commented May 9, 2025

This works fine. Invidious ignores the item that doesn't contain label on it in the badges array.

Badges contain:

[{"metadataBadgeRenderer" =>
   {"icon" => {"iconType" => "PERSON_RADAR"},
    "style" => "BADGE_STYLE_TYPE_SIMPLE",
    "trackingParams" => "CGYQ3DAYFCITCMnfkM2Bl40DFe1duAQdSogeMg=="}},
 {"metadataBadgeRenderer" =>
   {"style" => "BADGE_STYLE_TYPE_SIMPLE",
    "label" => "4K",
    "trackingParams" => "CGYQ3DAYFCITCMnfkM2Bl40DFe1duAQdSogeMg=="}}]

The PERSON_RADAR icon means that the video has multiple tracks, so we could add the ability to see if a video has multiple tracks on the Features filter when searching a video on Invidious

Copy link
Member

@unixfox unixfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good as a fast fix. We can implement the finding a fallback label in another PR.

@Fijxu
Copy link
Member Author

Fijxu commented May 9, 2025

fallback label in another PR.

Sorry, I forgot to say that Invidious doesn't ignores the label of the video, it just skips the following badge since is not the thing we are searching for on that part of the code:

[{"metadataBadgeRenderer" =>
   {"icon" => {"iconType" => "PERSON_RADAR"},
    "style" => "BADGE_STYLE_TYPE_SIMPLE",
    "trackingParams" => "CGYQ3DAYFCITCMnfkM2Bl40DFe1duAQdSogeMg=="}},

Then it checks the next one which is the one containing the label:

 {"metadataBadgeRenderer" =>
   {"style" => "BADGE_STYLE_TYPE_SIMPLE",
    "label" => "4K",
    "trackingParams" => "CGYQ3DAYFCITCMnfkM2Bl40DFe1duAQdSogeMg=="}}]

Copy link
Member

@syeopite syeopite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good enough as a quick fix. This problem has been in Invidious for long enough...

@syeopite syeopite added the ready label May 10, 2025
@syeopite syeopite merged commit 6bfb61e into iv-org:master May 18, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Missing hash key: "label" (KeyError)
3 participants