Search code examples
facebookfacebook-graph-apifacebook-fql

Querying old links from public Facebook page returns an empty set


I am trying to fetch links that were posted on a public Facebook page sometime ago, in 2011 for example. Specifically, the Arabic CNN page on facebook: http://www.facebook.com/CNNArabic

Things I tried:
1- Graph API, a query like this:
CNNArabic/links?fields=id,name,link,created_time&limit=25&until=2012-05-15

2- FQL
SELECT link_id, url, created_time FROM link WHERE owner = 102581028206 and created_time < 1337085958 LIMIT 100

Both give an empty data set while there is data on the page on or before this date.

Other things I noticed:
1-If I changed the date to something like 2013-01-17 (which is yesterday), it works fine.
2-If I changed the date to something like 2012-12-17 (about a month ago), an empty data set is returned, however if I followed the next page links in the returned data set from the query in number 1 above until I pass by this date I actually get data.

I tried writing code that kept following the next page pointers until I reach the links on the date I want. However I need data much older (say in 2011) and the result set gets exhausted say 2 or 3 months earlier than now, in other words no more next links are returned so I actually can never reach that old data.

To cut this short: is there a way I can query links that were posted on a public page before a specified date?


Solution

  • Querying the page's feed works in the Graph API:

    /102581028206/feed?fields=id,link,name,created_time&limit=25&until=2012-05-15
    

    This returns all the posts. There should be a way to filter this using field expansion, but I couldn't get the few things I tried to work.

    You can get this filtered for links only with FQL on the stream table:

    SELECT message, attachment, created_time FROM stream WHERE source_id = 102581028206 
        AND created_time < strtotime('2012-05-15') AND type=80 LIMIT 10
    

    Links are type=80.