Created
February 16, 2021 06:34
-
-
Save zelark/6b6434402109a823a6a963d263dc7b21 to your computer and use it in GitHub Desktop.
#grumpy
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
(defn posts-after [post-id] | |
(slurp (str "https://grumpy.website/after/" post-id))) | |
(defn get-post-ids [posts] | |
(->> posts | |
(re-seq #"data\-id=\"(.+?)\"") | |
(map second))) | |
(defn post-ids [start-id] | |
(loop [post-ids [start-id] | |
posts (posts-after start-id)] | |
(if-let [ids (seq (get-post-ids posts))] | |
(do (future (prn ids)) | |
(recur (into post-ids ids) | |
(posts-after (last ids)))) | |
post-ids))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment