mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-26 08:08:54 +00:00
feat(parser): add GridMix (#356)
This commit is contained in:
38
src/parser/classes/GridMix.ts
Normal file
38
src/parser/classes/GridMix.ts
Normal file
@@ -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;
|
||||
@@ -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<string, YTNodeConstructor> = {
|
||||
Grid,
|
||||
GridChannel,
|
||||
GridHeader,
|
||||
GridMix,
|
||||
GridMovie,
|
||||
GridPlaylist,
|
||||
GridVideo,
|
||||
|
||||
Reference in New Issue
Block a user