https://github.com/mfornos/clojure-soup
Clojurized access for Jsoup.
https://github.com/mfornos/clojure-soup
html-parser jsoup
Last synced: about 1 month ago
JSON representation
Clojurized access for Jsoup.
- Host: GitHub
- URL: https://github.com/mfornos/clojure-soup
- Owner: mfornos
- Created: 2012-06-10T04:21:21.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2015-09-24T15:47:28.000Z (over 10 years ago)
- Last Synced: 2025-10-22T02:21:49.333Z (5 months ago)
- Topics: html-parser, jsoup
- Language: Clojure
- Size: 3.52 MB
- Stars: 40
- Watchers: 0
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Clojure Soup
Clojurized access for [Jsoup](http://jsoup.org/).
[](https://clojars.org/clj-soup/clojure-soup)
## Examples
Get some links of a web page:
```clojure
(use 'jsoup.soup)
($ (get! "http://google.com" :user-agent "CoCo/1.0") ;; get request with options
td "a[href]" ;; Jsoup selectors
(attr "abs:href")) ;; attribute selector
```
Get all Emoji names concatenated by single bars from 'emoji-cheat-sheet.com':
```clojure
($ (get! "http://www.emoji-cheat-sheet.com/")
"li div:has(span.emoji)" (text)
(map #(clojure.string/replace % ":" ""))
(clojure.string/join "|"))
```
Post with basic authentication:
```clojure
($ (post! "http://127.0.0.1"
:user-agent "CoCo/1.0"
:follow-redirects true
:auth (basic-auth "night" "password")
:cookies {:user "night" :other "value"}
:data {:param "one" :another "2"}) ;; post options & data
td a) ;; Jsoup selectors
```
Parse a local file:
```clojure
($ (slurp! "test-content.html" :encoding "UTF-8" :base-uri "http://base") "a[href]")
```
[](https://travis-ci.org/mfornos/clojure-soup)
EOF