Update names and filter with url stories
This commit is contained in:
parent
b450233ed0
commit
0341224158
@ -1,4 +1,4 @@
|
|||||||
(defproject isahn "1.0.0"
|
(defproject isahn "1.0.1"
|
||||||
:description "ISAHN check news stories for Hacker News"
|
:description "ISAHN check news stories for Hacker News"
|
||||||
:url "http://example.com/FIXME"
|
:url "http://example.com/FIXME"
|
||||||
:micense {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
|
:micense {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
|
||||||
|
@ -65,6 +65,11 @@
|
|||||||
;; Filter with score min_score
|
;; Filter with score min_score
|
||||||
(filter #(> (get-in % ["score"]) min_score) stories_without_histories)))
|
(filter #(> (get-in % ["score"]) min_score) stories_without_histories)))
|
||||||
|
|
||||||
|
(defn filter_with_url
|
||||||
|
"Filter by removing stories that do not have the URL property"
|
||||||
|
[stories]
|
||||||
|
(filter (fn [story] (contains? story :url))) stories)
|
||||||
|
|
||||||
(defn send_stories_telegram
|
(defn send_stories_telegram
|
||||||
"Send stories by Telegram Channel"
|
"Send stories by Telegram Channel"
|
||||||
[stories]
|
[stories]
|
||||||
@ -74,14 +79,22 @@
|
|||||||
:content-type :json
|
:content-type :json
|
||||||
:accept :json})))
|
:accept :json})))
|
||||||
|
|
||||||
(defn check_stories
|
(defn stories_top
|
||||||
|
"Get all Top Stories with all data"
|
||||||
|
[]
|
||||||
|
(->> url_all_stories
|
||||||
|
(get_all_stories)
|
||||||
|
(filter_stories)
|
||||||
|
(filter_with_url)))
|
||||||
|
|
||||||
|
(defn send_new_alert
|
||||||
"Check news stories and send message to Telegram"
|
"Check news stories and send message to Telegram"
|
||||||
[]
|
[]
|
||||||
(let [stories_top (filter_stories (get_all_stories url_all_stories))]
|
(let [stories_top (stories_top)]
|
||||||
(add_history stories_top)
|
(add_history stories_top)
|
||||||
(send_stories_telegram stories_top)))
|
(send_stories_telegram stories_top)))
|
||||||
|
|
||||||
(defn -main
|
(defn -main
|
||||||
"Main execution"
|
"Main execution"
|
||||||
[]
|
[]
|
||||||
(check_stories))
|
(send_new_alert))
|
||||||
|
Loading…
Reference in New Issue
Block a user