最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Google+ API to get all the photos - Stack Overflow

programmeradmin7浏览0评论

I have done the Google+ authentication and now I can access user id, access token etc. I want to access the user personal and shared photos from google plus or picasa [anything works for me].

What API should I call? [Web application]

I have done the Google+ authentication and now I can access user id, access token etc. I want to access the user personal and shared photos from google plus or picasa [anything works for me].

What API should I call? [Web application]

Share Improve this question edited Mar 26, 2024 at 10:40 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Jun 8, 2013 at 14:34 user1617207user1617207 1314 silver badges9 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 2

There is currently no Google+ Photos API. The best you can do at this point is to use the Picasa Web API. For more information, see https://developers.google./picasa-web/

Although there isn't a photos API, you could read activities to find public posts with attached images. These posts will contain a full image url that can be used to render/retrieve the content on the post.

You can see what the responses look like from your public feed here:

https://developers.google./apis-explorer/#p/plus/v1/plus.activities.list?userId=me&collection=public&_h=1&

You would look for posts such as:

"verb": "post",
"object": {
"objectType": "note",
"content": "Off the grid!",
"url": "https://plus.google./109716647623830091721/posts/FH1rcTBiizW",
"replies": {
 "totalItems": 0,
 "selfLink": "https://www.googleapis./plus/v1/activities/z13dwdcw1sy4ztf2p22uydqhrp34gx5np/ments"
},
[....]
"attachments": [
 {
  "objectType": "photo",
  "displayName": "Off the grid!",
  "id": "109716647623830091721.5886945550216000274",
  "content": "6/7/13 - 1",
  "url": "https://plus.google./photos/109716647623830091721/albums/5886945550885266913/5886945550216000274",
  "image": {
   "url": "https://lh4.googleusercontent./-pGPWKUoUopE/UbKhyZyw8xI/AAAAAAAASsw/6aRt78UJlnc/w506-h750/photo.jpg",
   "type": "image/jpeg",
   "height": 750,
   "width": 506
  },
  "fullImage": {
   "url": "https://lh4.googleusercontent./-pGPWKUoUopE/UbKhyZyw8xI/AAAAAAAASsw/6aRt78UJlnc/photo.jpg",
   "type": "image/jpeg",
   "height": 4880,
   "width": 1456
  }
 }
]

},

Within attachments, you will see that fullImage link that contains a reference to the photo attached to the post.

Note that photo albums will work differently.

I used the Picasa API to get photos for my app, feel free to use it as a reference. https://bitbucket/blackey02/city-log

Note that the Picasa API seems to have cross-origin restrictions for if you want to upload images. So to upload images, you'll need to use a server/proxy, or a helper Chrome extension. (since those don't have the same cross-origin restrictions that webpage code has -- at least when the correct permissions are set in the manifest)

See here for an example solution (in a Chrome extension): https://webapps.stackexchange./a/112527/147716

发布评论

评论列表(0)

  1. 暂无评论