我正在尝试从 Facebook 群组中提取所有帖子。我按照 2017 年帖子中的示例安装了 facepy:
import csv
from datetime import datetime
from facepy import GraphAPI
import json
APP_TOKEN = r'XXXMYTOKENXXX'
graph = GraphAPI(APP_TOKEN)
groupIDs = ("2208833392") #https://www.facebook.com/groups/TheEntomologyGroup/ has Facebook Group ID 2208833392
now = datetime.now() # current date and time
date_time = now.strftime("%Y%m%d%H%M%S")
outfile_name = date_time+"TheEntomologyGroup.csv"
f = csv.writer(open(outfile_name, "wb+"))
for gID in groupIDs:
groupData = graph.get(gID + "/feed", page=True, retry=1, limit=500)
for data in groupData:
json_data=json.dumps(data, indent = 4,cls=DecimalEncoder)
decoded_response = json_data.decode("UTF-8")
data = json.loads(decoded_response)
print("Paging group data...")
for item in data["data"]:
print(item)
...但我收到一个错误:
FacebookError: [100] Unsupported get request. Object with ID '2' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api
问题:
- facepy 仍然是用于此类事情的最佳/最简单的库吗?
- 我究竟做错了什么?有什么建议么?