Skip to content

Commit

Permalink
feat(parser): add banner to PlaylistHeader (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkfkan authored Mar 6, 2023
1 parent 2cc7b8b commit 95033e7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/parser/classes/HeroPlaylistThumbnail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { YTNode } from '../helpers.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import Thumbnail from './misc/Thumbnail.js';

class HeroPlaylistThumbnail extends YTNode {
static type = 'HeroPlaylistThumbnail';

thumbnails: Thumbnail[];
on_tap_endpoint: NavigationEndpoint;

constructor(data: any) {
super();

this.thumbnails = Thumbnail.fromResponse(data.thumbnail);
this.on_tap_endpoint = new NavigationEndpoint(data.onTap);
}
}

export default HeroPlaylistThumbnail;
2 changes: 2 additions & 0 deletions src/parser/classes/PlaylistHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class PlaylistHeader extends YTNode {
save_button;
shuffle_play_button;
menu;
banner;

constructor(data: any) {
super();
Expand All @@ -39,6 +40,7 @@ class PlaylistHeader extends YTNode {
this.save_button = Parser.parse(data.saveButton);
this.shuffle_play_button = Parser.parse(data.shufflePlayButton);
this.menu = Parser.parse(data.moreActionsMenu);
this.banner = Parser.parseItem(data.playlistHeaderBanner);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/parser/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ import { default as Heatmap } from './classes/Heatmap.js';
export { Heatmap };
import { default as HeatMarker } from './classes/HeatMarker.js';
export { HeatMarker };
import { default as HeroPlaylistThumbnail } from './classes/HeroPlaylistThumbnail.js';
export { HeroPlaylistThumbnail };
import { default as HighlightsCarousel } from './classes/HighlightsCarousel.js';
export { HighlightsCarousel };
import { default as HistorySuggestion } from './classes/HistorySuggestion.js';
Expand Down Expand Up @@ -778,6 +780,7 @@ const map: Record<string, YTNodeConstructor> = {
HashtagHeader,
Heatmap,
HeatMarker,
HeroPlaylistThumbnail,
HighlightsCarousel,
HistorySuggestion,
HorizontalCardList,
Expand Down

0 comments on commit 95033e7

Please sign in to comment.