Skip to content

Commit

Permalink
fix(Playlist): Add thumbnail_renderer on Playlist when response inclu…
Browse files Browse the repository at this point in the history
…des it (#424)
  • Loading branch information
Rikthepixel authored Jun 28, 2023
1 parent 07c1b3e commit 4f9427d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/parser/classes/Playlist.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { YTNode, type ObservedArray } from '../helpers.js';
import Parser, { type RawNode } from '../index.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import PlaylistVideoThumbnail from './PlaylistVideoThumbnail.js';
import Author from './misc/Author.js';
import Text from './misc/Text.js';
import Thumbnail from './misc/Thumbnail.js';
Expand All @@ -12,6 +13,7 @@ export default class Playlist extends YTNode {
title: Text;
author: Text | Author;
thumbnails: Thumbnail[];
thumbnail_renderer?: PlaylistVideoThumbnail;
video_count: Text;
video_count_short: Text;
first_videos: ObservedArray<YTNode>;
Expand Down Expand Up @@ -41,6 +43,10 @@ export default class Playlist extends YTNode {
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
this.thumbnail_overlays = Parser.parseArray(data.thumbnailOverlays);

if (Reflect.has(data, 'thumbnailRenderer')) {
this.thumbnail_renderer = Parser.parseItem(data.thumbnailRenderer, PlaylistVideoThumbnail) || undefined;
}

if (Reflect.has(data, 'viewPlaylistText')) {
this.view_playlist = new Text(data.viewPlaylistText);
}
Expand Down

0 comments on commit 4f9427d

Please sign in to comment.