Skip to content

How to get the sections for a mood or genre? #1016

@michaelalhilly

Description

@michaelalhilly

Question

Hi. Looks like YouTube Music handles moods and genres differently since clicking on one in the browser does not update the url. In other words it is not possible to share a link to a mood or genre. This seems to be related to the issue I'm having. Right now I'm attempting to call music.getInfo(navigationEndpoint) passing in the navigation endpoint for a specific mood, in this case "Chill". The request succeeds but all the props returned are undefined or empty. Cheers!

async function showGenreInfo(innertube: Innertube) {
  const browse_endpoint = new NavigationEndpoint({ browseEndpoint: { browseId: 'FEmusic_explore' } });
  const response = await browse_endpoint.call(innertube.actions, { client: 'YTMUSIC' })
  
  const page = Parser.parseResponse<IBrowseResponse>(response.data)
  const tab = page.contents?.item().as(SingleColumnBrowseResults).tabs.get({ selected: true })
  if (!tab) return
  
  const section_list = tab.content?.as(SectionList)
  if (!section_list) return
  
  const sections = section_list.contents.filterType(MusicCarouselShelf)
  const genre = sections.find(s => s.header?.title.text === "Moods & genres")
  if (!genre) return
  
  const chill = genre.contents.map(c => c as MusicNavigationButton).find(b => b.button_text === "Chill")
  if (!chill) return
  
  const info = await innertube.music.getInfo(chill.endpoint)
  console.log(info)
}

Other details

No response

Checklist

  • I am running the latest version.
  • I checked the documentation and found no answer.
  • I have searched the existing issues and made sure this is not a duplicate.
  • I have provided sufficient information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions