Skip to content

Comment on More people should write (2012)parent

Comments

I wonder if there is a way to easily export one's own Hacker News comments. It might be useful for you to back your comments up one day, as there can be value in searching through your past writing and also having a backup (which never hurts).

Write a script to download them using the Hacker News API.[0]

First, get the user endpoint: https://hacker-news.firebaseio.com/v0/user/<username>.json (ex: https://hacker-news.firebaseio.com/v0/user/jl.json?print=pre...)

then iterate the "submitted" array and make a request to each ID at the item endpoint: https://hacker-news.firebaseio.com/v0/item/<ID>.json (ex: https://hacker-news.firebaseio.com/v0/item/8863.json?print=p...)

Then save each JSON response somewhere. You won't be able to get the content of flagged and banned messages. If you do this more than once you'll also need to keep track of the last ID you downloaded, or the updates endpoint to catch edits, I think, although the readme is a bit vague about how exactly that works.

[0]https://github.com/HackerNews/API

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.