Merge pull request #6 from JosephKiranBabu/master

Strip utm parameters from web links
This commit is contained in:
Dmitri Sotnikov 2018-06-10 09:08:42 -04:00 committed by GitHub
commit c39b71d025
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,13 +119,17 @@
(map parse-tweet) (map parse-tweet)
(post-items last-post-time)))) (post-items last-post-time))))
(defn strip-utm [news-link]
(first
(string/split news-link #"\?utm")))
(defn parse-feed [last-post-time parser [title url]] (defn parse-feed [last-post-time parser [title url]]
(-> (.parseURL parser url) (-> (.parseURL parser url)
(.then #(post-items (.then #(post-items
last-post-time last-post-time
(for [{:keys [title isoDate pubDate content link]} (-> % js->edn :items)] (for [{:keys [title isoDate pubDate content link]} (-> % js->edn :items)]
{:created-at (js/Date. (or isoDate pubDate)) {:created-at (js/Date. (or isoDate pubDate))
:text (str (trim-text title) "\n\n" link)}))))) :text (str (trim-text title) "\n\n" (strip-utm link))})))))
(get-mastodon-timeline (get-mastodon-timeline
(fn [timeline] (fn [timeline]