Getting Youtube Channel ID Using Their API
This is for people wanting to programmatically get the Channel ID of a Youtube Channel using Youtube's API and a Youtube Channel name.
Supposedly there are ways to look through the web UI to find the appropriate ID, but I want to get this information using code.
API Endpoint
https://youtube.googleapis.com/youtube/v3/search?part=snippet&q={CHANNEL_NAME}&type=channel&key={YOUTUBE_API_KEY}
Be sure you:
- Replace the
{CHANNEL_NAME}
variable with the name of the Youtube channel you want to get the Channel Id of. - Replace the
{YOUTUBE_API_KEY}
with the api key provided by Google. Follow the docs to get this.
Example cURL Request
bash
curl --location --request GET 'https://youtube.googleapis.com/youtube/v3/search?part=snippet&q={CHANNEL_NAME}&type=channel&key={YOUTUBE_API_KEY}' \
--header 'Accept: application/json'