How to Identify a Facebook URL
Find your Facebook URL below to see which identifier to extract and which factory method to call.
Profile
A Facebook user profile.
| URL example | Identifier | Factory |
|---|---|---|
| https://www.facebook.com/Ishowspeed | Ishowspeed | Profile.from_username |
| https://www.facebook.com/profile.php?id=100084254631043 | 100084254631043 | Profile.from_user_id |
| https://www.facebook.com/ads/library/? ... &view_all_page_id=103228679166389 | 103228679166389 | Profile.from_page_id |
Post
A container post. May hold zero or more media posts.
Post https://www.facebook.com/Ishowspeed/posts/pfbid03879gxtiUxMyVbeyVFB9Vi8bT5poFwEY49j175X2pnYWAtn2bwrc3xnPJ5zDpABBal
│
├─ MediaPost https://www.facebook.com/photo/?fbid=1109890145162796
│
├─ MediaPost https://www.facebook.com/reel/1109890215162789/
│
└─ MediaPost https://www.facebook.com/100084254631043/videos/pcb.1109890215162789/1172936348430690
Each Post and each MediaPost has its own comment section. The example above has 4 comment sections.
From a pfbid URL
| URL example | Identifier | Factory |
|---|---|---|
| https://www.facebook.com/johndoe/posts/pfbid0qHZ... | pfbid0qHZ... | Post.from_pfbid |
From a numeric id URL
| URL example | Identifier | Factory |
|---|---|---|
| https://www.facebook.com/johndoe/posts/253053527513133 | 253053527513133 | Post.from_post_id |
| https://www.facebook.com/groups/2781022932139267/permalink/253617361590909 | 253617361590909 | Post.from_post_id |
| https://www.facebook.com/permalink.php?story_fbid=253053527513133&id=100084254631043 | 253053527513133 | Post.from_post_id |
note
If you have a numeric id but don't know whether it belongs to a Post or a MediaPost, use PostBase.from_any_id. It tries Post.from_post_id first, then falls back to MediaPost.from_media_post_id.
MediaPost
A single media item (photo or video) that is its own post, with its own comments, reactions, and permalink.
Group
A Facebook group.
| URL example | Identifier | Factory |
|---|---|---|
| https://www.facebook.com/groups/workingmemes | workingmemes | Group.from_groupname |
| https://www.facebook.com/groups/2781022932139267 | 2781022932139267 | Group.from_group_id |
MarketplaceListing
A Marketplace listing.
| URL example | Identifier | Factory |
|---|---|---|
| https://www.facebook.com/marketplace/item/1234567890123456 | 1234567890123456 | MarketplaceListing.from_listing_id |
Advertisement
An advertisement from the Meta Ad Library.
| URL example | Identifier | Factory |
|---|---|---|
| https://www.facebook.com/ads/library/? ... &id=123456789876789 | 123456789876789 | Advertisement.from_ad_id |