diff --git a/src/main/backend/handlers.clj b/src/main/backend/handlers.clj index c689c8c..b520f04 100644 --- a/src/main/backend/handlers.clj +++ b/src/main/backend/handlers.clj @@ -10,6 +10,7 @@ [content] (generate-string content)) + (defn clean-html [docs] (-> (.select docs "style[data-emotion-css~=^[a-z0-9]*$]") @@ -17,10 +18,11 @@ (vec (for [a (.select docs "a")] (.attr a "href" - (url-decode - (str/replace - (.attr a "href") - "https://link.zhihu.com/?target=" "")))))) + (-> (.attr a "href") + (str/replace "https://link.zhihu.com/?target=" "") + (str/replace "https://zhuanlan.zhihu.com/p/" "#/item/") + (url-decode)))))) + (defn clean-images [docs] @@ -32,6 +34,7 @@ (for [img (.select docs "figure > div > img")] (.attr img "loading" "lazy")))) + (defn fetch-hu-post [request] (let [id (-> request :path-params :id)