mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-24 07:11:48 +00:00
feat(ytmusic): implement music#Library (#136)
* feat: add ItemSectionTab and related parsers * feat: add `continuation` to `Grid`parser class * feat (ytmusic): implement music#getLibrary() * Improve album fetch in `MusicResponsiveListItem` * music#Library: return [] for empty results * feat: add `Dropdown` & `DropdownItem` parsers * feat: add `CreatePlaylistDialog` parser * feat: add `create_playlist` to NavigationEndpoint * feat: add `AutomixPreviewVideo` parser * feat: improve parsing of items * fix: `PlaylistPanel` continuation * feat: more args in `Actions#next` * feat: add `PlaylistPanelContinuation` to `Parser` * chore: update parser-map * music#Library: refactor + add shuffle songs opt * feat: add `endpoint` to `DropdownItem` * feat: add `end_items` to `ItemSectionTabbedHeader` * feat(ytmusic): add `sort_by` to `music#Library`
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { YTNode } from '../helpers';
|
||||
import Parser, { ParsedResponse } from '../index';
|
||||
import Actions, { ActionsResponse } from '../../core/Actions';
|
||||
import CreatePlaylistDialog from './CreatePlaylistDialog';
|
||||
|
||||
class NavigationEndpoint extends YTNode {
|
||||
static type = 'NavigationEndpoint';
|
||||
@@ -30,6 +31,7 @@ class NavigationEndpoint extends YTNode {
|
||||
watch_playlist;
|
||||
playlist_edit;
|
||||
add_to_playlist;
|
||||
create_playlist;
|
||||
get_report_form;
|
||||
live_chat_item_context_menu;
|
||||
send_live_chat_vote;
|
||||
@@ -191,6 +193,17 @@ class NavigationEndpoint extends YTNode {
|
||||
};
|
||||
}
|
||||
|
||||
if (data?.createPlaylistEndpoint) {
|
||||
if (data?.createPlaylistEndpoint.createPlaylistDialog) {
|
||||
this.dialog = Parser.parseItem(data?.createPlaylistEndpoint.createPlaylistDialog, CreatePlaylistDialog);
|
||||
}
|
||||
this.create_playlist = {
|
||||
// Nothing to put here - data.createPlaylistEndpoint has only one prop `createPlaylistDialog`
|
||||
// Which was already parsed and referred to by `this.dialog`. But still useful to have this as
|
||||
// A quick indicator of what the endpoint does.
|
||||
};
|
||||
}
|
||||
|
||||
if (data?.getReportFormEndpoint) {
|
||||
this.get_report_form = {
|
||||
params: data.getReportFormEndpoint.params
|
||||
|
||||
Reference in New Issue
Block a user