[back/feat] redirect zhuanlan URL
This commit is contained in:
parent
f5b2c32de5
commit
7b06316210
1 changed files with 7 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue