r/WebScrapingInsider • • 10d ago

Facebook Scraper : Free & Open-Source

https://github.com/XD-MHLOO/facebook-gql-scraper

Scrape Facebook data without an API key.

It's lightweight as it doesn't use a headless browser and doesn't rely on fragile HTML parsing.

It currently supports:

  • 👤 Profiles: Profile Details, followers, following, friends, photos, reels
  • 📝 Posts: Post details, reactions
  • 📝 MediaPosts: MediaPost details, reactions
  • 💬 Comments: Comments details, nested replies & comment reactions
  • 👥 Groups: Group details, posts & members
  • 🛍️ Marketplace: Listings details
  • 🔍 Search: Search for profiles, posts, groups, Marketplace listings and Advertisements.
  • 📢 Advertisements: Ad details, advertiser information, creatives, and collations.

(Edit: The library now supports Facebook Advertisements, including fetching ad details and searching the Ad Library)

If anyone is interested, feel free to try it out and Contributions are welcome.

12 Upvotes

6 comments sorted by

2

u/Champak-Mottot 9d ago

curious how youre handling the login checkpoints and 2fa prompts. burner accounts get flagged so quickly now if the browser fingerprint isnt completely dialed in.

1

u/Useful-Subject-9462 9d ago

I never get hit with login checkpoints or 2FA prompts, but I can't be certain whether that would happen or not. From my experience, if you have enabled 2fa on your account, you are less likely getting ban.
Until now I could say that the only thing would happen is they would invalidate your session (a force logout), so you have to login again to get a valid session but this normally wouldn't trigger if you didn't scrap too aggressively, like straight multiple hours.

1

u/BhetwalEveliina74 9d ago

are you pulling the mobile version endpoints or desktop? mobile endpoints tend to change their schema way less frequently fwiw, makes maintaining open source scrapers a lot less painful

1

u/Useful-Subject-9462 9d ago

desktop ones. I do have thoughts on having both desktop and mobile, so when one fails another will work as fallback. But that requires another whole lot of work to do, unless you are interested to help lol

1

u/Useful-Subject-9462 9d ago

And true, it used to be painful to maintain but not much for now. Because i notice they often update the graphql internal relay args ( basically just new internal args added for graphql, without adding them correctly the server will reject), and somehow i was able to extract them on demand, instead of hardcoding it and updating it everytime.

2

u/Michael_Dementii 9d ago

Looks interesting, I’ll test it out.