tags:

views:

40

answers:

2

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: http://stackoverflow.com/questions/3452018/breaking-the-5000-object-limit-in-facebook-api

Thanks!

+1  A: 

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
Is there no way to accomplish this by just using Graph?
Ian
@Ian - Does the response from the graph contain any sort of paging or cursor information?
Peter Bailey
@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
@Peter: There is. But there is a 5000 limit.
Ian
@serg: Yup, I tried to query the pid from the aid. The topmost result is the 5000th picture.
Ian
http://stackoverflow.com/questions/3452018/breaking-the-5000-object-limit-in-facebook-api -- We can continue the discussion here. Thanks!
Ian
+1  A: 

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&amp;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

related questions