Google API:查找用户 YouTube 频道 [英] Google API: Find a Users YouTube Channel

查看:87
本文介绍了Google API:查找用户 YouTube 频道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 YouTube API 并试图获取用户的 YouTube 链接.唯一显示的是 Google+ 链接作为称为链接的字段.有没有办法从 Google 帐户信息中获取用户的 Youtube 信息?

Google 响应在 json 响应中包含 first_name、given_name 和链接.

谢谢!

解决方案

我不知道这是否正是您想要的,但是使用 Google+ API 您可以获得用户网址,其中之一可以是用户 YouTube 频道网址

更多信息:https://developers.google.com/+/api/latest/people/get

示例:

请求:

<块引用>

https://www.googleapis.com/plus/v1/people/117629885563933382879?key={YOUR_API_KEY}

回复:

<预><代码>{"kind": "加上#person","etag": "\"l9gWq2lTiBDNZWBx8kpM7h7VNYs/as5084EFycaxtFP9IxDLvhbwZKM\"","生日": "0000-12-30","性别": "男",网址":[{"value": "http://twitter.com/matiasmolinas",类型":其他"},{"value": "http://gplus.to/matiasmolinas",类型":其他"},{"value": "http://ar.linkedin.com/in/matiasmolinas",类型":其他"},{"value": "https://www.facebook.com/matias.molinas",类型":其他"},{"value": "http://www.youtube.com/user/matiasmolinasvideo",类型":其他"},{"value": "http://stackoverflow.com/users/1427200/matias-molinas",类型":其他"},{"value": "http://santafegtug.blogspot.com/",类型":其他"},{"value": "http://fuse21.blogspot.com/",类型":其他"},{"value": "http://lookthiscode.blogspot.com.ar/",类型":其他"},{"value": "https://yt-topic-explorer.googlecode.com/git/dist/index.html",类型":其他"},{"value": "http://santafegtug.appspot.com/",类型":其他"}],"objectType": "人","id": "117629885563933382879","displayName": "马蒂亚斯·莫利纳斯",名称": {"familyName": "莫利纳斯","givenName": "马蒂亚斯"},"aboutMe": "Citas 收藏夹:<br/><br/>Dentro devinete años te sentirás más desilusionado por las cosas que no hiciste que por aquéllas que hiciste. Así que suelta las amarras. de lavegabahía segura.Atrapa los alisios en tus velas.Explora.Sueña.Descubre.<br/>","url": "https://plus.google.com/117629885563933382879",图像": {"url": "https://lh3.googleusercontent.com/-AJKFDGod6us/AAAAAAAAAAI/AAAAAAAAD64/Olccnle-qH4/photo.jpg?sz=50"},组织":[{"name": "UNER","title": "Bioingenieria","类型": "学校",主要":假},{"name": "软件顾问","title": "软件顾问","类型": "工作","开始日期": "2011","endDate": "2011",主要":真实},{"name": "软件圣达菲","类型": "工作","endDate": "2011",主要":假}],居住的地方":[{"value": "阿根廷圣达菲",主要":真实}],isPlusUser":真,已验证":假,覆盖": {"layout": "横幅",封面照片": {"url": "https://lh3.googleusercontent.com/-DjGbmNDlV3U/UNCgpGJu_WI/AAAAAAAAD7Q/7Uk2WidwxnI/w940-h428/gdesummit.png",高度":428,宽度":940},封面信息":{topImageOffset":-83,左图像偏移":0}}}

I was using the YouTube API and was trying to get a user's YouTube Link. The only thing that shows up is the Google+ link as a field called link. Is there anyway to get the users's Youtube information from the Google Account info?

The Google Response has first_name,given_name, and link in the json response.

Thanks!

解决方案

I do not know if it's exactly what you want, but using the Google+ API you can get the user urls and one of them can be the user YouTube channel url

More info: https://developers.google.com/+/api/latest/people/get

Example:

Request:

https://www.googleapis.com/plus/v1/people/117629885563933382879?key={YOUR_API_KEY}

Response:

{
 "kind": "plus#person",
 "etag": "\"l9gWq2lTiBDNZWBx8kpM7h7VNYs/as5084EFycaxtFP9IxDLvhbwZKM\"",
 "birthday": "0000-12-30",
 "gender": "male",
 "urls": [
  {
   "value": "http://twitter.com/matiasmolinas",
   "type": "other"
  },
  {
   "value": "http://gplus.to/matiasmolinas",
   "type": "other"
  },
  {
   "value": "http://ar.linkedin.com/in/matiasmolinas",
   "type": "other"
  },
  {
   "value": "https://www.facebook.com/matias.molinas",
   "type": "other"
  },
  {
   "value": "http://www.youtube.com/user/matiasmolinasvideo",
   "type": "other"
  },
  {
   "value": "http://stackoverflow.com/users/1427200/matias-molinas",
   "type": "other"
  },
  {
   "value": "http://santafegtug.blogspot.com/",
   "type": "other"
  },
  {
   "value": "http://fuse21.blogspot.com/",
   "type": "other"
  },
  {
   "value": "http://lookthiscode.blogspot.com.ar/",
   "type": "other"
  },
  {
   "value": "https://yt-topic-explorer.googlecode.com/git/dist/index.html",
   "type": "other"
  },
  {
   "value": "http://santafegtug.appspot.com/",
   "type": "other"
  }
 ],
 "objectType": "person",
 "id": "117629885563933382879",
 "displayName": "Matias Molinas",
 "name": {
  "familyName": "Molinas",
  "givenName": "Matias"
 },
 "aboutMe": "Citas favoritas:<br /><br />Dentro de veinte años te sentirás más desilusionado por las cosas que no hiciste que por aquéllas que hiciste. Así que suelta las amarras. Navega fuera de la bahía segura. Atrapa los alisios en tus velas. Explora. Sueña. Descubre.<br />",
 "url": "https://plus.google.com/117629885563933382879",
 "image": {
  "url": "https://lh3.googleusercontent.com/-AJKFDGod6us/AAAAAAAAAAI/AAAAAAAAD64/Olccnle-qH4/photo.jpg?sz=50"
 },
 "organizations": [
  {
   "name": "UNER",
   "title": "Bioingenieria",
   "type": "school",
   "primary": false
  },
  {
   "name": "Software Consultant",
   "title": "Software Consultant",
   "type": "work",
   "startDate": "2011",
   "endDate": "2011",
   "primary": true
  },
  {
   "name": "Software Santa Fe",
   "type": "work",
   "endDate": "2011",
   "primary": false
  }
 ],
 "placesLived": [
  {
   "value": "Santa Fe, Argentina",
   "primary": true
  }
 ],
 "isPlusUser": true,
 "verified": false,
 "cover": {
  "layout": "banner",
  "coverPhoto": {
   "url": "https://lh3.googleusercontent.com/-DjGbmNDlV3U/UNCgpGJu_WI/AAAAAAAAD7Q/7Uk2WidwxnI/w940-h428/gdesummit.png",
   "height": 428,
   "width": 940
  },
  "coverInfo": {
   "topImageOffset": -83,
   "leftImageOffset": 0
  }
 }
}

这篇关于Google API:查找用户 YouTube 频道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