Announcement Announcement Module
Collapse
No announcement yet.
How to retrieve ALL the FB photos a person is tagged in (paging doesn't work right) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to retrieve ALL the FB photos a person is tagged in (paging doesn't work right)

    I'm using the following code to get photos a person is tagged in:
    Code:
    Facebook.mediaOperations().getPhotos(String objectId, int offset, int limit);
    The problem is offset and limit don't seem to work properly with larger numbers of photos. I end up missing photos. I read that you can set limit to 0 and get all photos, but again I miss photos that way when there are many. So what numbers should I use? I don't know... but Facebook recommends you use their paging.previous and paging.next URLs that are returned when calling their photos operation from their graph API. Is there a way to see those URLs from Spring Social Facebook?

  • #2
    The previous and next URLs are not exposed through Spring Social Facebook. Even if they were, what would you do with them? You'd have to drop down to the RestTemplate level to use them. Perhaps there's a way to use these internally, though, to improve paging. But before I consider that, I'd like to know how the current solution isn't working for you.

    In what way are you missing photos when using offset and limit? If you ask for offset=0;limit=25, then you should get the first 25 photos, right? Then you can ask for offset=25;limit=25 to get the next 25. Or does that not work as expected? If it doesn't work, is there some pattern for which photos are missing? (Note that I've tried this with my own photos and haven't noticed any missing photos, so any details as to what's wrong when you use it would be very helpful.)

    Comment


    • #3
      So paginating manually through the photos with a limit of 25 would probably work I'm guessing. But how do I know? I know that large limits or zero limits don't work properly, but there's no documentation I could find which says what you are allowed to or supposed to use. Actually having a limit of 25 is good if I can spawn threads to retrieve a ton of batches all at once. I can do that with limit=25 and offset=<multiple of 25>. So I might prefer to use your suggestion, however, I'm likely to hit Facebook's throttling threshold (also undocumented as far as I could find).

      For my site, I'd rather have the reliability of using Facebook's next and previous URL pagination mechanism.

      Ok, after checking, looks like Facebook's next and previous pagination mechanism effectively do a limit=25 and offset=<multiple of 25>. So I assume it's fine to do that ourselves. Though Facebook is always changing...

      Comment

      Working...
      X