Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix array indexes in generated classes #546

Closed
wants to merge 1 commit into from
Closed

Fix array indexes in generated classes #546

wants to merge 1 commit into from

Conversation

dnicolson
Copy link
Contributor

Before:

InnertubeError: DecoratedAvatarView not found!
This is a bug, want to help us fix it? Follow the instructions at https://github.com/LuanRT/YouTube.js/blob/main/docs/updating-the-parser.md or report it at https://github.com/LuanRT/YouTube.js/issues!
Introspected and JIT generated this class in the meantime:
class DecoratedAvatarView extends YTNode {

...
          sources: {
            0: {
              url: data.avatar.avatarViewModel.image.sources.0.url,
              width: data.avatar.avatarViewModel.image.sources.0.width,
              height: data.avatar.avatarViewModel.image.sources.0.height
            },

After:

          sources: {
            0: {
              url: data.avatar.avatarViewModel.image.sources[0].url,
              width: data.avatar.avatarViewModel.image.sources[0].width,
              height: data.avatar.avatarViewModel.image.sources[0].height

@absidue
Copy link
Collaborator

absidue commented Dec 1, 2023

This doesn't fully fix the issue, as sources is created as an object instead of array. It's probably better if you add proper support for arrays, instead of abusing the fallback handlers.

@dnicolson dnicolson closed this Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants