Reputation: 41
facebook fql and data mining help needed
SELECT post_id, source_id, message, created_time
FROM stream
WHERE source_id IN
(
SELECT target_id FROM connection WHERE source_id=me()
) LIMIT 10
Upvotes: 1
Views: 118
Reputation: 351
As stated here:
Each query of the stream table is limited to the previous 30 days or 50 posts, whichever is greater, however you can use time-specific fields such as created_time along with FQL operators (such as < or >) to retrieve a much greater range of posts. http://developers.facebook.com/docs/reference/fql/stream
In my experience you need to make multiple queries to squeeze out all available posts in the past. First I make a query with maximum Facebook limit, like so:
SELECT post_id, source_id, message, created_time, likes
FROM stream
WHERE source_id IN (SELECT target_id FROM connection WHERE source_id=me())
LIMIT 5000
(notice also that I added 'likes' in the select which you omitted in your example and you need that if you intend to count the likes)
I then parse the results and get the created_time value from the last post and create a new query with it as a condition, like so:
SELECT post_id, source_id, message, created_time, likes
FROM stream
WHERE source_id IN (SELECT target_id FROM connection WHERE source_id=me())
AND created_time < 1361472438
LIMIT 5000
I then repeat the procedure and make additional queries until Facebook returns an empty result set.
But even when I do all that I get no more than 6 days in the past.
So it is considerably less then what Facebook states in their documentation at least looking by the date, however by count it seems you get more than 50 posts.
Upvotes: 1