Last active
January 6, 2023 15:35
-
-
Save bobbicodes/4eae59f5ed9ff76e5408e76ace87ed97 to your computer and use it in GitHub Desktop.
Who unfriended me?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns friends | |
(:require [cheshire.core :as json] | |
[clojure.set :as set])) | |
;; The way this works is you download your own Facebook data as JSON | |
;; (Settings -> Privacy -> Your Facebook information -> Download Your Information) | |
;; All that you need is Connections -> Friends and followers selected. | |
;; It will be ready in a few minutes and will be less than 1MB. | |
;; Place 2 files spanning a certain period of time in this folder, | |
;; and pass the 2 filenames to `friends/unfriended`. | |
;; Note: Unfortunately there's no way to "look into the past", | |
;; you can only compare 2 files downloaded at different times. | |
(defn friends [filename] | |
(set (map #(get % "name") | |
(-> filename | |
slurp | |
json/parse-string | |
nfirst)))) | |
(defn unfriended [f1 f2] | |
(set/difference (friends f1) | |
(friends f2))) | |
(comment | |
(unfriended "friends.json" | |
"friends2.json") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment