根據CBroe的建議,可以在主命令中添加時間戳以根據特定日期提取數據。
until_date_timestamp = int(datetime.strptime('04/08/2016', '%d/%m/%Y').strftime("%s"))
graph = facebook.GraphAPI(access_token)
profile = graph.get_object(user)
posts = graph.get_connections(profile['id'], 'posts', until = until_date_timestamp)
feeds = graph.get_connections(profile['id'], 'feed', until = until_date_timestamp)
在這裏,如果我們要指定一個開始日期爲好,那麼它是
until_date_timestamp = int(datetime.strptime('04/08/2016', '%d/%m/%Y').strftime("%s"))
start_date_timestamp = int(datetime.strptime('01/01/2016', '%d/%m/%Y').strftime("%s"))
graph = facebook.GraphAPI(access_token)
profile = graph.get_object(user)
posts = graph.get_connections(profile['id'], 'posts', since = start_date_timestamp,until = until_date_timestamp)
feeds = graph.get_connections(profile['id'], 'feed', since = start_date_timestamp,until = until_date_timestamp)
https://developers.facebook.com/docs/graph-api/using-graph-api/ #paging – CBroe
@CBroe這很有幫助,但是如何在python命令中指定它。 – prashanth
爲此,您必須檢查您正在使用的任何框架的文檔。 – CBroe