This script can scrape list of friends from a Facebook's profile in 1st degree connections and 2nd degree connections. It save a CSV file from the friends. It requires Python 3, Selenium Webdriver and Chrome browser.
You'll need to have python, pip, and Google Chrome installed to use this tool. Once that's all set up:
- Clone this repository
cd
into the cloned folderpip install -r requirements.txt
Fill your email and password of Facebook's profile.
[credentials]
email=foo@bar.com
password=secret
- Run
python facebook-friends.py
- It will open a browser window and will fill your username & password automatically.
- You should see your Facebook friends page scroll to the bottom.
- A CSV file will be created with the data (1st-degree_YYYY-MM-DD_HHMM.csv)
Note: This could take days if you have lots of friends!
- Get your 1st degree connections first, so you have the 1st-degree CSV file.
- Put the 1st-degree CSV in the same folder as python facebook-friends.py
- Run
python facebook-friends.py 1st-degree_YYYY-MM-DD_HHMM.csv
, with the actual filename from the first step. - A browser window will open.
- You should the script looping through your Facebook friend's friend pages.
- A CSV file will be created with the data (2nd-degree_YYYY-MM-DD_HHMM.csv)