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(parser): Add ImageBannerView #583

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/parser/classes/ImageBannerView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
import Thumbnail from './misc/Thumbnail.js';

export default class ImageBannerView extends YTNode {
static type = 'ImageBannerView';

image: Thumbnail[];
style: string;

constructor(data: RawNode) {
super();
this.image = Thumbnail.fromResponse(data.image);
this.style = data.style;
}
}
3 changes: 3 additions & 0 deletions src/parser/classes/PageHeaderView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import DynamicTextView from './DynamicTextView.js';
import FlexibleActionsView from './FlexibleActionsView.js';
import DescriptionPreviewView from './DescriptionPreviewView.js';
import AttributionView from './AttributionView.js';
import ImageBannerView from './ImageBannerView.js';

export default class PageHeaderView extends YTNode {
static type = 'PageHeaderView';
Expand All @@ -17,6 +18,7 @@ export default class PageHeaderView extends YTNode {
actions: FlexibleActionsView | null;
description: DescriptionPreviewView | null;
attributation: AttributionView | null;
banner: ImageBannerView | null;

constructor(data: RawNode) {
super();
Expand All @@ -26,5 +28,6 @@ export default class PageHeaderView extends YTNode {
this.actions = Parser.parseItem(data.actions, FlexibleActionsView);
this.description = Parser.parseItem(data.description, DescriptionPreviewView);
this.attributation = Parser.parseItem(data.attributation, AttributionView);
this.banner = Parser.parseItem(data.banner, ImageBannerView);
}
}
1 change: 1 addition & 0 deletions src/parser/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export { default as HorizontalCardList } from './classes/HorizontalCardList.js';
export { default as HorizontalList } from './classes/HorizontalList.js';
export { default as HorizontalMovieList } from './classes/HorizontalMovieList.js';
export { default as IconLink } from './classes/IconLink.js';
export { default as ImageBannerView } from './classes/ImageBannerView.js';
export { default as IncludingResultsFor } from './classes/IncludingResultsFor.js';
export { default as InfoPanelContainer } from './classes/InfoPanelContainer.js';
export { default as InfoPanelContent } from './classes/InfoPanelContent.js';
Expand Down
Loading