mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-19 04:21:35 +00:00
feat(ytmusic): add music#getPlaylist() (#131)
* add music#getPlaylist() * fix: lint errors
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
import Parser from '../index';
|
||||
import { YTNode } from '../helpers';
|
||||
|
||||
class MusicPlaylistShelf extends YTNode {
|
||||
static type = 'MusicPlaylistShelf';
|
||||
|
||||
#continuations;
|
||||
|
||||
constructor(data) {
|
||||
super();
|
||||
this.playlist_id = data.playlistId;
|
||||
this.contents = Parser.parse(data.contents);
|
||||
this.collapsed_item_count = data.collapsedItemCount;
|
||||
this.#continuations = data.continuations;
|
||||
}
|
||||
|
||||
get continuation() {
|
||||
return this.#continuations?.[0]?.nextContinuationData;
|
||||
}
|
||||
}
|
||||
|
||||
export default MusicPlaylistShelf;
|
||||
24
src/parser/classes/MusicPlaylistShelf.ts
Normal file
24
src/parser/classes/MusicPlaylistShelf.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import Parser from '../index';
|
||||
import MusicResponsiveListItem from './MusicResponsiveListItem';
|
||||
|
||||
import { YTNode } from '../helpers';
|
||||
|
||||
class MusicPlaylistShelf extends YTNode {
|
||||
static type = 'MusicPlaylistShelf';
|
||||
|
||||
playlist_id: string;
|
||||
contents;
|
||||
collapsed_item_count: number;
|
||||
continuation: string | null;
|
||||
|
||||
constructor(data: any) {
|
||||
super();
|
||||
|
||||
this.playlist_id = data.playlistId;
|
||||
this.contents = Parser.parseArray<MusicResponsiveListItem>(data.contents, MusicResponsiveListItem);
|
||||
this.collapsed_item_count = data.collapsedItemCount;
|
||||
this.continuation = data.continuations?.[0]?.nextContinuationData?.continuation || null;
|
||||
}
|
||||
}
|
||||
|
||||
export default MusicPlaylistShelf;
|
||||
Reference in New Issue
Block a user