Reputation: 75
I'm trying to fetch all posts on specific page after certain time. I'm using this facebook-sdk for python. Last post on the page has been posted 30th may 2017. The problem with my query is that even if I try to limit the query with since='2017-06-06T09:00:00+00:00'
, it always returns my posts from the page.
My timestamp is in exact same format as I get it if I query it from the facebook.
Here's the code
facebook_api = facebook.GraphAPI(access_token='FACEBOOK_PAGE_ACCESS_TOKEN')
facebook_feed = facebook_api.get_object(
id=FACEBOOK_PAGE_ID,
fields='feed',
since='2017-06-06T09:00:00+0000'
)
I don't have a clue what kind of api query url facebook-sdk for python creates with this code and I don't know how to check that.
I also tried converting timestamp to unix timestamp with online tool, but it didn't work either.
Upvotes: 0
Views: 374
Reputation: 356
get_object() will query the root node directly, not the non-root nodes. Use get_connections() instead.
Read more here about objects: https://developers.facebook.com/docs/graph-api/reference/
Try below code, it works for me.
import facebook
facebook_api = facebook.GraphAPI(access_token='YOUR_ACCESS_TOKEN')
facebook_feed = facebook_api.get_connections('YOUR_PAGE_ID', 'feed', since=1496707200)
print facebook_feed['data']
Upvotes: 2