Skip to content

Scraping DEV with Common Lisp

twitter logo github logo ・1 min read  

scraping in lisp (2 Part Series)

1) Scraping DEV with Common Lisp 2) Scraper para DEV desde Emacs

Since scrapers seem to be trending in DEV, a friend challenge me to make a web scraper using Common Lisp (yeah, I'm a Lisper, you people should (with-it :deal)). Knowing that he was under the impression that "Lisp is outdated and makes everything harder and more verbose" I decided to accept the challenge and wrote this. It took me 1 minute. My network is slow and Emacs takes forever to open in Windows 10.

;;; Just eval this in your favorite Lisp IDE.
;;; Get the libs
(ql:quickload '(:dexador :plump :lquery))
;;; Get the page
(defvar *front-page* (dex:get ""))
;;; Parse the page
(defvar *data* (plump:parse *front-page*))
;; Get the posts!
(lquery:$ *data* "div.single-article h3" (text))

Update: My thanks to @RainerJoswig for catching some typos in the code!!!

twitter logo DISCUSS (2)
Classic DEV Post from Jun 20 '19

Do you use time-tracking for work or for your personal time?

Yoandy Rodriguez Martinez profile image
Desarrollo, leo y blogueo acerca de software, soy seguidor de Linux, Python , Go y todo lo que huela a Common-Lisp