简体   繁体   English

如何使用 facepy、graphAPI 和 Python 3.5 从 Facebook 群组中获得超过 5000 名成员

[英]How can I get more than five thousand members from a Facebook group using facepy, graphAPI and Python 3.5

I am trying to retrieve a list of all users of a fairly large Facebook group (just over ten thousand members).我正在尝试检索一个相当大的 Facebook 群组(刚刚超过一万个成员)的所有用户的列表。 However, the script stops downloading just before five thousand members.但是,脚本在五千名成员之前停止下载。 I don't get any error messages, so I now wonder if my code is wrong or if Facebook has a limit (without giving errors) that I keep hitting?我没有收到任何错误消息,所以我现在想知道我的代码是否有误,或者 Facebook 是否有我一直点击的限制(没有给出错误)? Here is my code:这是我的代码:

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

There is an old bug about this: https://developers.facebook.com/bugs/267362886791339/有一个关于此的旧错误: https : //developers.facebook.com/bugs/267362886791339/

As you can see, it is a well known bug, but Facebook will not fix it.如您所见,这是一个众所周知的错误,但 Facebook 不会修复它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM