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

feat: add VideoAttributeView #531

Merged
merged 5 commits into from
Dec 1, 2023

Conversation

JellyBrick
Copy link
Contributor

@JellyBrick JellyBrick commented Oct 28, 2023

InnertubeError: VideoAttributeView 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 VideoAttributeView extends YTNode {
  static type = 'VideoAttributeView';

  image: {
    sources: {
      0: {
        url: string
      }
    }
  };
  image_style: string;
  title: string;
  subtitle: string;
  secondary_subtitle: {
    content: string
  };
  orientation: string;
  sizing_rule: string;
  overflow_menu_on_tap: {
    innertube_command: NavigationEndpoint
  };
  overflow_menu_a11y_label: string;
  logging_directives: {
    tracking_params: string,
    visibility: {
      types: string
    },
    enable_displaylogger_experiment: boolean
  };

  constructor(data: RawNode) {
    super();
    this.image = {
      sources: {
        0: {
          url: data.image.sources.0.url
        }
      }
    };
    this.image_style = data.imageStyle;
    this.title = data.title;
    this.subtitle = data.subtitle;
    this.secondary_subtitle = {
      content: data.secondarySubtitle.content
    };
    this.orientation = data.orientation;
    this.sizing_rule = data.sizingRule;
    this.overflow_menu_on_tap = {
      innertube_command: new NavigationEndpoint(data.overflowMenuOnTap.innertubeCommand)
    };
    this.overflow_menu_a11y_label = data.overflowMenuA11yLabel;
    this.logging_directives = {
      tracking_params: data.loggingDirectives.trackingParams,
      visibility: {
        types: data.loggingDirectives.visibility.types
      },
      enable_displaylogger_experiment: data.loggingDirectives.enableDisplayloggerExperiment
    };
  }
}

JellyBrick added a commit to JellyBrick/YouTube.js that referenced this pull request Oct 28, 2023
Copy link
Collaborator

@absidue absidue left a comment

Choose a reason for hiding this comment

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

Please used named imports for the Parser instead of a default one, please see #535 for why. You only need to change the files you added, the linked pull request fixes all other ones.

src/parser/classes/VideoAttributeView.ts Outdated Show resolved Hide resolved
src/parser/classes/VideoAttributeView.ts Outdated Show resolved Hide resolved
JellyBrick and others added 2 commits November 3, 2023 10:45
apply suggestion

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
apply suggestion

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
@LuanRT LuanRT merged commit ff4ab16 into LuanRT:main Dec 1, 2023
3 of 4 checks passed
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.

7.0.0 - InnertubeError: VideoAttributeView not found!
3 participants