我正在尝试检索一个相当大的 Facebook 组(刚刚超过一万个成员)的所有用户的列表。但是,该脚本在五千名成员之前停止下载。我没有收到任何错误消息,所以我现在想知道我的代码是否错误,或者 Facebook 是否有我一直在命中的限制(没有给出错误)?这是我的代码:
from facepy import GraphAPI
from django.core.serializers.json import DjangoJSONEncoder
import json
group_id =""
access_token = ""
graph = GraphAPI(access_token)
# "limit" can be altered, but won't change how much I can download
pages = graph.get(group_id + "/members", page=True, retry=3, limit=10000)
i = 0
for p in pages:
print('Downloading page', i)
with open('%scontent%i.json' % (group_id, i), 'w') as outfile:
json.dump(p, outfile, indent = 4, cls=DjangoJSONEncoder, ensure_ascii=False)
i += 1