diff --git a/src/parser/classes/GridMix.ts b/src/parser/classes/GridMix.ts new file mode 100644 index 000000000..fdd609e67 --- /dev/null +++ b/src/parser/classes/GridMix.ts @@ -0,0 +1,38 @@ +import Text from './misc/Text.js'; +import Parser from '../index.js'; +import Thumbnail from './misc/Thumbnail.js'; +import NavigationEndpoint from './NavigationEndpoint.js'; +import { YTNode } from '../helpers.js'; + +class GridMix extends YTNode { + static type = 'GridMix'; + + id: string; + title: Text; + author: Text | null; + thumbnails: Thumbnail[]; + video_count: Text; + video_count_short: Text; + endpoint: NavigationEndpoint; + secondary_endpoint: NavigationEndpoint; + thumbnail_overlays; + + constructor(data: any) { + super(); + this.id = data.playlistId; + this.title = new Text(data.title); + + this.author = data.shortBylineText?.simpleText ? + new Text(data.shortBylineText) : data.longBylineText?.simpleText ? + new Text(data.longBylineText) : null; + + this.thumbnails = Thumbnail.fromResponse(data.thumbnail); + this.video_count = new Text(data.videoCountText); + this.video_count_short = new Text(data.videoCountShortText); + this.endpoint = new NavigationEndpoint(data.navigationEndpoint); + this.secondary_endpoint = new NavigationEndpoint(data.secondaryNavigationEndpoint); + this.thumbnail_overlays = Parser.parseArray(data.thumbnailOverlays); + } +} + +export default GridMix; \ No newline at end of file diff --git a/src/parser/map.ts b/src/parser/map.ts index 820dab35b..28b8db9f0 100644 --- a/src/parser/map.ts +++ b/src/parser/map.ts @@ -194,6 +194,8 @@ import { default as GridChannel } from './classes/GridChannel.js'; export { GridChannel }; import { default as GridHeader } from './classes/GridHeader.js'; export { GridHeader }; +import { default as GridMix } from './classes/GridMix.js'; +export { GridMix }; import { default as GridMovie } from './classes/GridMovie.js'; export { GridMovie }; import { default as GridPlaylist } from './classes/GridPlaylist.js'; @@ -792,6 +794,7 @@ const map: Record = { Grid, GridChannel, GridHeader, + GridMix, GridMovie, GridPlaylist, GridVideo,