How can I get a channel ID from YouTube?
YoutubeYoutube ApiYoutube 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:
- klauskkpm
- klausmachado
- [email protected]
- fjTOrCPnAblTngWAzpnlMA
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:
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'
Your channel ID will be displayed on the address bar of your browser
Solution 9 - Youtube
June 2021 edition.
- Right click and view page source.
- Search for
"externalId"
, the value follows.
Source: comment by Daniel 2017.
Alternative: run this JavaScript in console:
ytInitialData.metadata.channelMetadataRenderer.externalId
Solution 10 - Youtube
https://www.youtube.com/account_advanced now provides both channel and user ids. See also https://developers.google.com/youtube/v3/guides/working_with_channel_ids .
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.
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
Select any of the video in that channel
Select iPhone - Share photos (video)
Now click on channel name Apple bottom of the video.
Now you will get channel id in browser url
Here this is Apple channel id : UCE_M8A5yxnLfW0KghEeajjw