[back/feat] render linkCard

This commit is contained in:
SouthFox 2023-08-27 13:29:51 +08:00
parent 7b06316210
commit 270b4d7822

View file

@ -35,6 +35,13 @@
(.attr img "loading" "lazy"))))
(defn render-linkcard
[docs]
(doseq [link-card (.select docs "a.LinkCard > span.LinkCard-contents")]
(.empty link-card)
(.append link-card (.attr (.parent link-card) "data-text"))))
(defn fetch-hu-post
[request]
(let [id (-> request :path-params :id)
@ -44,6 +51,7 @@
docs (.getElementsByClass page "Post-RichTextContainer")]
(clean-html docs)
(clean-images docs)
(render-linkcard docs)
(let [content {:content (.toString docs)
:title (.text title)}]
{:status 200