1

I am creating a Facebook application that will download all the photos in an album. The application is created for my personal use and at the same time, learn the Facebook API and JSON.

I can already retrieve the URL of the photos inside an album by calling this url:

http://graph.facebook.com/[album id]/photos?fields=source

The album that I'm trying to download contains 5400+ photos so I tried increasing the limit by adding the limit parameter:

http://graph.facebook.com/[album id]/photos?fields=source&limit=1000

Here's the problem:

The results being returned are only until 2010-07-30T11:20:11+0000. When I tried to modify the query by using the until parameter like so:

http://graph.facebook.com/[album id]/photos?fields=source,link&limit=1000&until=2010-06-01

the data responded correctly. However, if I changed the date to something like 2010-08-05, the latest photo returned will have a created_date of 2010-07-30T11:20:11+0000.

The last photo returned is photo #5000 out of 5695.

Here's my question:

Is the data acquired from Facebook GRAPH Api real-time (or a Monthly update, 2010-07-30)? Or there's just a limit on the number of photos returned on album (like 5000)?

Thanks!

EDIT

There is a 5000 object limit in Facebook. If you know how to break the limit, go here: Breaking the 5000 object limit in Facebook API

Thanks!

Community
  • 1
  • 1
Ian
  • 5,625
  • 11
  • 57
  • 93
  • PS: I'm doing this all currently in the browser. – Ian Aug 10 '10 at 16:07
  • If anyone is interested, here's the graph query: https://graph.facebook.com/119403264763178/ The album is part of this group: http://www.facebook.com/timyap.pretty – Ian Aug 10 '10 at 16:12

2 Answers2

1

There is indeed 5000 limit on returned objects. You would need to run multiple FQL queries on photo table ordering and limiting the results (<5000) to get all the data (check photo table page for examples). (doesn't work)

serg
  • 109,619
  • 77
  • 317
  • 330
  • Is there no way to accomplish this by just using Graph? – Ian Aug 10 '10 at 17:25
  • @Ian - Does the response from the graph contain any sort of paging or cursor information? – Peter Bailey Aug 10 '10 at 17:43
  • @Ian I just checked FQL has the same problem - no data above 5000 limit returned no matter what, sorry. Maybe someone else would be able to help. – serg Aug 10 '10 at 17:55
  • @Peter: There is. But there is a 5000 limit. – Ian Aug 10 '10 at 18:04
  • @serg: Yup, I tried to query the pid from the aid. The topmost result is the 5000th picture. – Ian Aug 10 '10 at 18:04
  • http://stackoverflow.com/questions/3452018/breaking-the-5000-object-limit-in-facebook-api -- We can continue the discussion here. Thanks! – Ian Aug 10 '10 at 18:10
1

When I look at the photos in the graph query you linked

https://graph.facebook.com/119403264763178/photos

I see paging information at the bottom. So, hacking together a quick test

$request  = 'http://graph.facebook.com/119403264763178/photos?fields=source&limit=1000';
$response = json_decode( file_get_contents( $request ), true );

$totalCount = 0;

while ( count( $response['data'] ) )
{
  echo 'Fetching ' . urldecode( $response['paging']['next'] ) . '<br>';
  $totalCount += count( $response['data'] );
  $response = json_decode( file_get_contents( $response['paging']['next'] ), true );
}

echo $totalCount;

It would seem that even following the paging data, you can still only retrieve 5000 records.

I'd suggest hitting up the FB forums or opening a bug ticket.

Peter Bailey
  • 105,256
  • 31
  • 182
  • 206