Exploring different methods to retrieve a list of my Facebook friends on a daily basis, I embarked on a journey to find the most efficient way to achieve this goal.
Initially, I opted for creating a selenium webdriver script. This involved opening a web browser, navigating to /me/friends
, automatically scrolling down to the end of the list, and then extracting the names. While this method was effective, it did take a considerable amount of time (around 4-5 minutes).
Upon further investigation into the graph API, it became apparent that obtaining a complete friend list was not feasible.
An alternative approach would be to request Facebook to download all of your data. However, this process involves waiting for an email from Facebook with a link to download the data, adding another layer of delay.
Lastly, I came across a Chrome extension called who deleted me
which proved to be faster than my previous approaches. Despite its efficiency, I had reservations about using third-party extensions to access my data and preferred to find a more independent solution. It was also intriguing to note that this extension failed to detect a deceased friend of mine, prompting me to question its methodology and whether there exists an endpoint to access public friends.
Are there other programming techniques for fetching friends' lists? One potential method could involve using a headless browser to make requests to /me/friends
and extract responses similar to how a traditional browser scrolls through the page. However, identifying the correct ajax calls in this scenario might prove challenging.
Update: Regarding my scraping method, you can view the code here: https://gist.github.com/johndel/cd01a854e8bf36d9d30b44758607cf3d#file-check_friends-rb
While not the most polished code, it serves as a workaround for accomplishing the task. Simply replace the sendkeys with your email/password to initiate the process. My approach successfully retrieves all of my friends, unlike the aforementioned Chrome extension which missed one individual. This leads me to believe that it may be utilizing a different endpoint or methodology.