sns-sdks / python-facebook

A simple Python wrapper for facebook graph api :sparkles: :cake: :sparkles: .
https://sns-sdks.github.io/python-facebook/
328 stars 86 forks source link

groups? #190

Closed Ketsby69 closed 2 years ago

Ketsby69 commented 2 years ago

How can I bring all the posts of a group, do you have any code example?

MerleLiuKun commented 2 years ago

If you want to get the posts for a group, just like get page's posts.

If you are using the GraphAPI, The code may

from pyfacebook import GraphAPI
api = GraphAPI(access_token="xxx")

posts = api.get_connection(object_id="group_id", connection="posts")

If you are using the FacebookApi.

from pyfacebook import FacebookApi
api = FacebookApi(access_token="xxxx")

posts = api.group.get_feed(object_id="group id")