# Hacker News Scraper: Stories, Comments, Search & Users (`powernaner/hacker-news-scraper`) Actor

Scrape Hacker News via the official APIs: top, new, best, Ask HN, Show HN and jobs with rank, keyword search of stories and comments (dates, points, 1,000+ results), full comment threads, polls and user profiles with karma. No login, no proxy.

- **URL**: https://apify.com/powernaner/hacker-news-scraper.md
- **Developed by:** [Renan Teles](https://apify.com/powernaner) (community)
- **Categories:** News, Developer tools, Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.30 / 1,000 story scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Hacker News Scraper: Stories, Comments, Search & Users

Get Hacker News (news.ycombinator.com) data as clean JSON, CSV or Excel: live rankings, keyword search of stories **and comments**, full comment threads, polls with their options and user profiles. It uses the official Hacker News APIs. No login, no API key, no proxy.

### What you get

- **Live rankings with rank**: Top (front page), New, Best, Ask HN, Show HN and Jobs, in Hacker News order.
- **Keyword search** in stories, comments, polls, Show HN, Ask HN or the current front page, with date range, minimum points and minimum comments. Sorted by date it goes **past the usual 1,000-result limit**. Matching is exact: "rust" does not return posts that only say "just".
- **Posts by author**: everything one or more users posted, newest first.
- **Full comment threads**: every story can come with its comments, one row each, with `depth` and `parentId`, in reading order (each reply right after its parent).
- **Polls with options and votes**.
- **User profiles**: karma, account creation date, bio and number of submissions. You can also add the author's karma to every story and comment.
- **Clean data**: dates in ISO 8601 UTC, body as HTML **and** plain text (links expanded to the full URL), and `null` (never a fake `0`) when Hacker News does not say.

### Example output (real, from a cloud run on 2026-11-16)

A Show HN story, from the `show` list:

```json
{
  "recordType": "story",
  "id": "50452230",
  "hnUrl": "https://news.ycombinator.com/item?id=50452230",
  "author": "mkarliner",
  "createdAt": "2026-11-11T11:39:15.000Z",
  "text": "Hi, I&#x27;m Mike,\nI&#x27;ve made ThingStudio, a flow programing environment for microcontrollers. It allows drag and drop programming Node-RED style, but emits MicroPython which it uploads to the micro. The board does not need the editor to run after that. Runs fully local, Apache 2 licensed.\nThere&#x27;s a functional version of the editor&#x2F;IDE at linked to the home page, you&#x27;ll need to install to be able to upload, because WebSerial is not universal.\nPlease give it a whirl. I&#x27;m happy to answer any questions.",
  "textPlain": "Hi, I'm Mike,\nI've made ThingStudio, a flow programing environment for microcontrollers. It allows drag and drop programming Node-RED style, but emits MicroPython which it uploads to the micro. The board does not need the editor to run after that. Runs fully local, Apache 2 licensed.\nThere's a functional version of the editor/IDE at linked to the home page, you'll need to install to be able to upload, because WebSerial is not universal.\nPlease give it a whirl. I'm happy to answer any questions.",
  "childIds": [
    "50454829"
  ],
  "rank": 2,
  "source": "show",
  "isDead": false,
  "isDeleted": false,
  "authorKarma": null,
  "authorCreatedAt": null,
  "scrapedAt": "2026-11-16T16:15:58.702Z",
  "dataSource": "firebase",
  "title": "Show HN: ThingStudio, Node-RED style programming for microcontrollers",
  "url": "https://thingstudio.net/",
  "domain": "thingstudio.net",
  "points": 21,
  "numComments": 2,
  "postKind": "show_hn",
  "pollOptions": null
}
```

A comment from a thread (`includeComments` + `includeAuthorProfiles`):

```json
{
  "recordType": "comment",
  "id": "126818",
  "hnUrl": "https://news.ycombinator.com/item?id=126818",
  "author": "mhb",
  "createdAt": "2008-03-01T20:43:20.000Z",
  "rank": null,
  "source": "thread",
  "isDead": null,
  "isDeleted": null,
  "authorKarma": 42654,
  "authorCreatedAt": "2007-03-12T21:26:48.000Z",
  "scrapedAt": "2026-11-16T16:16:12.986Z",
  "dataSource": "algolia",
  "text": "Users would wonder whether they could/should vote for more than one poll choice because their philosophical mutual exclusivity is not reflected in the voting interface.",
  "textPlain": "Users would wonder whether they could/should vote for more than one poll choice because their philosophical mutual exclusivity is not reflected in the voting interface.",
  "storyId": "126809",
  "storyTitle": "Poll: What would happen if News.YC had explicit support for polls?",
  "parentId": "126809",
  "depth": 0,
  "childIds": [
    "126821"
  ]
}
```

A poll, with its options and votes:

```json
{
  "recordType": "poll",
  "id": "126809",
  "hnUrl": "https://news.ycombinator.com/item?id=126809",
  "author": "pg",
  "createdAt": "2008-03-01T20:34:12.000Z",
  "text": null,
  "textPlain": null,
  "childIds": [
    "126822",
    "126823",
    "126917",
    "126993",
    "126824",
    "126934",
    "127411",
    "126888",
    "127681",
    "126818",
    "126816",
    "126854",
    "127095",
    "126861",
    "127313",
    "127299",
    "126859",
    "126852",
    "126882",
    "126832",
    "127072",
    "127217",
    "126889",
    "126875",
    "127535"
  ],
  "rank": null,
  "source": "item",
  "isDead": false,
  "isDeleted": false,
  "authorKarma": 157316,
  "authorCreatedAt": "2006-10-09T18:21:32.000Z",
  "scrapedAt": "2026-11-16T16:16:12.986Z",
  "dataSource": "firebase",
  "title": "Poll: What would happen if News.YC had explicit support for polls?",
  "url": null,
  "domain": null,
  "points": 47,
  "numComments": 54,
  "postKind": null,
  "pollOptions": [
    {
      "id": "126810",
      "text": "Users would create too many, and new arrivals would think News.YC was a poll site.",
      "points": 73
    },
    {
      "id": "126811",
      "text": "Users would create fewer polls, because the main reason they do it now is to get karma from people voting up the poll choices.",
      "points": 49
    },
    {
      "id": "126812",
      "text": "We'd have the same number of polls, but they wouldn't look as ugly.",
      "points": 179
    }
  ]
}
```

A user profile:

```json
{
  "recordType": "user",
  "username": "pg",
  "hnUrl": "https://news.ycombinator.com/user?id=pg",
  "karma": 157316,
  "createdAt": "2006-10-09T18:21:32.000Z",
  "about": "Bug fixer.",
  "aboutPlain": "Bug fixer.",
  "submittedCount": 15565,
  "source": "user",
  "scrapedAt": "2026-11-16T16:16:12.986Z",
  "dataSource": "firebase"
}
```

### Fields

Every row has `recordType`: `story`, `job`, `poll`, `comment` or `user`. Rows of the same type always have the same columns. A field the source does not provide is `null`.

#### Stories, jobs and polls

| Field | What it is |
|---|---|
| `title`, `url`, `domain` | What was posted and where it links (`url` is null for text posts like Ask HN) |
| `points` | Upvotes |
| `numComments` | Total comments in the discussion (null for jobs) |
| `createdAt` | When it was posted, ISO 8601 UTC |
| `rank` | Position in the list (1 = top) or in the search results |
| `author` | Username |
| `postKind` | `link`, `text`, `ask_hn`, `show_hn`, `launch_hn`, `tell_hn` (from the title) |
| `text`, `textPlain` | Body as HTML and as plain text (Ask HN, jobs, polls) |
| `pollOptions` | Poll options with their votes |
| `childIds` | Ids of the direct replies |
| `isDead`, `isDeleted` | Moderation flags (null when the source does not say) |
| `authorKarma`, `authorCreatedAt` | With "Add author karma" |
| `id`, `hnUrl`, `source`, `scrapedAt`, `dataSource` | Identification and origin |

#### Comments

| Field | What it is |
|---|---|
| `text`, `textPlain` | The comment, as HTML and as plain text |
| `author`, `createdAt` | Who and when |
| `storyId`, `storyTitle` | The story it belongs to |
| `parentId`, `depth` | What it replies to; 0 = direct reply to the story |
| `childIds` | Ids of the direct replies |
| `rank` | Position in search results |
| `authorKarma`, `authorCreatedAt` | With "Add author karma" |
| `id`, `hnUrl`, `source`, `scrapedAt`, `dataSource`, `isDead`, `isDeleted` | Identification and origin |

#### Users

`username`, `karma`, `createdAt` (account creation), `about`, `aboutPlain`, `submittedCount`, `hnUrl`, `source`, `scrapedAt`, `dataSource`.

### Use cases

- **Brand and competitor monitoring**: every story and comment that mentions your product, with exact-word matching and date filters. Schedule it daily.
- **Tech trend research**: what reaches the front page, Show HN launches and Ask HN questions, with points and comment counts.
- **Discussion analysis**: full threads with depth, ready for sentiment analysis, summarization or a RAG pipeline.
- **Newsletters and digests**: top stories above a points threshold, with clean links and domains.
- **Recruiting and community research**: the job list, everything a user posted, author karma and account age.

### Pricing

Pay per result. You only pay for rows delivered to your dataset. Failed sources, empty items and duplicates are never charged, and there is no start fee.

| Result | Price per result | Per 1,000 |
|---|---|---|
| Story, job or poll | $0.0003 | **$0.30** |
| Comment | $0.00015 | **$0.15** |
| User profile | $0.0003 | **$0.30** |

**Examples:**

- The top 30 stories of the front page: 30 × $0.0003 = **$0.009**.
- One story with 500 comments: $0.0003 + 500 × $0.00015 = **$0.0753**.
- A daily brand monitor that finds 20 stories and 100 comments: about **$0.021 per day**.

Author karma ("Add author karma") is included in the story or comment row at no extra charge.

Platform usage is small: a cloud run with 15 results took 2.7 seconds with 512 MB (measured on 2026-11-16).

If you set a **maximum cost per run**, the Actor stops when it is reached. The platform treats that limit as a stop signal, so the last charge can go over it by at most the price of one result.

### Limitations (honest)

- **Website-only lists are not included.** The past front page of a given day, Launch HN list, second-chance pool, best comments and "from domain" pages exist only on the website, and the website refuses automated requests from this Actor. Everything here comes from the two official public APIs.
- **Comments have no points.** Hacker News does not publish comment scores anywhere. For the same reason, "Minimum points" and "Minimum comments" apply to stories, not to comments.
- **Relevance search is limited to 1,000 results** by the search API. Sorted by date (the default) there is no such limit.
- **Search is exact-word.** "rust" does not match "just" or "must" (good for monitoring), and misspellings of your keyword are not matched either.
- **Thread order follows the search API**, not the order you see on the site. Who replied to whom (`parentId`, `depth`) is exact; only the order between siblings can differ.
- **The same story in two sources is two rows** (for example in both Top and Best, or in a list and a search), because the rank differs. Each row is a result.
- **A comment requested alone by id** has no `storyId`, `storyTitle` or `depth`. Use "Include comments" on the story to get them.
- `isDead` and `isDeleted` are `null` for rows that come from the search API, which does not expose them.

### FAQ

**Do I need a Hacker News account, API key or proxy?**
No. Both APIs are public.

**How fresh is the data?**
Live. Every run reads the current state of Hacker News.

**How many results can I get?**
Up to 10,000 per source and up to 5,000 comments per story. Use "Max results per source" to control cost.

**Why does a story appear twice?**
Because it was found in two sources, for example Top and Best. See `source` and `rank`.

**Can I get the comments of a specific story?**
Yes: put its id or URL in "Specific items" and turn on "Include comments".

**Is this affiliated with Hacker News or Y Combinator?**
No. This is an independent tool that reads publicly available data through the public APIs.

# Actor input Schema

## `lists` (type: `array`):

Live Hacker News lists from the official API, in Hacker News order (rank 1 = top of the list).

## `searchQuery` (type: `string`):

Full-text search of Hacker News (brand, product, competitor, technology). Leave empty to search only by author (below).

## `searchTypes` (type: `array`):

What to search. Comments are searched separately, because comments have no points.

## `searchSort` (type: `string`):

Newest first can return more than 1,000 results. Relevance is limited to 1,000 by the search API.

## `dateFrom` (type: `string`):

Search only. Day in UTC (YYYY-MM-DD).

## `dateTo` (type: `string`):

Search only. Day in UTC (YYYY-MM-DD), inclusive.

## `minPoints` (type: `integer`):

Search only. Not applied to comments (Hacker News does not expose comment points).

## `minComments` (type: `integer`):

Search only. Not applied to comments.

## `authors` (type: `array`):

Everything these users posted, newest first (uses 'Search in' and the date filters). Username or profile URL, one per line.

## `itemIds` (type: `array`):

Item ids or news.ycombinator.com/item?id=... URLs (stories, comments, jobs, polls).

## `usernames` (type: `array`):

Username or profile URL: karma, account creation date, bio and number of submissions.

## `maxItemsPerSource` (type: `integer`):

Limit for EACH source (each list, each day, each search, each domain). Keeps cost predictable. The comments of each story have their own limit, below.

## `includeComments` (type: `boolean`):

For every story collected, also return its comments (one row each, with depth and parent), up to the limit below. Each comment is a result.

## `maxCommentsPerStory` (type: `integer`):

Some threads have thousands of comments. Comments are returned in reading order (each reply right after its parent).

## `includeAuthorProfiles` (type: `boolean`):

Adds the author's karma and account creation date to every story and comment. One extra request per distinct author.

## `healthCheck` (type: `boolean`):

For the scheduled daily health check. Ignores every other field, checks a fixed list of stable Hacker News lists, searches, items and users, writes nothing to the dataset (no charge), and FAILS the run if a whole source stops responding. The status message names the broken source.

## `healthCheckSimulateFailure` (type: `boolean`):

Test only: with health check mode, swaps the test users for nonexistent ones so the author and user sources really fail. Used to prove the failure alert works.

## Actor input object example

```json
{
  "lists": [
    "top",
    "show"
  ],
  "searchQuery": "rust",
  "searchTypes": [
    "story"
  ],
  "searchSort": "date",
  "maxItemsPerSource": 5,
  "includeComments": false,
  "maxCommentsPerStory": 100,
  "includeAuthorProfiles": false,
  "healthCheck": false,
  "healthCheckSimulateFailure": false
}
```

# Actor output Schema

## `results` (type: `string`):

All results. Filter by the recordType column: story, job, poll, comment, user.

## `runSummary` (type: `string`):

Counts per source and per type, what failed and why, and inputs that were ignored.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "lists": [
        "top",
        "show"
    ],
    "searchQuery": "rust",
    "maxItemsPerSource": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("powernaner/hacker-news-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "lists": [
        "top",
        "show",
    ],
    "searchQuery": "rust",
    "maxItemsPerSource": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("powernaner/hacker-news-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "lists": [
    "top",
    "show"
  ],
  "searchQuery": "rust",
  "maxItemsPerSource": 5
}' |
apify call powernaner/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,powernaner/hacker-news-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/h0BRo3Mi1sdWccH84/builds/VeNe4sJfVmZV43aLa/openapi.json
