gatecrasher777/ytcog

How to fetch channel by name?

ikmolbo opened this issue · 3 comments

Hi again,

Looking at Youtube Channels, many default to a name, rather than an ID. The ytcog.Channel method currently works only with the ID. Is there any way to fetch a channel by name?

For example: https://www.youtube.com/c/PianoteOfficial

Its channel ID (UC_DmCvOP5Q_eBMRDvqqRXjg) can be found by looking at the HTML source: <link rel="canonical" href="https://www.youtube.com/channel/UC_DmCvOP5Q_eBMRDvqqRXjg"> but this isn't going to be an option for users.

Thanks again.

As far as I have seen even when using the /c/channelName webpages, the innertube post requests (/youtubei/v1/browse) do not contain the channel name in their payloads, only the 24 character channel code. So in the context of using a pure innertube approach, it doesn't seem possible.

Also search, video, playlist results only seem to refer to channel codes.

The channel requests do give the equivalent name links, but that doesn't help because you need the code first.

But there may be an inexpensive way to look up the channel code given a channel name. Obviously when you type in the named urls, it returns the same pages as if you had used the code.

So perhaps in ytcog if you provide a channel string like "c/PianoteOfficial" it can call:

https://www.youtube.com/c/PianoteOfficial/about

to scape the channel code before continuing the request. Scraping the rss feed url might be even more efficient (if it accepts names - not sure at this stage).

But I'm sure some method of conversion like this will be useful.

OK thanks. First I hear of Youtube RSS feeds - that could in fact be a simpler way of getting to info I need.

For example:

https://www.youtube.com/feeds/videos.xml?channel_id=UC_DmCvOP5Q_eBMRDvqqRXjg

Can't find a way to call this with a name yet.