YouTube API - no channel branding settings returned for user name queries

When using the YouTube v3 API to request channel branding settings, why are they returned for requests by channel ID, but not for requests by username? The API does not return branding settings for channel list queries by username.

If you request channel branding settings by channel ID (for example, id=UC8-Th83bH_thdKZDJCrn88g ), you will id=UC8-Th83bH_thdKZDJCrn88g full set of branding parameters:

Google API Explorer: https://developers.google.com/youtube/v3/docs/channels/list

Request

 GET https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&id=UC8-Th83bH_thdKZDJCrn88g&key={YOUR_API_KEY} 

answer

 { // ... snip ... "items": [ { "kind": "youtube#channel", "etag": "\"...\"", "id": "UC8-Th83bH_thdKZDJCrn88g", "brandingSettings": { "channel": { "title": "The Tonight Show Starring Jimmy Fallon", "description": "Watch The Tonight Show Starring Jimmy Fallon Weeknights 11:35/10:35c\n\nThe Tonight Show Starring Jimmy Fallon features hilarious highlights from the show including: comedy sketches, music parodies, celebrity interviews, ridiculous games, and, of course, Jimmy Thank You Notes and hashtags! You'll also find behind the scenes videos and other great web exclusives.", // all the branding settings are here } } }] } 

If, on the other hand, you send a channel list request for the username (for example, forUsername=latenight ), you get no branding settings at all . Branding settings are not returned or filled out.

Request

 GET https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&forUsername=latenight&key={YOUR_API_KEY} 

answer

 { // ... snip ... "items": [ { "kind": "youtube#channel", "etag": "\"...\"", "id": "UC8-Th83bH_thdKZDJCrn88g" }] } 
+1
source share
1 answer

I may be mistaken, but I believe that channel identifiers are the only way to get a complete answer in the v3 APIs, as the concept of "username" does not actually exist in the same way. That is, newly created YouTube channels are associated with the G + profile and may have a display name, but in fact there is not a single YouTube username associated with such a channel.

Since usernames existed, and many of them are still known to them, the "forUsername" parameter is intended to provide you with the associated channel identifier, and then will prompt you for branding parameters with this.

Now, having said that, it is clear that the language on the API Explorer page does not reflect this, and this may be the problem; I take my conclusions from this documentation:

https://developers.google.com/youtube/v3/guides/working_with_channel_ids#v3

and from this error report:

https://code.google.com/p/gdata-issues/issues/detail?id=4821&q=forUsername&colspec=API%20ID%20Type%20Status%20Priority%20Stars%20Summary

But it is always possible that I am reading incorrectly, and you actually see a new error. The only way to know for sure is to file it (or maybe someone from the team could comment here)?

+7
source

Source: https://habr.com/ru/post/1234640/


All Articles