Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

All Rss Feeds are tooted with each call #16

Closed
alexg-k opened this issue Dec 18, 2018 · 16 comments
Closed

All Rss Feeds are tooted with each call #16

alexg-k opened this issue Dec 18, 2018 · 16 comments

Comments

@alexg-k
Copy link

alexg-k commented Dec 18, 2018

Every time I call my config with ./mastodon-vot.cljs hamburg_de.edn all posts are tooted, not just the new ones.

How can I debug the script and find my issue?

Here is my config:

{
;; add RSS config to follow feeds
   :rss {"hamburg.de news" "http://www.hamburg.de/,rss"
     	      "hamburg.de erlebnis" "http://www.hamburg.de/erlebnis-sport,rss/"
     	      "hamburg.de wochenende" "http://www.hamburg.de/wochenendtipps,rss/"}
           :mastodon {:access_token "my_key"
           :api_url "https://my_url/api/v1/"
           ;; optional boolean to mark content as sensitive
           ;; :sensitive? true
           ;; optional boolean defaults to false
           ;; only sources containing media will be posted when set to true
           ;; :media-only? true
           ;; optional visibility flag: direct, private, unlisted, public
           ;; defaults to public        
           :visibility "private"
           ;; optional limit for the post length
           :max-post-length 300
           ;; optional flag specifying wether the name of the account
           ;; will be appended in the post, defaults to false
           :append-screen-name? false
           ;; optional signature for posts
           ;; :signature "#newsbot"
           ;; optionally try to resolve URLs in posts to skip URL shorteners
           ;; defaults to false
           :resolve-urls? true
           ;; optional content filter regexes
           ;; any posts matching the regexes will be filtered out
           ;; :content-filters [".*bannedsite.*"]
           ;; optional keyword filter regexes
           ;; any posts not matching the regexes will be filtered out
           ;; :keyword-filters [".*clojure.*"]
   }
}

EDIT: Within the mastodon account the bot is allowed to read:statuses and write:statuses.

@yogthos
Copy link
Owner

yogthos commented Dec 19, 2018

Hmm nothing really jumps out at me. The way the bot decides whether to post content or not is by checking the timestamp on the latest post for the Mastodon account and filtering posts that have a later timestamp. That's handled by the post-items function. You could try adding a println there to see what's going on.

@alexg-k
Copy link
Author

alexg-k commented Dec 22, 2018

Thanks, but println last-post-time in line 128 results in #inst "1970-01-01T00:00:00.000-00:00" for every found rss entry.

I am more a C programmer and don't know much about js or clojure.. I would appreciate more hints on where to look next, thank you!

@yogthos
Copy link
Owner

yogthos commented Dec 23, 2018

It sounds like the dates aren't getting parsed out from the feed correctly. So, next step would be to check what you're getting in the parse-feed function. The following block is the relevant part:

(for [{:keys [title isoDate pubDate content link]} (-> % js->edn :items)]
                 {:created-at (js/Date. (or isoDate pubDate))
                  :text (str (trim-text title) "\n\n" (strip-utm link))})

What that says is that each RSS feed item is a map containing the keys title, isoDate, and etc. My guess is that the date isn't present in either isoDate or the pubDate keys. You could do the following to print out the data:

(let [items (-> % js->edn :items)]
  (-> items first println)
  (for [{:keys [title isoDate pubDate content link]} items]
                   {:created-at (js/Date. (or isoDate pubDate))
                    :text (str (trim-text title) "\n\n" (strip-utm link))}))

this will print out the first item in the parsed feed, and if you see something that looks like publication date then it's just a matter of adding that key in.

@alexg-k
Copy link
Author

alexg-k commented Dec 23, 2018

This how a typical item in the RSS feed looks like. The key pubDate is present. I don't know about the time format itself... By the way all my other RSS feed from other side are also not getting parsed. I attached another item from another RSS feed below this one:

