Ask HN: How to download comments of my favorite submission on HN

13 points by leemailll ↗ HN
Does anyone have a tool for this?

8 comments

[ 3.3 ms ] story [ 30.7 ms ] thread
Is there a reason curl and either awk or the combination of htmltidy and xmlstarlet wouldn’t work?
I'm actually working on a project for this haha - curious if anyone has suggestions on a data-structure to archive comment threads?
I would probably use an SQL-like database with a submissions table (id, title, url, sender, date, points), a users table (id, name) and a comments table (id, author, date, parent, submission, color, content).

If you prefer using maps, for each table (map), use id as the key and the rest of the fields as the fields for a structure used as the value for each entry (using a C struct, or a Python tuple, named tuple or dataclass, assuming these languages).

You may want to use the id field from the HN URLs. You could drop the submission field for the comments.

Edit: You also need to decide how to handle edited, deleted and flagged comments, and dupe and flagged submissions.