refactor shaarli so tag isn't hardcoded
This commit is contained in:
parent
424b1683b8
commit
8b9381d5e1
|
@ -40,18 +40,18 @@
|
|||
|
||||
(def token (generate-token (System/getenv "SHAARLI_TOKEN")))
|
||||
|
||||
(defn shaarli-request [limit offset]
|
||||
(-> (curl/get (str "http://links.mossnet.lan/api/v1/links?searchtags=music&limit=" limit "&offset=" offset) {:headers {"Authorization" (str "Bearer " token)}})
|
||||
(defn shaarli-request [tag limit offset]
|
||||
(-> (curl/get (str "http://links.mossnet.lan/api/v1/links?searchtags=" tag "&limit=" limit "&offset=" offset) {:headers {"Authorization" (str "Bearer " token)}})
|
||||
(:body)
|
||||
(json/parse-string true)))
|
||||
|
||||
(defn get-all-shaarli-data
|
||||
(defn get-all-shaarli-music-data
|
||||
[]
|
||||
(shaarli-request "all" 0))
|
||||
(shaarli-request "music" "all" 0))
|
||||
|
||||
(comment
|
||||
(shaarli-request 100 0)
|
||||
(count (get-all-shaarli-data))
|
||||
(shaarli-request "" 20 0)
|
||||
(count (get-all-shaarli-music-data))
|
||||
(url-filterer {:url "bandcamp"} "bandcamp")
|
||||
(filter (fn [x] (.contains (get x :url) "bandcamp")) [{:url "bandcamp"}])
|
||||
(println "somestring")
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
(ns dhyan.main
|
||||
(:require [dhyan.connections.shaarli :as shaarli]
|
||||
[clojure.java.shell :refer [sh]]
|
||||
[dhyan.connections.matrix :as matrix]))
|
||||
|
||||
(defn -main
|
||||
[& _args]
|
||||
(matrix/setup)
|
||||
(let [shaarli-data (shaarli/get-all-shaarli-data)
|
||||
(let [shaarli-data (shaarli/get-all-shaarli-music-data)
|
||||
; filter to bandcamp (and maybe others?)
|
||||
filtered-shaarli-data (shaarli/url-filterer shaarli-data "bandcamp")
|
||||
album-of-the-day (->> filtered-shaarli-data
|
||||
|
|
Loading…
Reference in a new issue