hacker-news
github.com/include-tools/hacker-news · typescript-sandbox · v0.1.1
Install
toolbox install github.com/include-tools/hacker-news@v0.1.1Tools (6)
items.getread onlyResolve a single Hacker News item of any type (story, comment, job, poll, pollopt) by its numeric id into the canonical normalized item. `deleted`/`dead` items are returned (with their flags set) rather than skipped, because the caller asked for that specific id. `kids_count` is returned but the `kids` array is not — use threads.get to walk a discussion.
items.recentread onlyDiscover the newest items on Hacker News of any type by reading `maxitem` and walking ids downward, hydrating up to `limit` live ones. A `scan_budget` of `2 * limit` bounds the walk so a run of dead/deleted ids cannot scan forever; `items_returned < limit` means the budget was exhausted before `limit` live items were found. `truncated` is always true (older items always exist below).
stories.listread onlyList a ranked Hacker News feed (front page or category) as bounded story summaries, hydrating each selected id into a lean record. Summaries omit `text`/linkage to stay bounded — use items.get for an Ask HN body. The `top` and `job` feeds legitimately mix in job posts (tagged via `type`).
threads.getread onlyReconstruct the discussion under an item as a bounded nested comment tree: fetch the root, then walk its `kids` breadth-first within a depth and node budget. Returns a bounded sample, not the whole tree — `truncated` flags when the walk stopped with kids still unexpanded. Deleted/dead comments are skipped and their subtree pruned.
updates.getread onlyReturn Hacker News's change feed — recently changed item ids and usernames — in one cheap pass-through read for polling loops. Does not hydrate and does not advance any cursor or consume events; arrays are relayed in upstream order and not capped (the agent slices client-side before hydrating).
users.getread onlyResolve a Hacker News user profile by (case-sensitive) username and, optionally, hydrate their most-recent submissions into items. The full `submitted` list (potentially thousands of ids) is never returned — only its length (`submitted_count`) and up to `include_recent` hydrated records.