Hacker News Data avatar

Hacker News Data

Pricing

Pay per usage

Go to Apify Store
Hacker News Data

Hacker News Data

Pull stories, comments, and other items from Hacker News in two flexible ways: browse the live front-page-style category lists (Top, New, Best, Ask, Show, Jobs), or scan every item posted within a specific date and time range. Optionally fetch nested comment threads several levels deep.

Pricing

Pay per usage

Rating

5.0

(2)

Developer

One Scales

One Scales

Maintained by Community

Actor stats

3

Bookmarked

4

Total users

4

Monthly active users

19 days ago

Last modified

Share

Pull stories, comments, and other items from Hacker News in two flexible ways: browse the live category lists (Top, New, Best, Ask, Show, Jobs), or scan every item posted on a specific date. Optionally fetch nested comment threads several levels deep.

Introduction

This actor queries the official Hacker News API to give you clean, structured access to stories and discussions — no scraping the website required. It works in two modes:

  • Category mode: fetch the current stories in a given HN list (Top, New, Best, Ask HN, Show HN, or Jobs).
  • Date mode: fetch every item (story, comment, job, or poll) posted on one specific UTC day, useful for historical analysis or building an archive.

Both modes support fetching nested comment replies to a configurable depth, so you can pull a story with its full conversation tree, not just the top-level comments.

Features

  • Two query modes — pull the current front page, or scan a specific calendar day.
  • Category filtering — Top, New, Best, Ask HN, Show HN, or Jobs.
  • Nested comment threads — fetch replies up to 5 levels deep, with configurable breadth per level.
  • Item type filtering — in Date mode, narrow results to just stories, comments, jobs, or polls.
  • Honest completion signal — every Date mode run reports range_complete so you always know whether you got the whole day or need to page further, instead of silently returning a partial slice.
  • Resumable scans — a next_page_token lets you continue a day that had more items than fit in one run.
  • HTML-stripped comment text — comment bodies come back as clean, readable plain text.
  • Budget-aware — automatically caps the number of results returned to stay within any spending limit you've set for the run.

Use Cases

  • Content research — pull the current top stories on a topic-adjacent category (e.g. Ask HN) for trend analysis or newsletter curation.
  • Historical archiving — scan a specific day of HN activity for research or dataset-building.
  • Discussion analysis — fetch a story along with its full comment tree to analyze sentiment, common themes, or community reaction.
  • Monitoring — periodically pull "New" stories to track when specific topics or domains get submitted.
  • Dataset creation — build a training or evaluation dataset of real-world discussion threads with reply structure intact.

Input (UI & JSON)

The actor has two modes, chosen automatically based on whether you fill in Date to scan:

  • Leave it empty → Category mode (pulls current stories from a category list).
  • Fill it in → Date mode (scans every item posted on that one UTC day).
FieldModeDescription
categoryCategoryWhich HN list to pull from: top, new, best, ask, show, or job. Default: top.
dateDateThe single UTC day to scan, in YYYY-MM-DD format (e.g. 2026-07-01).
limitBothMax number of results to return in this run. Default 30, max 200.
item_typeDateRestrict results to story, comment, job, or poll. Leave blank for all types.
comment_limitCategoryNumber of top-level comments to fetch per story. Default 10, max 100, set 0 to skip comments.
reply_depthBothHow many levels of replies to fetch below each comment. Default 0 (no replies), max 5.
replies_per_commentBothMax replies to fetch per comment at each level. Default 5, max 20. Only matters if reply_depth > 0.
page_tokenDateResume token from a previous run's next_page_token, used to continue scanning the same day. Leave empty on the first run for a day.

Example — Category mode (JSON input):

{
"category": "top",
"limit": 20,
"comment_limit": 5,
"reply_depth": 1,
"replies_per_comment": 5
}

Example — Date mode (JSON input):

{
"date": "2026-07-01",
"limit": 100,
"item_type": "story",
"reply_depth": 0
}

Example — continuing a day that wasn't fully scanned:

{
"date": "2026-07-01",
"limit": 100,
"page_token": 48752931
}

Output (UI & JSON)

Results are pushed to the Apify dataset — one row per story (Category mode) or per matched item (Date mode). The Overview tab in the dataset UI shows all fields in a table; nested fields like comments and replies display as expandable JSON.

Common fields (all rows):

FieldDescription
idHacker News item ID.
item_typestory, comment, job, or poll.
authorUsername of the poster.
posted_atUnix timestamp (UTC) when the item was posted.

Category mode row fields:

FieldDescription
categoryThe category this story was fetched from.
titleStory title.
urlExternal link, if any.
pointsScore.
comment_countTotal number of replies (all levels) on HN.
commentsArray of resolved top-level comments (up to comment_limit), each with nested replies if reply_depth > 0.

Date mode row fields:

FieldDescription
title, url, points, comment_countPresent only on story/job/poll rows.
bodyComment or Ask HN text, HTML-stripped.
parent_idParent item ID, for comments.
comment_idsRaw IDs of direct replies.
repliesArray of resolved replies (if reply_depth > 0).

Run metadata (key-value store, key OUTPUT):

Every run also writes a small summary object, separate from the dataset rows:

FieldApplies toDescription
modeBothget_stories or find_by_date.
dateDate modeThe day that was scanned.
countBothNumber of rows returned in this run.
scannedDate modeNumber of raw HN items internally checked.
next_page_tokenDate modePass this as page_token to continue scanning the same day. null if the day was fully covered.
range_completeDate modetrue if this run scanned the entire requested day. false means the day had more items than fit in this run — check next_page_token.

Example output row (Category mode):

{
"id": 48753715,
"category": "top",
"item_type": "story",
"title": "ZCode – Harness for GLM-5.2",
"author": "chvid",
"url": "https://zcode.z.ai/en",
"points": 234,
"posted_at": 1782943416,
"comment_count": 223,
"comments": [
{
"id": 48752128,
"author": "seizethecheese",
"posted_at": 1782935074,
"body": "I'm somewhat surprised that this is not open source...",
"reply_count": 9,
"replies": []
}
]
}

Example run metadata (Date mode, day not fully scanned):

{
"mode": "find_by_date",
"date": "2026-07-01",
"count": 100,
"scanned": 2000,
"next_page_token": 48752931,
"range_complete": false
}

Support

For bugs, feature requests, or questions — reach us at https://docs.google.com/forms/d/e/1FAIpQLSfsKyzZ3nRED7mML47I4LAfNh_mBwkuFMp1FgYYJ4AkDRgaRw/viewform?usp=dialog