Last active
February 22, 2025 23:52
-
-
Save nikolavojicic/cac74e0ff34c8bd85bb3d018e238ebb8 to your computer and use it in GitHub Desktop.
Fetch Sims design documents from https://donhopkins.com/home/TheSimsDesignDocuments/
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
(require 'url) | |
(require 'dom) | |
(defun download-sims-design-documents () | |
(let ((url "https://donhopkins.com/home/TheSimsDesignDocuments/") | |
(dir "c:/Users/nikol/Documents/books/programming/TheSimsDesignDocuments/")) | |
(with-current-buffer (url-retrieve-synchronously url) | |
(goto-char (point-min)) | |
(thread-last | |
(dom-by-tag (libxml-parse-html-region (point) (point-max)) 'a) | |
(mapcar (lambda (link) (dom-attr link 'href))) | |
(seq-filter (lambda (href) (and href (string-match "\\.pdf" href)))) | |
(mapcar (lambda (href) (cons (concat url href) (concat dir (car (last (string-split href "/"))))))) | |
(mapc (lambda (pair) (url-copy-file (car pair) (cdr pair) t))))))) | |
(download-sims-design-documents) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment