This script can scrape the list of your Facebook friends in 1st degree connections and 2nd degree connections. It will save a CSV file of your friends. Also it will check for your disconnected friends (the users that unfriended you).
You'll need to have:
Once that's all set up:
- Clone this repository
git clone https://github.com/m-primo/facebook-friends
. - Go to the cloned directory
cd facebook-friends
. - Install the requirements
pip install -r requirements.txt
.
Rename config-example.txt
to config.txt
.
Then fill your email and password of your Facebook account.
[credentials]
email=your_email@email.com
password=yourpassword
- Run
python app.py
. - It will open a browser window and will fill your username & password automatically.
- You should see your Facebook friends page and the page will be scrolling to the bottom automatically.
- A CSV file will be created with the data in the
data
directory with the name1st-degree_YYYY-MM-DD_HHMM.csv
.
Note: This could take days if you have a lot of friends!
- You should have the 1st-degree CSV file. So, get your 1st degree connections first.
- Put the 1st-degree CSV in the
data
directory. - Run
python app.py data/1st-degree_YYYY-MM-DD_HHMM.csv
with the actual CSV filename. - A browser window will open.
- You should see the script looping through your Facebook friend's friend pages.
- A CSV file will be created with the data in the
data
directory with the name2nd-degree_YYYY-MM-DD_HHMM.csv
.
- Run
python app.py data/1st-degree_YYYY-MM-DD_HHMM.csv un
, with the actual CSV filename. - It will do the same as "1st degree connections" to get your current friends.
- You should see who unfriended you, and also it will be saved in CSV file in the
data
directory with the name1st-degree-disconnections_YYYY-MM-DD_HHMM.csv
.