Last active
July 13, 2021 21:11
-
-
Save CoderPrans/77b7d3fbb286a73e75fe5181708c678e to your computer and use it in GitHub Desktop.
ba.bash.ka script to download SICP
This file contains hidden or 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
#!/usr/bin/env bb | |
(require '[babashka.curl :as curl]) | |
(def sicp-url "https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/") | |
(def pages (map #(str "book-Z-H-" % ".html" ) (rest (range 39)))) | |
(def data (map #(vector (str sicp-url %) %) pages)) | |
(defn get-url [url] | |
(println "Downloading url:" url) | |
(curl/get url)) | |
(defn write-html [file html] | |
(println "Writing file:" file) | |
(spit file html)) | |
(map | |
(fn [[url file]] | |
(write-html file (:body (get-url url)))) | |
data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment