Skip to content

Instantly share code, notes, and snippets.

@christoph-frick
Last active January 6, 2021 09:01
Show Gist options
  • Save christoph-frick/d1fbd32f910993b981fad54692efe2e5 to your computer and use it in GitHub Desktop.
Save christoph-frick/d1fbd32f910993b981fad54692efe2e5 to your computer and use it in GitHub Desktop.
; clj -Sdeps '{:deps {org.jsoup/jsoup {:mvn/version "1.13.1"}}}'
; Clojure 1.10.1
(import 'org.jsoup.Jsoup)
; org.jsoup.Jsoup
(def soup (Jsoup/parse "<html><head><title>Website title</title></head>
<body><p>Sample paragraph number 1 </p>
<p>Sample paragraph number 2</p>
</body></html>"))
; #'user/soup
(.getElementsByTag soup "p")
; [#object[org.jsoup.nodes.Element 0x4b869331 "<p>Sample paragraph number 1 </p>"] #object[org.jsoup.nodes.Element 0x38018b62 "<p>Sample paragraph number 2</p>"]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment