HickoryでHTMLをS式化
HiccupでHTMLをテンプレートとして扱いたいのだが、元ネタのHTMLが素のHTMLの場合、どうやってS式にするか?
Stackoverflowに聞いてみそ
stackoverflow.com
推しアンサー
Github Wikiに方法がいっぱいあるやん
clojure - Is there a parser for html to hiccup structures? - Stack Overflow
There is a page on the Hiccup Github Wiki:
https://github.com/weavejester/hiccup/wiki/Converting-html-to-hiccup
Hickory
さっそく使ってみる
ほとんどGitHubのREADME.md見とけば動いた
user=> (use 'hickory.core) nil user=> (require '[clj-http.client :as client]) nil user=> (def site-htree (-> (client/get "http://formula1.com/default.html") :body parse as-hickory)) ここにバーっと括弧がいっぱい出る