<item> <title>Lecker frühstücken in Hamburg!</title> <link>https://www.hamburg.de/fruehstueck-brunch/</link> <description>&lt;img src="https://www.hamburg.de/image/9996148/4x3/117/88/2343c09f3a7976ac8eded938b12194c4/zk/fruehstueck-symbolbild.jpg" height="88" width="117"alt="Restaurant in Hamburg / Brooke Lark / unsplash.com" title="Restaurant in Hamburg / Brooke Lark / unsplash.com"/&gt;&amp;nbsp;Ob Pancakes, Rührei oder Müsli: Unsere Top 10 Frühstücksrestau­rants in Hamburg.</description> <content:encoded>&lt;img src="https://www.hamburg.de/image/9996148/4x3/117/88/2343c09f3a7976ac8eded938b12194c4/zk/fruehstueck-symbolbild.jpg" height="88" width="117"alt="Restaurant in Hamburg / Brooke Lark / unsplash.com" title="Restaurant in Hamburg / Brooke Lark / unsplash.com"/&gt;&amp;nbsp;Ob Pancakes, Rührei oder Müsli: Unsere Top 10 Frühstücksrestau­rants in Hamburg.</content:encoded> <pubDate>Thu, 20 Dec 2018 15:48:55 GMT</pubDate> <guid>http://www.hamburg.de/erlebnis-sport/nofl/4239102/03-koenig-fruehstueck-hamburg/</guid> </item>

Second example from other feed:
<item><title>Wir wünschen "Frohe Weihnachten" Viele unserer Kollegen sind natürlich auch während des Fests 24/7 für die Menschen &amp; die Sicherheit in unserer Stadt im Einsatz. Wir berichten hier ab dem 27.12. wieder über spannende, witzige, teils ernste &amp; wichtige Geschichten unseres Berufes. https://t.co/BkEJINJGLg</title><link>https://twitter.com/PolizeiHamburg/status/1076125293239255040</link><description>Wir wünschen "Frohe Weihnachten" Viele unserer Kollegen sind natürlich auch während des Fests 24/7 für die Menschen &amp; die Sicherheit in unserer Stadt im Einsatz. Wir berichten hier ab dem 27.12. wieder über spannende, witzige, teils ernste &amp; wichtige Geschichten unseres Berufes. <br><img src="https://pbs.twimg.com/media/Du8op9wXcAAkUd7.jpg" width="1024" height="512"><br> <br /> <br /><span style="font-size:12px; color: gray;">(RSS generated with <a href="http://fetchrss.com" target="_blank">FetchRss</a>)</span></description><dc:creator>Polizei Hamburg</dc:creator><pubDate>Fri, 21 Dec 2018 14:40:38 +0000</pubDate><media:content url="https://pbs.twimg.com/media/Du8op9wXcAAkUd7.jpg" width="1024" height="512"/><guid>https://twitter.com/PolizeiHamburg/status/1076125293239255040</guid></item>

@yogthos
Copy link
Owner

yogthos commented Dec 27, 2018

The feed seem to be in a proper format, so would need to see why the data isn't being parsed out correctly.

@yogthos
Copy link
Owner

yogthos commented Dec 27, 2018

Could you provide the feed URL itself. The Node module works against URLs and I'd need to see what gets parsed out. Also, have you tried printing each item in the loop as I noted above. That will show what the script sees after the items are read from the feed.

@alexg-k
Copy link
Author

alexg-k commented Dec 29, 2018

Ok this is what I got.

