Skip to main content

Post

A Facebook post.

Post can be created with:

Post.from_post_id(context: FacebookContext, post_id: str) -> Post

Properties​

Identity

id : str
Post ID.
creation_time : int | None
Unix timestamp of when the post was created.
url : str | None
Facebook post URL.
title : str | None
Optional title, when the post has one.
text : str | None
Body text of the post.

Engagement

reaction_count : str | None
Total reactions as a display string, e.g. "47619".
share_count : int | None
Number of shares.
comments_count : int | None
Number of comments.
reactors_visible : bool | None
Whether the list of reactors is public.
top_reaction_breakdown : list[dict] | None

Reaction counts grouped by type, as {"id", "name", "count"} entries.

Media

attachments : list[Photo | Video | GenericMedia | Sticker] | None

Attached media.

Related

owner : Profile | None
The post's author.
group : Group | None
The group the post belongs to, if any.

Methods​

All methods return a PaginatedIterator of model objects.

get_comments() -> PaginatedIterator[Comment]
All comments on the post.
get_reactors() -> PaginatedIterator[Reactor]
Users who reacted to the post.

Example​

import facebook_gql_scraper as fgs

context = fgs.FacebookContext(cookies_file="facebook_cookies.json")

post = fgs.Post.from_user_id(context, user_id="253053527513133")
# Or from PFBID: post = fgs.Post.from_pfbid(ctx, pfbid="pfbid0qHZRZohg13A1DmZpkFvHr3yuv7y1heFNnNoijtvi5onn1ctx2sjM5rRgTMSh6EGql")

for comment in post.get_comments():
print(comment.id, comment.text)