chore: v5.4.0 release

This commit is contained in:
LuanRT
2023-07-14 03:01:47 +00:00
parent 0582bcb677
commit 499937fe3a
6 changed files with 50 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
import { YTNode, type ObservedArray } from '../helpers.ts';
import Parser, { type RawNode } from '../index.ts';
import NavigationEndpoint from './NavigationEndpoint.ts';
import PlaylistCustomThumbnail from './PlaylistCustomThumbnail.ts';
import PlaylistVideoThumbnail from './PlaylistVideoThumbnail.ts';
import Author from './misc/Author.ts';
import Text from './misc/Text.ts';
@@ -13,7 +14,7 @@ export default class Playlist extends YTNode {
title: Text;
author: Text | Author;
thumbnails: Thumbnail[];
thumbnail_renderer?: PlaylistVideoThumbnail;
thumbnail_renderer?: PlaylistVideoThumbnail | PlaylistCustomThumbnail;
video_count: Text;
video_count_short: Text;
first_videos: ObservedArray<YTNode>;
@@ -44,7 +45,7 @@ export default class Playlist extends YTNode {
this.thumbnail_overlays = Parser.parseArray(data.thumbnailOverlays);
if (Reflect.has(data, 'thumbnailRenderer')) {
this.thumbnail_renderer = Parser.parseItem(data.thumbnailRenderer, PlaylistVideoThumbnail) || undefined;
this.thumbnail_renderer = Parser.parseItem(data.thumbnailRenderer, [ PlaylistVideoThumbnail, PlaylistCustomThumbnail ]) || undefined;
}
if (Reflect.has(data, 'viewPlaylistText')) {

View File

@@ -0,0 +1,25 @@
import { YTNode } from '../helpers.ts';
import type { RawNode } from '../index.ts';
import Text from './misc/Text.ts';
export default class Quiz extends YTNode {
static type = 'Quiz';
choices: {
text: Text;
is_correct: boolean;
}[];
total_votes: Text;
constructor(data: RawNode) {
super();
this.choices = data.choices.map((choice: RawNode) => ({
text: new Text(choice.text),
is_correct: choice.isCorrect
}));
this.total_votes = new Text(data.totalVotes);
}
}

View File

@@ -265,6 +265,7 @@ export { default as ProfileColumn } from './classes/ProfileColumn.ts';
export { default as ProfileColumnStats } from './classes/ProfileColumnStats.ts';
export { default as ProfileColumnStatsEntry } from './classes/ProfileColumnStatsEntry.ts';
export { default as ProfileColumnUserInfo } from './classes/ProfileColumnUserInfo.ts';
export { default as Quiz } from './classes/Quiz.ts';
export { default as RecognitionShelf } from './classes/RecognitionShelf.ts';
export { default as ReelItem } from './classes/ReelItem.ts';
export { default as ReelShelf } from './classes/ReelShelf.ts';

View File

@@ -163,6 +163,16 @@ export default class Channel extends TabbedFeed<IBrowseResponse> {
return new Channel(this.actions, tab.page, true);
}
async getReleases(): Promise<Channel> {
const tab = await this.getTabByURL('releases');
return new Channel(this.actions, tab.page, true);
}
async getPodcasts(): Promise<Channel> {
const tab = await this.getTabByURL('podcasts');
return new Channel(this.actions, tab.page, true);
}
async getPlaylists(): Promise<Channel> {
const tab = await this.getTabByURL('playlists');
return new Channel(this.actions, tab.page, true);
@@ -217,6 +227,14 @@ export default class Channel extends TabbedFeed<IBrowseResponse> {
return this.hasTabWithURL('streams');
}
get has_releases(): boolean {
return this.hasTabWithURL('releases');
}
get has_podcasts(): boolean {
return this.hasTabWithURL('podcasts');
}
get has_playlists(): boolean {
return this.hasTabWithURL('playlists');
}