Post
A Facebook post.
Post can be created with:
- From ID
- From PFBID
Post.from_post_id(context: FacebookContext, post_id: str) -> PostPost.from_pfbid(context: FacebookContext, pfbid: str) -> Postnote
The PFBID is resolved to an ID using regex matching. Prefer from_post_id when possible.
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] | NoneReaction counts grouped by type, as
{"id", "name", "count"}entries.
Media
attachments: list[Photo | Video | GenericMedia | Sticker] | NoneAttached media.
Related
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)