Fix playlists not showing up on artist topic channels with the local API (#4129)

This commit is contained in:
absidue 2023-10-16 22:17:02 +02:00 committed by GitHub
parent 23f8fac87b
commit 05499ce113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -1191,13 +1191,20 @@ export default defineComponent({
// for the moment we just want the "Created Playlists" category that has all playlists in it
if (playlistsTab.content_type_filters.length > 1) {
let viewId = '1'
// Artist topic channels don't have any created playlists, so we went to select the "Albums & Singles" category instead
if (this.channelName.endsWith('- Topic') && channel.metadata.music_artist_name) {
viewId = '50'
}
/**
* @type {import('youtubei.js').YTNodes.ChannelSubMenu}
*/
const menu = playlistsTab.current_tab.content.sub_menu
const createdPlaylistsFilter = menu.content_type_sub_menu_items.find(contentType => {
const url = `https://youtube.com/${contentType.endpoint.metadata.url}`
return new URL(url).searchParams.get('view') === '1'
return new URL(url).searchParams.get('view') === viewId
}).title
playlistsTab = await playlistsTab.applyContentTypeFilter(createdPlaylistsFilter)