Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

Download a whole Hacker News discussion as flat JSON with one curl (Algolia items API)

Disclosure: I built the Apify Actor linked at the end and charge per result. The raw endpoint below is free and needs no key. Algolia's HN API has an items endpoint that returns a story plus its entire comment tree in a

Disclosure: I built the Apify Actor linked at the end and charge per result. The raw endpoint below is free and needs no key.

Algolia's HN API has an items endpoint that returns a story plus its entire comment tree in a single request.

The request

curl -s "https://hn.algolia.com/api/v1/items/8863"

Item 8863 is the famous "My YC app: Dropbox" thread. Checked 2026-11-01: the response had title, points 104, and 72 nodes counting the story and every nested comment. Each node has author, text (HTML), created_at, parent_id, story_id and a children array.

Flatten it with jq

curl -s "https://hn.algolia.com/api/v1/items/8863" \
  | jq -r '[.. | objects | select(.type=="comment")] | .[] | [.author, .created_at, (.text // "" | gsub("<[^>]*>";""))] | @tsv'

That gives one comment per line, ready for a spreadsheet or an LLM prompt.

Gotchas

  • text is HTML; strip tags or decode entities before analysis.
  • Deleted comments can have a null text or author.
  • Very large threads are a big single response; fetch once and cache.
  • The item id is the number at the end of news.ycombinator.com/item?id=....

Hosted version

For many threads at once, with the tree flattened to one row per comment, I packaged this as an Apify Actor (thread mode; pay per event, no subscription): https://apify.com/northgrid-data/hacker-news-search-threads-hiring

Feedback welcome in the Actor's issues.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.