13

So I'm trying to get the channel profile picture for a YouTube channel by using the channelId.

I would like to do it simply by adding the channelId to a URL and get the image that way. Facebook has something similar where you use this URL:

http://graph.facebook.com/user_id/picture?type=square

Google+ has it too, found this question here. Sadly it didn't work for YouTube (I couldn't get it to work)

Hope someone has a solution!

Thanks in advance :)

Community
  • 1
  • 1
Aleksander
  • 2,735
  • 5
  • 34
  • 57
  • 2
    I'd like to know this, with the new APIs. – markzzz Apr 21 '15 at 14:18
  • It really is a shame this is still a problem. There should be a standardized method to access channel thumbnails using only the channel ID. The same as you can access YouTube thumbnails. There is *no* reason to require an API request for this specific action. – Conor Reid Dec 30 '22 at 19:28

3 Answers3

11

You can use channels->list request for that.

In response you will get snippet.thumbnails."default".url for that

For authenticated user's channel:

GET https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true&fields=items%2Fsnippet%2Fthumbnails&key={YOUR_API_KEY}

Or for any channel ID:

GET https://www.googleapis.com/youtube/v3/channels?part=snippet&id+CHANNEL_ID&fields=items%2Fsnippet%2Fthumbnails&key={YOUR_API_KEY}
Vedaant Arya
  • 475
  • 6
  • 18
Ibrahim Ulukaya
  • 12,767
  • 1
  • 33
  • 36
  • 2
    That would work, but I'm currently receiving a users home feed. I would just like to display the channel image of the channel who posted the update. Sending a separate request for each response is a lot of work, and there has to be an easier way..? – Aleksander Aug 16 '13 at 21:09
  • 1
    For your 2nd answer "for any channel ID" I'm receiving the error: "No filter selected. Expected one of: mySubscribers, categoryId, forUsername, id, idParam, mine, managedByMe" – AdamHurwitz Aug 11 '18 at 22:39
  • @pas13's answer worked for me when I added my API key. – AdamHurwitz Aug 11 '18 at 22:50
  • 5
    `&id+CHANNEL_ID&` ought to be `&id=CHANNEL_ID&`. – Damn Vegetables Oct 16 '19 at 02:16
9

a little bit late, but maybe interesting for others:

just create a comma separated list for the different channelIds and then call

https://www.googleapis.com/youtube/v3/channels?part=snippet&id='+commaSeperatedList+'&fields=items(id%2Csnippet%2Fthumbnails)&key={YOUR_API_KEY}

therefore you don't have to send a request for each item

Community
  • 1
  • 1
pas13
  • 111
  • 1
  • 4
8

In PHP, I got it with:

$url = "https://www.googleapis.com/youtube/v3/channels?part=snippet&fields=items%2Fsnippet%2Fthumbnails%2Fdefault&id={$channelId}&key={$API}";

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$channelOBJ = json_decode( curl_exec( $ch ) );

$thumbnail_url = $channelOBJ->items[0]->snippet->thumbnails->default->url;
xavier bs
  • 1,341
  • 1
  • 12
  • 9