Python command-line tool for tracking changes in your Facebook friends list.
Useful to see who (and when) unfriended you, or check out the friends you added or removed from your list. This is accomplished by having 2 lists of people, an added-list and removed-list.
All of the following requirements must be fulfilled before running the tool. Make sure to modify the Python source file accordingly.
- Email and password of Facebook account!
- A Facebook app is needed (ID and secret) in order to access the graph API.
- Facebook SDK Python module.
- hosts must be modified on the running machine, adding the facebook app name as 127.0.0.1 - in order to have a local HTTP server, which will be used for redirection and thus to obtain the OAuth token.
Type unfriend.py -h
for a list of all the available arguments. The email used to register for the Facebook account (aka username) must always be used.
First run unfriend.py username
. This will open a new browser tab where the user can login to Facebook and allow the Facebook application to access it's graph data. Next the OAuth token is obtained and saved locally inside the username.fbat file (the friends data will be saved in username.dat file).
From now on, every time the tool is beeing run, this token will be read from the file and then used, if there is no other token given as command parameter. Running unfriend.py username
will sync the local data with the remote one.
Calling for example unfriend.py username -lr -d
will display in detail (with ID and timestamp) all the ex-friends that were tracked by the tool. unfriend.py username -c
will count the current Facebook friends, if a valid token is found inside the username.fbat file. unfriend.py username -t TOKEN -l
will use the provided TOKEN to display all your current Facebook friends by name.
- Tracking starts from the moment the tool is run for the first time. There is no possibility to register previous events and data about ex-friends.
- If a specific person has opted out of Facebook graph API calls (i.e. third party applications), then that person will not be discovered by the tool.
- If a user deactivates his profile and then reactivates it, or because of unknown circumstances he doesn't appear in the friends list at one time, that person will move to the removed-list and stay there. This can be fixed easily though.
- The timestamp of each add-event and remove-event is dependent on the time when the tool is executed. For better and more precise results, running the tool could be automated every day or every 12 hours for example.
- The lists are shown ordered by the Facebook user ID. Sorting by name/date is not implemented.
- The Facebook OAuth token is valid for 60 days, after it expires a new one must be obtained (this can be achieved with the tool by moving or deleting the current username.fbat file).
- Speaking of OAuth token, keep in mind this is sensitive data and should be kept somewhere safe and private. Right now it is written in plain text inside the .fbat file.