How can I get a channel ID from YouTube?

YoutubeYoutube Api

Youtube Problem Overview


I'm trying to retrive the data from my channel using the YouTube Data API V3.
For that I need my channel ID.
I've tried to find my channel ID from my YouTube account, and I failed in every single way.
If anyone have a single tip for me, I would be incredible glad.

This is the URL that I'm using to retrieve the data:
>https://www.googleapis.com/youtube/v3/channels?**id**=fjTOrCPnAblTngWAzpnlMA&**key**={YOUR_API_KEY}&part=snippet,contentDetails,statistics

The ID is for the channel ID, and the key, I'm replacing the {YOUR_API_KEY} with my API KEY generated at my Google API console.

My channel ID is not:

My channel is: http://www.youtube.com/user/klauskkpm

Youtube Solutions


Solution 1 - Youtube

To obtain the channel id you can view the source code of the channel page and find either data-channel-external-id="UCjXfkj5iapKHJrhYfAF9ZGg" or "externalId":"UCjXfkj5iapKHJrhYfAF9ZGg".

UCjXfkj5iapKHJrhYfAF9ZGg will be the channel ID you are looking for.

Solution 2 - Youtube

An easy answer is, your YouTube Channel ID is UC + {YOUR_ACCOUNT_ID}. To be sure of your YouTube Channel ID or your YouTube account ID, access the advanced settings at your settings page

And if you want to know the YouTube Channel ID for any channel, you could use the solution @mjlescano gave.

https://www.googleapis.com/youtube/v3/channels?key={YOUR_API_KEY}&forUsername={USER_NAME}&part=id

If this could be of any help, some user marked it was solved in another topic right here.

Solution 3 - Youtube

This website finds a YouTube Channel ID from its URL:

https://commentpicker.com/youtube-channel-id.php

Solution 4 - Youtube

You can get the channel ID with the username (in your case "klauskkpm") using the filter "forUsername", like this:

https://www.googleapis.com/youtube/v3/channels?key={YOUR_API_KEY}&forUsername=klauskkpm&part=id

More info here: https://developers.google.com/youtube/v3/docs/channels/list

Solution 5 - Youtube

At any channel page with "user" url for example http://www.youtube.com/user/klauskkpm, without API call, from YouTube UI, click a video of the channel (in its "VIDEOS" tab) and click the channel name on the video. Then you can get to the page with its "channel" url for example https://www.youtube.com/channel/UCfjTOrCPnAblTngWAzpnlMA.

Solution 6 - Youtube

I just found the simplest way to find the channel ID of any YouTube channel !!

Step 1: Play a video of that channel.

Step 2: Click the channel name under that video.

Step 3: Look at the browser address bar.

Solution 7 - Youtube

An alternative to get youtube channel ID by channel url without API:

function get_youtube_channel_ID($url){
  $html = file_get_contents($url);
  preg_match("'<meta itemprop=\"channelId\" content=\"(.*?)\"'si", $html, $match);
  if($match && $match[1])
    return $match[1];
}

Solution 8 - Youtube

Channel id with the current youtube version is obtained very easily if you login to YouYube website and select 'My channel'

My channel

Your channel ID will be displayed on the address bar of your browser channel id

Solution 9 - Youtube

June 2021 edition.

  1. Right click and view page source.
  2. Search for "externalId", the value follows.

Source: comment by Daniel 2017.

Alternative: run this JavaScript in console:

ytInitialData.metadata.channelMetadataRenderer.externalId

Solution 10 - Youtube

Solution 11 - Youtube

2017 Update: Henry's answer may be a little off the mark here. If you look for data-channel-external-id in the source code you may find more than one ID, and only the first occurrence is actually correct. Get the channel_id used in <link rel="alternate" type="application/rss+xml" title="RSS" href="https://www.youtube.com/feeds/videos.xml?channel_id=<VALUE_HERE"> instead.

Solution 12 - Youtube

To obtain the channel id you can do the following request which gives you the channel id and playlist id.

https://www.googleapis.com/youtube/v3/channels?part=contentDetails%2C+statistics%2Csnippet&mine=true&key={YOUR_API_KEY}

mine parameter means the current authorized user

as u said channel id is perfixed with UC+{your account id} which you get while login, you can use this one also without requesting the above url you can directly call the channel api with your google id and just prefix with UC

https://www.googleapis.com/youtube/v3/channels?part=contentDetails%2C+statistics%2Csnippet&id=UC{your account id}&key={YOUR_API_KEY}

Solution 13 - Youtube

To get Channel id

Ex: Apple channel ID

enter image description here

Select any of the video in that channel

enter image description here

Select iPhone - Share photos (video)

Now click on channel name Apple bottom of the video.

enter image description here

Now you will get channel id in browser url

enter image description here

Here this is Apple channel id : UCE_M8A5yxnLfW0KghEeajjw

Solution 14 - Youtube

Try to search for regular expression UC[-_0-9A-Za-z]{21}[AQgw] in source code. This ID is presented even if channel has non-ASCII characters in URL:

enter image description here

Here is screenshot of internal viewer/editor of Midnight Commander, it has regexp search:

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionklauskpmView Question on Stackoverflow
Solution 1 - YoutubeHenry MoshkovichView Answer on Stackoverflow
Solution 2 - YoutubeklauskpmView Answer on Stackoverflow
Solution 3 - YoutubeDerber AlterView Answer on Stackoverflow
Solution 4 - YoutubemjlescanoView Answer on Stackoverflow
Solution 5 - YoutubekangkyuView Answer on Stackoverflow
Solution 6 - YoutubeLinuxBabeView Answer on Stackoverflow
Solution 7 - YoutubeArthur RonconiView Answer on Stackoverflow
Solution 8 - YoutubeVas GiatilisView Answer on Stackoverflow
Solution 9 - YoutubeAvindra GoolcharanView Answer on Stackoverflow
Solution 10 - YoutubeDan Jacobson 積丹尼View Answer on Stackoverflow
Solution 11 - YoutubevitorrrrView Answer on Stackoverflow
Solution 12 - Youtuberakesh rView Answer on Stackoverflow
Solution 13 - YoutubeNareshView Answer on Stackoverflow
Solution 14 - YoutubeshoorickView Answer on Stackoverflow