File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1616 [migratus " 0.8.13" ]
1717 [environ " 1.0.2" ]
1818 [im.chit/hara.io.scheduler " 2.2.17" ]
19- [im.chit/hara.time.joda " 2.2.17" ]]
19+ [im.chit/hara.time.joda " 2.2.17" ]
20+ [enlive " 1.1.6" ]]
2021
2122 :plugins [[migratus-lein " 0.2.6" ]]
2223
Original file line number Diff line number Diff line change 11(ns clojuretwbot.feed
22 (:require [clj-http.client :as http]
3+ [net.cgrand.enlive-html :as html]
34 [taoensso.timbre :as timbre]
45 [feedparser-clj.core :as feedparser]
56 [clojure.string :as str]
1718 (catch Exception e
1819 (timbre/warn (.getMessage e)))))
1920
21+ (defn- parse-meta
22+ " Parse HTML content's metadata."
23+ [html property]
24+ (-> html
25+ (java.io.StringReader. )
26+ (html/html-resource )
27+ (html/select [[:meta (html/attr= :property property)]])
28+ (first )
29+ (get-in [:attrs :content ])))
30+
2031(defn- parse-description
2132 " Parse feed's og:description info, set :description to nil if not exist."
2233 [info]
2334 (let [html (or (fetch-html (:link info)) " " )
24- description (-> (re-find #"(<meta\s *property=\" og:description\"\s *content=\" )(.*)(\" >)" html)
25- (nth 2 ))]
35+ description (parse-meta html " og:description" )]
2636 (merge info {:description description})))
2737
2838(defn- parse-feed
You can’t perform that action at this time.
0 commit comments