2012-07-06 51 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