开发者

Getting a user's photos from 3rd parties efficiently

Let's say you have an app where your user will authenticate with Pi开发者_运维百科casa and Facebook in order for you to get all of the photos they have posted. To simply get all of a user's photos, both FB and Picasa require the same approach:

  1. Get a list of albums for the user
  2. Get a list of pictures for each album

So for any given provider with this approach, you are required to make N + 1 (N being number of albums) requests to the 3rd party. If you are doing a couple of these operations at once this seems like it would get preventably slow.

There seem to be a few alternatives to this approach:

Facebook:

  1. Get all photos related to user
  2. Parse these to find which were actually posted by the user

This will also give you other users' photos tagged with your user, so it may potentially end up performing worse than the original method due to sheer size of data as well as the number of request for paging involved.

Picasa:

There's a potential workaround here: Get all photos from Picasa by person

That would probably work but seems hacky, i.e. what is a very high value that satisfies the allowable range but can still be guaranteed to be larger than the number of photos for the user.

I know this is not going to be fast no matter which route I go, but does anyone have suggestions on what I should do here? There's also always the possibility that I'm looking at it completely wrong too.


I suggest you use FQL->

http://developers.facebook.com/docs/reference/fql/photo/

and

http://developers.facebook.com/docs/reference/fql/photo_tag/

It allows you to make one big query and facebook process it on their end, you can tweak it so it returns to you a list of pictures where user is tagged in for example.

I'm sorry I can't help with Picasa though, I never worked with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