Strip utm parameters from web links

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
Joseph Nuthalapati 2018-06-10 17:26:41 +05:30
parent fec68ef646
commit 48d37eb4d2
No known key found for this signature in database
GPG key ID: 5398F00A2FA43C35

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]