2

Hi I'm trying to get the youtube user name and the thumbnail with a youtube app. I´m using the v3.0 and the javascript library. I'm following this example and docs: https://developers.google.com/youtube/v3/code_samples/javascript https://developers.google.com/api-client-library/javascript/reference/referencedocs

I don't have problems with the autentication but I don't know how to get de user name and image. Somebody knows?

4

3 回答 3

3

You can call channels->list with "part=id & mine=true"

GET https://www.googleapis.com/youtube/v3/channels?part=id&mine=true&key={YOUR_API_KEY}

Id is the channel's ID.

You can get the channel's title from response under snippet.title. This is what you need as usernames are not useful anymore.

From snippet.thumbnails.(key), you can pick the default, medium or high resolution thumbnail, and get it's width, height and URL.

This is what you are looking for to greet, but if you want to go deeper you can check if that account is linked with Google+ and use googleplususerid to retrieve more information via Google+ API.

于 2013-10-01T16:41:59.660 回答
0

https://www.googleapis.com/youtube/v3/channels?part=id&mine=true&access_token = [YOUR TOKEN]

YOU MUST get Oauth code and exchange it for Access Token, to :( complex to give you full answer HERE

于 2014-09-04T15:01:10.637 回答
0

Here's how I had to modify my requests to make it work with authentication (otherwise I kept getting a "dailyLimitExceededUnreg" error in the response):

  • Don't include the "key={YOUR_API_KEY}" in the URL.
  • Instead, add a HTTP header "Authorization: Bearer {ACCESS_TOKEN}"
于 2016-01-07T22:47:51.150 回答