4 ms·
Ask HN: How to download comments of my favorite submission on HN
Does anyone have a tool for this?
- swiley 7y agoIs there a reason curl and either awk or the combination of htmltidy and xmlstarlet wouldn’t work?
- tgragnato 7y agoI'd start with a query like this (https://www.graphqlhub.com/playground?query=%7B%0A%20%20hn2%20%7B%0A%20%20%20%20nodeFromHnId(id%3A%20%2219701416%22%2C%20isUserId%3A%20false)%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20...%20on%20HackerNewsV2Story%20%7B%0A%20%20%20%20%20%20%20%20score%0A%20%20%20%20%20%20%20%20timeISO%0A%20%20%20%20%20%20%20%20title%0A%20%20%20%20%20%20%20%20url%0A%20%20%20%20%20%20%20%20kids(first%3A%205)%20%7B%0A%20%20%20%20%20%20%20%20%20%20edges%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20node%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20by%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20hnId%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20timeISO%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20text%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D https://www.graphqlhub.com/playground?query=%7B%0A%20%20hn2%...). But if you want recursion you might need to patch the schema (https://github.com/clayallsopp/graphqlhub https://github.com/clayallsopp/graphqlhub).
- pknerd 7y agoThis is amazing! Thnks
- breakerbox 7y agoSomeone on HN made a github project called Monolith. It’s a command line thing. Go check it out and see if it will accomplish what you want https://github.com/Y2Z/monolith https://github.com/Y2Z/monolith
- amirouche 7y agogood project but not really what OP wants.
- algaeontoast 7y agoI'm actually working on a project for this haha - curious if anyone has suggestions on a data-structure to archive comment threads?
- jraph 7y agoI 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.
- darrenwestall 7y agoFile -> Save Page As Or is that too simplistic?