mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-19 20:41:17 +00:00
feat: allow checking whether a channel has optional tabs (#296)
This commit is contained in:
@@ -47,6 +47,10 @@ class TabbedFeed extends Feed {
|
||||
return new TabbedFeed(this.#actions, response.data, false);
|
||||
}
|
||||
|
||||
hasTabWithURL(url: string): boolean {
|
||||
return this.#tabs.some((tab) => tab.endpoint.metadata.url?.split('/').pop() === url);
|
||||
}
|
||||
|
||||
get title(): string | undefined {
|
||||
return this.page.contents_memo.getType(Tab)?.find((tab) => tab.selected)?.title.toString();
|
||||
}
|
||||
|
||||
@@ -196,6 +196,26 @@ export default class Channel extends TabbedFeed {
|
||||
return new Channel(this.actions, page, true);
|
||||
}
|
||||
|
||||
get has_videos(): boolean {
|
||||
return this.hasTabWithURL('videos');
|
||||
}
|
||||
|
||||
get has_shorts(): boolean {
|
||||
return this.hasTabWithURL('shorts');
|
||||
}
|
||||
|
||||
get has_live_streams(): boolean {
|
||||
return this.hasTabWithURL('streams');
|
||||
}
|
||||
|
||||
get has_playlists(): boolean {
|
||||
return this.hasTabWithURL('playlists');
|
||||
}
|
||||
|
||||
get has_community(): boolean {
|
||||
return this.hasTabWithURL('community');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrives list continuation.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user