0

For my application I need to retrieve a channel's ID, which can be done using a channel's username via channels().list(..., forUsername=username, ...).

The issue I have is that a channel's username is not as obvious as you would think. For example, talkSPORT's channel's username is actually talkSPORTMagazine. The only way I have been able to extract this is from their main page's URL.

However, a channel's main page's URL does not reliably include their username: sometimes it does, sometimes it includes their ID, or sometimes nothing at all.

If I don't use a channel's actual username then I cannot extract their channelID, something I need to request videos.

Is there a way I can reliably find a channel's username?

Jake Jackson
  • 1,055
  • 1
  • 12
  • 34

1 Answers1

1

The answer to your question is unfortunately negative: there's no reliable way to find a channel's user name.

That's because user names are a legacy feature of the API v3: not every channel has one attached and no channel is required to have one attached. (See this official statement from Google staff from 2013-07-11.)

I warmly recommend to make your app such that it not rely on user names identifying channels; do arrange your app logic (both internal and external) such that to base it on channel IDs.

For what concerns channel URLs using user names, please follow this answer of mine: How to find the forUsername parameter for a specific channel.

stvar
  • 6,551
  • 2
  • 13
  • 28