Question

I am trying to extract the banner-image used in a certain youtube channel programmatically.

As far as I know it is to be in the brandingSettings, to be exact I think it is brandingSettings.image.bannerImageUrl, see here for an indetail description of the API:

https://developers.google.com/youtube/v3/docs/channels

So, I suppose I should be able to get that information with a GET request like this:

https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&key=[YOURAPIKEY]&forUsername=esltv

But that request (replacing the [YOURAPIKEY] with my actual key of course) returns without the desired part "brandingSettings":

    {
       "kind": "youtube#channelListResponse",
       "etag": "\"79S54kzisD_9SOTfQLu_0TVQSpY/WJfuNLYVgEQVEhWQ-03PpQlCyzo\"",
         "pageInfo": {
        "totalResults": 1,
         "resultsPerPage": 5
         },
         "items": [
            {
            "kind": "youtube#channel",
            "etag": "\"79S54kzisD_9SOTfQLu_0TVQSpY/GwL7oIruOCBr66yiNtrJqE3_Drs\"",
            "id": "UC0G2qz-hoaCswQNgoWU_LTw"
             }
          ]
    }

I currently have turned on "YouTube Data API v3" in google api console.

Am I missing some permission, or does the channel somehow not suit in regard of retrieving its brandingSettings?

BRs, Sebastian

Was it helpful?

Solution

for Username is actually for you to get the channelId. channels.list actually depends on channelId.

So with your first request you get channelID back, then do the same request second time, use channelId instead of username. (If you already know channelID use it first time as well.)

GET https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&id=UC0G2qz-hoaCswQNgoWU_LTw&key={YOUR_API_KEY}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top