2012-07-06 50 views
2

如何获取用户或页面的Google Plus相册?我可以一起获得活动(帖子/视频/照片)。Google Plus API获取相册/视频

这是我使用的代码:

var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description); 
provider.ClientIdentifier = GoogleIdentifier; 
provider.ClientSecret = GoogleSecret; 

ActivitiesResource.Collection collection = new ActivitiesResource.Collection(); 

var service = new PlusService(); 
service.Key = GoogleKey; 
ActivitiesResource.ListRequest list = service.Activities.List(ProfileID, collection); 

foreach (Activity activityFeed in list.Fetch().Items) 
{ 
    var title = activityFeed.Title; 
    foreach (Activity.ObjectData.AttachmentsData attachment in activityFeed.Object.Attachments) 
    { 
     if (attachment.ObjectType == "photo") 
     { 
      //add to list of photo 
     } 

     else if (attachment.ObjectType == "video") 
     { 
      //add to list of video 
     } 
    } 
} 

这个功能可以使活动源。我需要获得一个页面的所有专辑列表。我正在使用google-api-dotnet-client

+0

你能告诉我们你到目前为止所尝试过的吗? – Surfbutler 2012-07-07 08:20:50

+0

这是我现在使用的代码..我已经发布了另一个问题。因为我在fetch()函数中有错误。 [链接](http://stackoverflow.com/questions/11370362/an-item-with-the-same-key-has-already-been-added-google-plus)@Surfbutler – MMALSELEK 2012-07-07 08:48:13

回答

3

Google+ API不支持直接访问相册和照片。 您可以使用的是使用您用于访问Google+ API的相同个人资料/网页ID的Picasa网络相册数据API(因为这是存储Google+照片的地方)。 https://developers.google.com/picasa-web/

+1

这是Google的预览版Plus图像,专辑和视频API。它似乎在密切复制Picasaweb API。我很高兴看到媒体托管和网址的域名未发生变化(googleusercontent.com/accountid/userid/albumid/imageParams/filename)http://siliconfilter.com/google-gets-an- api-for-photos-and-videos/ – 2013-03-07 18:06:33

+0

任何人都知道这是否改变了?似乎有一些关于G + API的讨论,但目前还不清楚视频是否可以通过它进行访问,或者Picasa是否仍然可行。 – Webreaper 2015-02-12 13:15:07

+0

不好,不幸的是,那里还没有改变。 Picasa API仍然是访问此信息的唯一方式。 – Scarygami 2015-02-12 13:16:32