WARNING: Wrong number of args (3) passed to mastodon-bot.core/post-items at line 174 
{:title Was Hamburg einzigartig macht, :link https://www.hamburg.de/typisch-hamburg/, :pubDate Mon, 05 Nov 2018 13:38:42 GMT, :content:encoded <img src="https://www.hamburg.de/image/11795272/4x3/117/88/3d44230ce164e7555f71413545a6232f/vq/hamburger-dom.jpg" height="88" width="117"alt="Riesenrad auf dem Hamburger Dom / hamburg.de" title="Riesenrad auf dem Hamburger Dom / hamburg.de"/>&nbsp;Von Hummel bis zum Hamburger DOM - 10 Dinge, die es (fast) nur in Hamburg gibt. , :content <img src="https://www.hamburg.de/image/11795272/4x3/117/88/3d44230ce164e7555f71413545a6232f/vq/hamburger-dom.jpg" height="88" width="117"alt="Riesenrad auf dem Hamburger Dom / hamburg.de" title="Riesenrad auf dem Hamburger Dom / hamburg.de"/>&nbsp;Von Hummel bis zum Hamburger DOM - 10 Dinge, die es (fast) nur in Hamburg gibt. , :contentSnippet &nbsp;Von Hummel bis zum Hamburger DOM - 10 Dinge, die es (fast) nur in Hamburg gibt., :guid http://www.hamburg.de/wochenendtipps/nofl/4510938/03-typisch-hamburg/, :isoDate 2018-11-05T13:38:42.000Z}
#inst "1970-01-01T00:00:00.000-00:00"
{:title Tiere suchen neues Zuhause, :link https://www.hamburg.de/tierheim/, :pubDate Fri, 28 Dec 2018 14:26:29 GMT, :content:encoded <img src="https://www.hamburg.de/image/3953868/4x3/117/88/e6a647b1675249a864c2e7dee4a090fc/Lz/greta-bild.jpg" height="88" width="117"alt="Greta / Tierheim Süderstraße" title="Greta / Tierheim Süderstraße"/>&nbsp;Retter gesucht: Diese süßen Tiere brauchen neue, liebevolle Besitzer., :content <img src="https://www.hamburg.de/image/3953868/4x3/117/88/e6a647b1675249a864c2e7dee4a090fc/Lz/greta-bild.jpg" height="88" width="117"alt="Greta / Tierheim Süderstraße" title="Greta / Tierheim Süderstraße"/>&nbsp;Retter gesucht: Diese süßen Tiere brauchen neue, liebevolle Besitzer., :contentSnippet &nbsp;Retter gesucht: Diese süßen Tiere brauchen neue, liebevolle Besitzer., :guid http://www.hamburg.de/nofl/2999262/tierheim-prinz/, :isoDate 2018-12-28T14:26:29.000Z}
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"

@yogthos
Copy link
Owner

yogthos commented Dec 30, 2018

Really not sure what's happening there. You can see the feed item is parsed out correctly. Both isoDate and pubDate key are there. These parse correctly:

(js/Date. "2018-11-05T13:38:42.000Z")
#inst "2018-11-05T13:38:42.000-00:00"

(js/Date. "Mon, 05 Nov 2018 13:38:42 GMT")
#inst "2018-11-05T13:38:42.000-00:00"

And that's exactly what happens here :created-at (js/Date. (or isoDate pubDate)) so I don't see how you're ending up with the wrong date there.

Again, if you can give me the URL for the feed I could take a closer look.

@alexg-k
Copy link
Author

alexg-k commented Jan 1, 2019

Yep I see it. I don't think the problem is feed-specific as I have several config files and all show the same symptoms.
The urls from where the data is generated are the same as shown in my config file in the initial post:

:rss {"hamburg.de news" "http://www.hamburg.de/,rss"
      "hamburg.de erlebnis" "http://www.hamburg.de/erlebnis-sport,rss/"
      "hamburg.de wochenende" "http://www.hamburg.de/wochenendtipps,rss/"}

@yogthos
Copy link
Owner

yogthos commented Jan 4, 2019

So, I tried the feeds locally and I can't seem to reproduce the issue. I replaced the post-items functions with the following:

(defn post-items [last-post-time items]
  (doseq [item items]
      (println item)))

here's what I'm seeing in the output:

{:created-at #inst "2019-01-04T12:24:57.000-00:00", :text Tiere suchen neues Zuhause

https://www.hamburg.de/tierheim/}
{:created-at #inst "2019-01-03T14:43:10.000-00:00", :text Darts-Wahnsinn in Hamburg

https://www.hamburg.de/sport/12019718/world-cup-of-darts/}
{:created-at #inst "2018-12-27T09:33:36.000-00:00", :text 11 Geheim­tipps für denJanuar

https://www.hamburg.de/geheimtipps/7651522/geheimtipps-januar/}
{:created-at #inst "2018-12-20T11:17:44.000-00:00", :text Tipps für die Weihnachtsferien

https://www.hamburg.de/kinder/3863036/kinder-ferien/}
{:created-at #inst "2018-12-18T12:01:51.000-00:00", :text Machen Sie Hamburg digital!

https://www.hamburg.de/hamburggoesdigital/}
{:created-at #inst "2018-12-17T16:31:32.000-00:00", :text Hannoversche Brücke

https://www.hamburg.de/stoerungsmeldungen/}
{:created-at #inst "2018-12-11T16:41:01.000-00:00", :text blickfang in den Deich­torhallen

https://www.hamburg.de/messe/4041828/designmesse-blickfang/}
{:created-at #inst "2018-12-07T14:52:49.000-00:00", :text Hamburg und der Brexit

https://www.hamburg.de/brexit/}
...

The :created-at time appears to be set correctly in each item.

@alexg-k
Copy link
Author

alexg-k commented Jan 5, 2019

Well, when I copy your code for the post-items function, it also works for me:

./mastodon-bot.cljs` hamburg_de.edn 
{:created-at #inst "2018-11-05T13:38:42.000-00:00", :text Was Hamburg einzigartig macht

https://www.hamburg.de/typisch-hamburg/}
{:created-at #inst "2018-09-19T08:52:04.000-00:00", :text Kreatives Craft Beer

Problem is, it doesn't work with the code I check out from master.

@yogthos
Copy link
Owner

yogthos commented Jan 5, 2019

I'm using the master branch as well for testing, and that was the only change I made. The dates are only parsed once, so I'm really not sure why you're not seeing the correct dates in the posts. If the items are parsed out of the feed with the right dates, they should be posted with the same dates.

@alexg-k
Copy link
Author

alexg-k commented Jan 5, 2019

This behavior does not seem to be specific to a single RSS url. I tested several urls, all with the same outcome. To be sure it is not my system or a wrong nodejs/npm version I tested the script on my debian stretch stable server and my arch linux desktop, again with the same outcome. I even tried different mastodon accounts on different instances, again same outcome.

I assume the cause for my symptoms lies somewhere in the post-items function. I included two println resulting in the output shown below. The time in the item map seems right, but when I print last-post-time it shows: 01.01.1970.

post-items function:

(defn post-items [last-post-time items]
  (doseq [item items]
      (println item))
  (doseq [{:keys [text media-links]} (->> items
                                          (remove #(blocked-content? (:text %)))
                                          (filter #(> (:created-at %) last-post-time)))]
    (println last-post-time)
    (if media-links
      (post-status-with-images text media-links)
      (when-not (:media-only? mastodon-config)
        (post-status text)))))

Output:

{:created-at #inst "2018-11-05T13:38:42.000-00:00", :text Was Hamburg einzigartig macht

https://www.hamburg.de/typisch-hamburg/}
{:created-at #inst "2018-09-19T08:52:04.000-00:00", :text Kreatives Craft Beer

https://www.hamburg.de/gruender-persoenlich/11631956/craft-beer-von-freude/}
{:created-at #inst "2018-05-23T10:58:49.000-00:00", :text Ausgehtipps für freie Tage

https://www.hamburg.de/wochenendtipps/}
#inst "1970-01-01T00:00:00.000-00:00"
{:created-at #inst "2019-01-04T14:28:34.000-00:00", :text Lecker, schön, ausgefallen

https://www.hamburg.de/food-und-designmarkt/}
{:created-at #inst "2019-01-04T12:26:13.000-00:00", :text Messen von A bis Z

https://www.hamburg.de/messe/}
{:created-at #inst "2019-01-03T14:50:12.000-00:00", :text Hier ist was los!

https://www.hamburg.de/strassenfest/}
{:created-at #inst "2018-12-28T15:34:08.000-00:00", :text Hamburg im Januar

https://www.hamburg.de/monatsuebersicht-highlights/}
{:created-at #inst "2018-12-27T09:33:36.000-00:00", :text 11 Geheim­tipps für denJanuar

https://www.hamburg.de/geheimtipps/7651522/geheimtipps-januar/}
{:created-at #inst "2018-12-20T15:48:55.000-00:00", :text Lecker frühstücken in Hamburg!

https://www.hamburg.de/fruehstueck-brunch/}
{:created-at #inst "2018-12-20T15:38:19.000-00:00", :text Hamburg ist Sportstadt

https://www.hamburg.de/sport/}
{:created-at #inst "2018-12-20T11:17:44.000-00:00", :text Tipps für die Weihnachtsferien

https://www.hamburg.de/kinder/3863036/kinder-ferien/}
{:created-at #inst "2018-12-18T14:22:41.000-00:00", :text Passagen und Einkaufsstraßen

https://www.hamburg.de/passagen-strassen/}
{:created-at #inst "2018-12-18T14:22:29.000-00:00", :text Einkaufen mit Stil

https://www.hamburg.de/shopping-quartiere/}
{:created-at #inst "2018-12-13T15:18:31.000-00:00", :text Die Außenalster von oben

https://www.hamburg.de/alster/}
{:created-at #inst "2018-10-23T11:24:09.000-00:00", :text Von asiatisch bis vegan

https://www.hamburg.de/restaurant-fuehrer/}
{:created-at #inst "2018-10-17T11:47:28.000-00:00", :text Maritime Ausflugsziele

https://www.hamburg.de/ausfluege-hamburg/4356848/ausfluege-hamburg-meer/}
{:created-at #inst "2018-10-09T07:50:13.000-00:00", :text Grüne Oasen zum Selbstpflanzen

https://www.hamburg.de/stadtleben/4127050/urban-gardening/}
{:created-at #inst "2018-10-05T09:09:31.000-00:00", :text Mehr als salzige Heringe

https://www.hamburg.de/lakritz/}
{:created-at #inst "2018-07-16T15:42:49.000-00:00", :text Schatzsuche 2.0

https://www.hamburg.de/stadtleben/4357578/geocaching/}
{:created-at #inst "2018-06-21T11:08:00.000-00:00", :text 

https://www.hamburg.de/flohmarkt/}
{:created-at #inst "2018-03-13T13:03:03.000-00:00", :text Berühren erlaubt

https://www.hamburg.de/kinder/1852782/museen-fuer-kinder/}
{:created-at #inst "2018-03-07T14:27:23.000-00:00", :text Made in Hamburg

https://www.hamburg.de/stadtleben/4526858/made-in-hamburg-bilder/}
{:created-at #inst "2018-03-07T14:27:16.000-00:00", :text Laseraction in Hamburg

https://www.hamburg.de/lasertag-hamburg/}
{:created-at #inst "2018-01-29T15:21:34.000-00:00", :text Kaffee und Kuchen

https://www.hamburg.de/cafes-hamburg/2090862/cafes-in-hamburg/}
{:created-at #inst "2017-11-22T14:21:30.000-00:00", :text Mit Kindern an der frischen Luft

https://www.hamburg.de/kostenlos/1537232/kinder-kostenlos-draussen/}
{:created-at #inst "2017-10-10T14:14:17.000-00:00", :text Indoor-Aktivitäten

https://www.hamburg.de/indoor/}
{:created-at #inst "2017-10-05T10:25:03.000-00:00", :text Durch Fleete, Kanäle und Flüsse streifen

https://www.hamburg.de/kanufahren/}
{:created-at #inst "2017-08-18T13:40:53.000-00:00", :text Ausgefallen speisen

https://www.hamburg.de/geheimtipps/4532522/restaurant-geheimtipps-bildergalerie/}
{:created-at #inst "2017-08-18T13:40:52.000-00:00", :text Auf die Finger geschaut

https://www.hamburg.de/geheimtipps/4532652/hinter-den-kulissen-hamburgs/}
{:created-at #inst "2017-04-25T14:11:56.000-00:00", :text Zwischen Flensburg und Usedom

https://www.hamburg.de/ostsee/}
{:created-at #inst "2017-04-18T13:25:18.000-00:00", :text Kuriositäten aus dem Kasten

https://www.hamburg.de/stadtleben/4042438/hamburgs-skurrile-automaten/}
{:created-at #inst "2016-10-14T08:25:06.000-00:00", :text Spaß trotz Schietwetter

https://www.hamburg.de/ausfluege-hamburg/4369308/ausfluege-hamburg-schlechtes-wetter/}
{:created-at #inst "2015-09-16T11:28:11.000-00:00", :text Strand, Wellen und mehr

https://www.hamburg.de/geheimtipps/4532434/stadt-am-wasser/}
#inst "1970-01-01T00:00:00.000-00:00"
{:created-at #inst "2019-01-04T13:26:22.000-00:00", :text Die kulina­rischen Top-Events 2019

https://www.hamburg.de/kulinarische-events-in-hamburg/}
{:created-at #inst "2019-01-04T12:24:58.000-00:00", :text Tiere suchen neues Zuhause

https://www.hamburg.de/tierheim/}
{:created-at #inst "2019-01-03T11:14:09.000-00:00", :text Die Hits von Wolfgang Petry

https://www.hamburg.de/tickets/e/10810702/wahnsinn-das-musical-mit-den-hits-von-wolfgang-petry/}
{:created-at #inst "2018-12-27T09:33:36.000-00:00", :text 11 Geheim­tipps für denJanuar

https://www.hamburg.de/geheimtipps/7651522/geheimtipps-januar/}
{:created-at #inst "2018-12-18T12:01:51.000-00:00", :text Machen Sie Hamburg digital!

https://www.hamburg.de/hamburggoesdigital/}
{:created-at #inst "2018-12-12T09:25:56.000-00:00", :text Weltreise durch die Messehallen

https://www.hamburg.de/reisen-hamburg/}
{:created-at #inst "2018-12-11T16:45:53.000-00:00", :text Rock the Ballet X

https://www.hamburg.de/shows/11836198/rock-the-ballet/}
{:created-at #inst "2018-12-07T14:52:49.000-00:00", :text Hamburg und der Brexit

https://www.hamburg.de/brexit/}
{:created-at #inst "2018-12-07T08:46:31.000-00:00", :text Mehr Kapazitäten auf vielen Linien

https://www.hamburg.de/bus-bahn/11814090/fahrplanaenderungern-hvv/}
{:created-at #inst "2018-12-05T12:02:31.000-00:00", :text Ministerpräsiden­tenkonferenz (MPK)

https://www.hamburg.de/mpk/}
{:created-at #inst "2018-11-30T11:57:11.000-00:00", :text Local Business

https://www.hamburg.de/unternehmen-hamburg/}
{:created-at #inst "2018-11-05T13:38:42.000-00:00", :text Was Hamburg einzigartig macht

https://www.hamburg.de/typisch-hamburg/}
{:created-at #inst "2018-11-02T17:04:00.000-00:00", :text Fisch vom Feinsten

https://www.hamburg.de/fischrestaurant/}
{:created-at #inst "2018-10-25T11:11:05.000-00:00", :text Im Reich der Giganten

https://www.hamburg.de/tickets/e/10923696/stomp/}
{:created-at #inst "2018-10-18T15:27:35.000-00:00", :text Mehr Platz und neue Zugänge im Süden

https://www.hamburg.de/bus-bahn/11745320/entwicklung-hauptbahnhof-hamburg/}
{:created-at #inst "2018-10-12T09:58:50.000-00:00", :text Furioses Rhythmus­spektakel

https://www.hamburg.de/tickets/e/10923696/stomp/}
{:created-at #inst "2018-09-19T08:52:04.000-00:00", :text Kreatives Craft Beer

https://www.hamburg.de/gruender-persoenlich/11631956/craft-beer-von-freude/}
{:created-at #inst "2018-09-17T15:38:19.000-00:00", :text Otto. Die Ausstellung

https://www.hamburg.de/ausstellung-hamburg/11593308/otto-die-ausstellung/}
{:created-at #inst "2018-09-07T10:30:57.000-00:00", :text Diese Fahrkarten werden teurer

https://www.hamburg.de/hvv/4096344/hvv-preiserhoehung/}
{:created-at #inst "2018-07-25T12:13:11.000-00:00", :text Vollständig und richtig

https://www.hamburg.de/bewerbungstipps/4560108/arbeitszeugnis/}
{:created-at #inst "2018-07-25T12:10:38.000-00:00", :text Gute Manieren im Job

https://www.hamburg.de/bewerbungstipps/4579350/business-knigge/}
{:created-at #inst "2018-07-05T13:06:17.000-00:00", :text Frische Produkte im neuen Jahr

https://www.hamburg.de/wochenmarkt-hamburg/}
{:created-at #inst "2018-07-03T12:48:39.000-00:00", :text Letzter Sommer in Hamburg

https://www.hamburg.de/aladdin/}
{:created-at #inst "2018-06-21T11:08:00.000-00:00", :text Straßenschätze entdecken

https://www.hamburg.de/flohmarkt/}
{:created-at #inst "2018-06-13T07:32:21.000-00:00", :text Helfen Sie mit!

https://www.hamburg.de/hh-hilft/4384088/hamburg-hilft/}
{:created-at #inst "2018-03-27T10:27:05.000-00:00", :text Tages-Wellness ohne Über­nach­tung

https://www.hamburg.de/hotel-day-spa/}
{:created-at #inst "2018-02-19T16:41:55.000-00:00", :text Auf neuen Wegen durch die Hansestadt

https://www.hamburg.de/besondere-stadtfuehrungen/}
{:created-at #inst "2017-11-21T14:39:52.000-00:00", :text Stau oder freie Fahrt?

https://www.hamburg.de/verkehrslage/}
{:created-at #inst "2016-05-17T13:10:25.000-00:00", :text Kultige Touren über den Kiez

http://www.hamburg.de/tickets/e/1074997/olivias-safaris-die-kult-kieztouren-von-olivia-jones.html?page=12}
{:created-at #inst "2015-02-04T09:40:33.000-00:00", :text Hier sind noch Ausbildungsplätze frei

http://jobsuche.hamburg.de/?what=&where=Hamburg&zoomcontracttypes=226}
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"
#inst "1970-01-01T00:00:00.000-00:00"

@yogthos
Copy link
Owner

yogthos commented Jan 5, 2019

Oh, I think I misunderstood you originally. I thought the issue was with the dates in the feed, and those appear to be ok. If the issue is with last-post-time that could indicate that the date isn't being parsed correctly from the Mastodon API.

The way the bot works is to query the Mastodon timeline, and check the time of the latest post. This should be the time used for filtering. The result is passed to js/Date.

Could you check what you end up with from your timeline. It's read here:

(defn get-mastodon-timeline [callback]
  (.then (.get mastodon-client "timelines/home" #js {}) #(-> % .-data js->edn callback)))

and the callback is at the end of the script:

(get-mastodon-timeline
 (fn [timeline]
   ...

So, if you add a print there:

(get-mastodon-timeline
 (fn [timeline]
    (println timeline)

We could see what's being parsed.

@alexg-k
Copy link
Author

alexg-k commented Jan 6, 2019

That's it. It printed: {:error This action is outside the authorized scopes}. I found the solution here: tootsuite/mastodon #1367.

I closed the issue. Though in my opinion this is an issue with mastodon, please post the minimal scopes (it needs read:statuses and write:statuses) your bot needs in mastodon to work properly in your Readme so others don't make my mistake, too.

Thanks for your help and your patience!

@alexg-k alexg-k closed this as completed Jan 6, 2019
@yogthos
Copy link
Owner

yogthos commented Jan 6, 2019

Ah yeah that would do it. I updated the script to check for the error to make this transparent. Glad we got this figured out in the end. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants