Discourse Posts to Tiddler

All the discussions recently about json made me want to have a go at importing a specific topic, latest posts and posts by specific powerUsers. I set out to try and get something working for an individual topic.

It may be ugly but I am putting it here for guidance, on how to proceed and improve.
Discourse Thread to Tiddler.json (1.9 KB)

Current state allows for input of the topic id and then parses the json to reproduce a minimal output of the topic discussion as <<parsedText>>.

Limitations:

  • 20 replies max
    • until I figure out how to check last post_stream.posts versus post_stream.stream and fetch additional posts to append.
  • No User Icon yet, needs a search-replace and concatenation
    • {{{ [["/user_avatar/talk.tiddlywiki.org/username/{size}/254_2.png"]search-replace:g:regexp[{size}],[45]] }}} append to https://talk.tiddlywiki.org/
  • Doesn’t create a tiddler for the topic due to struggles with $action-createtiddler
  • Needs better layout and css

1 Like

interesting !
thanks for sharing your progress

i had mused a little on this point
and wandered if some method with etags or similar
could be used to check if any thing changed since last visit
(considering discourse supports mail interface!)

but did not even consider infinite scroll / pagination
of posts ( ftr if script is disabled , the returned page has links to numbered pages )

btw …

it seams this would be ideal
though idk what the admin’s tipple is
or how best to convince them to allow lowly users access
to the shiny json/api

but perhaps ironicly dealing with json format in TW might have its own set of problems currently
:thinking:

Brilliant! Now we are cooking-by-gas!

Right. Interesting point.

In reality I don’t need capture a whole thread/topic.

BUT, typically, I might want a local copy of ONE or TWO posts within a thread/topic.

Q: Is there a way to specify a specific post in a thread? E.g. 14318/4

For me that is not an issue.


There is, on my fetches, a spacing issue on images … Example …

This is a very useful tool!

TT