Google Plus API get photo albums/videos

2019-04-02 04:57发布

How can I get the Google Plus Photo Albums for a user or a page? I can get the activities (post/video/photo) all together.

This is the code I'm using:

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
        }
    }
} 

This function gives the activity feeds. I need to get a list of all albums of a page.

I'm using google-api-dotnet-client.

1条回答
霸刀☆藐视天下
2楼-- · 2019-04-02 05:45

The Google+ API doesn't support direct access to albums and photos yet. What you can use is the Picasa Web Albums Data API (since this is where the Google+ photos are stored) using the same Profile/Page ID that you would use to access the Google+ API. https://developers.google.com/picasa-web/

查看更多
登录 后发表回答