Update names and filter with url stories

This commit is contained in:
Andros Fenollosa 2020-09-06 10:23:45 +02:00
parent b450233ed0
commit 0341224158
2 changed files with 17 additions and 4 deletions

View File

@ -1,4 +1,4 @@
(defproject isahn "1.0.0"
(defproject isahn "1.0.1"
:description "ISAHN check news stories for Hacker News"
:url "http://example.com/FIXME"
:micense {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"

View File

@ -65,6 +65,11 @@
;; Filter with score min_score
(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
"Send stories by Telegram Channel"
[stories]
@ -74,14 +79,22 @@
:content-type :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"
[]
(let [stories_top (filter_stories (get_all_stories url_all_stories))]
(let [stories_top (stories_top)]
(add_history stories_top)
(send_stories_telegram stories_top)))
(defn -main
"Main execution"
[]
(check_stories))
(send_new_alert))