How to iterate over all the topics in order to export them as Markdown?

I got there, but I would still love to hear about easier paths.

  1. Use Discourse admin to download a backup of the site.
  2. Find the PostgreSQL database dump inside the backup file, then restore that to a local database.
  3. select id from topics, then paste that into a file.
  4. Use sed or any of its cousins to turn the topic IDs into https://my-discourse-site/raw/<topic ID>
  5. for...; do wget $url; done