mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-19 04:21:35 +00:00
Add getPlaylists function (#650)
This commit is contained in:
@@ -325,6 +325,18 @@ export default class Innertube {
|
||||
return response.data?.unseenCount || response.data?.actions?.[0].updateNotificationsUnseenCountAction?.unseenCount || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves playlists.
|
||||
*/
|
||||
async getPlaylists() {
|
||||
const response = await this.actions.execute(
|
||||
BrowseEndpoint.PATH, { ...BrowseEndpoint.build({ browse_id: 'FEplaylist_aggregation' }), parse: true }
|
||||
);
|
||||
|
||||
const feed = new Feed(this.actions, response);
|
||||
return feed.playlists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves playlist contents.
|
||||
* @param id - Playlist id
|
||||
|
||||
@@ -168,6 +168,7 @@ export default class Actions {
|
||||
'FEhistory',
|
||||
'FEsubscriptions',
|
||||
'FEchannels',
|
||||
'FEplaylist_aggregation',
|
||||
'FEmusic_listening_review',
|
||||
'FEmusic_library_landing',
|
||||
'SPaccount_overview',
|
||||
|
||||
14
src/parser/classes/ChipBarView.ts
Normal file
14
src/parser/classes/ChipBarView.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { YTNode, type ObservedArray } from '../helpers.js';
|
||||
import { Parser, type RawNode } from '../index.js';
|
||||
import ChipView from './ChipView.js';
|
||||
|
||||
export default class ChipBarView extends YTNode {
|
||||
static type = 'ChipBarView';
|
||||
|
||||
chips: ObservedArray<ChipView> | null;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.chips = Parser.parseArray(data.chips, ChipView);
|
||||
}
|
||||
}
|
||||
20
src/parser/classes/ChipView.ts
Normal file
20
src/parser/classes/ChipView.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { YTNode } from '../helpers.js';
|
||||
import { type RawNode } from '../index.js';
|
||||
import NavigationEndpoint from './NavigationEndpoint.js';
|
||||
|
||||
export default class ChipView extends YTNode {
|
||||
static type = 'ChipView';
|
||||
|
||||
text: string;
|
||||
display_type: string;
|
||||
endpoint: NavigationEndpoint;
|
||||
chip_entity_key: string;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.text = data.text;
|
||||
this.display_type = data.displayType;
|
||||
this.endpoint = new NavigationEndpoint(data.tapCommand);
|
||||
this.chip_entity_key = data.chipEntityKey;
|
||||
}
|
||||
}
|
||||
@@ -55,8 +55,10 @@ export { default as ChannelThumbnailWithLink } from './classes/ChannelThumbnailW
|
||||
export { default as ChannelVideoPlayer } from './classes/ChannelVideoPlayer.js';
|
||||
export { default as Chapter } from './classes/Chapter.js';
|
||||
export { default as ChildVideo } from './classes/ChildVideo.js';
|
||||
export { default as ChipBarView } from './classes/ChipBarView.js';
|
||||
export { default as ChipCloud } from './classes/ChipCloud.js';
|
||||
export { default as ChipCloudChip } from './classes/ChipCloudChip.js';
|
||||
export { default as ChipView } from './classes/ChipView.js';
|
||||
export { default as ClipAdState } from './classes/ClipAdState.js';
|
||||
export { default as ClipCreation } from './classes/ClipCreation.js';
|
||||
export { default as ClipCreationScrubber } from './classes/ClipCreationScrubber.js';
|
||||
|
||||
Reference in New Issue
Block a user