Remove futures
This commit is contained in:
parent
ee11925e13
commit
3c63d1b5e0
|
@ -6,3 +6,7 @@ config.yaml
|
|||
log/logger1.log*
|
||||
*.jar
|
||||
resources/*.tar
|
||||
resources/themes/clojure/static.tar
|
||||
resources/themes/dark/static.tar
|
||||
resources/themes/light/static.tar
|
||||
resources/themes/sepia/static.tar
|
||||
|
|
1
Makefile
1
Makefile
|
@ -3,7 +3,6 @@
|
|||
build:
|
||||
make build.templates
|
||||
lein uberjar
|
||||
make rm.statics
|
||||
echo "Finish!"
|
||||
|
||||
build.templates:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(defproject rsspaper "1.2.1"
|
||||
(defproject rsspaper "1.2.2"
|
||||
:description "RSSpaper"
|
||||
:url "https://github.com/tanrax/RSSpaper"
|
||||
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
"weekly" (filter (fn [article] (and (not (nil? (:published-date article))) (>= (:published-date article) weekly))) articles)
|
||||
articles)))
|
||||
|
||||
(defn remove-future-editions
|
||||
[articles]
|
||||
(filter (fn [article] (and (not (nil? (:published-date article))) (< (:published-date article) (c/to-long (t/now))))) articles))
|
||||
|
||||
(defn add-datetimes-formatter
|
||||
[articles]
|
||||
(map (fn [article]
|
||||
|
@ -39,7 +43,6 @@
|
|||
;; Add feed
|
||||
(:feed (update-in feed [:feed] dissoc :entries))) :feed-url (:feed-url feed))) (get-in feed [:feed :entries])))) [] feeds))
|
||||
|
||||
|
||||
(defn add-domain-to-relative-path
|
||||
[url-complete url-relative]
|
||||
;; Converts a relative path to a path with its domain.
|
||||
|
@ -49,7 +52,6 @@
|
|||
url-with-domain (if is-relative (str (get url-elements 1) (get url-elements 2) url-relative) url-relative)]
|
||||
url-with-domain))
|
||||
|
||||
|
||||
(defn add-cover-article
|
||||
[articles]
|
||||
;; Add cover to article search first image in description
|
||||
|
@ -63,7 +65,7 @@
|
|||
url-og-image (second (re-find #"<meta[^>].*?property=\"og:image(?::url)?\".*?content=\"(.*?)\".*?>|<meta[^>].*?content=\"(.*?)\".*?property=\"og:image(?::url)?\".*?>" html))
|
||||
url-first-image (second (re-find #"<main.*>[\s\S]+<img[^>]+src=\"([^\">]+)\"|id=['\"] ?main ?['\"]>[\s\S]+<img[^>]+src=\"([^\">]+)\"|class=['\"] ?main ?[\'\"]>[\s\S]+<img[^>]+src=\"([^\">]+)\"" html))
|
||||
images [url-og-image url-first-image]
|
||||
url-valid (first (filter (fn [item] (not (nil? item))) images))
|
||||
url-valid (first (remove nil? images))
|
||||
url-final-image (add-domain-to-relative-path (:feed-url article) url-valid)]
|
||||
(assoc article :cover url-final-image))) articles))
|
||||
|
||||
|
@ -92,6 +94,7 @@
|
|||
zip-feeds-in-articles
|
||||
datetimes-to-unixtime
|
||||
filter-edition
|
||||
remove-future-editions
|
||||
order-published
|
||||
add-cover-article
|
||||
add-datetimes-formatter))
|
||||
|
|
Loading…
Reference in New Issue