Skip to content

Add get_channel_type method #861

@mayty

Description

@mayty

Is your feature request related to a problem? Please describe.
I have a workflow that goes like this:

  1. Get channelId from YouTube handle using v3/channels YouTube data api
  2. Scrape this channelId using ytmusicapi

The issue happens on step 2, as channelId produced in the first step can lead to channels of different types, which need to be scraped using different methods:

  • @RammsteinOfficial -> UCYp3rk70ACGXQ4gFAiMr1SQ -> YTMusic.get_artist()
  • @4tunenocopyrightmusic881 -> UC44hbeRoCZVVMVg5z0FfIww -> YTMusic.get_user()
  • @LinusTechTips -> UCXuqSBlHAE6Xw-yeJA0Tunw -> YTMusic.get_channel()

Describe the solution you'd like
A method to determine channel type:
YTMusic.get_channel_type(channelId: str) -> ChannelType

Describe alternatives you've considered
If for determining channel type the same request is required as for channel scraping, scraping result can be returned instead of type only:
YTMusic.get_generic_channel(channelId: str) -> tuple[ChannelType, GetArtistResponse | GetUserResponse | GetChannelResponse]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions