All projects

Facebook Profile & Posts Scraper

Cookie-auth Selenium scraper that pulls latest N posts/reels from FB profiles with atomic writes and checkpoint detection.

The challenge

Facebook's DOM selectors rotate - hard-coded XPaths break within weeks.

The solution

A Selenium-driven Python CLI (main.py) that accepts profile URL + limit and returns JSON + optional CSV. Auth is cookie-based (facebook_cookies.pkl) with email/password fallback. functions.py provides login/navigation/checkpoint-detection primitives; main.py writes outputs atomically (temp → rename) so kills mid-run never corrupt data.

Results

Cookies + fallback

Auth modes

JSON + CSV

Output

Atomic writes

Safety