# Hacker News Scraper — Submissions, Jobs, Users & Comments (`santamaria-automations/ycombinator-scraper`) Actor

Scrape Hacker News top/new/best/ask/show/job/user submissions. Returns title, author, score, comments, URL, and full text. No login required. Pay-per-result.

- **URL**: https://apify.com/santamaria-automations/ycombinator-scraper.md
- **Developed by:** [Alessandro Santamaria](https://apify.com/santamaria-automations) (community)
- **Categories:** News, Jobs, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 items

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Hacker News Scraper

Extract stories, jobs, comments, and user activity from [Hacker News](https://news.ycombinator.com/) using the official [HN Firebase API](https://github.com/HackerNews/API). No login required. Pay-per-result.

### Use with AI Agents (MCP)

````

https://mcp.apify.com?tools=santamaria-automations/ycombinator-scraper

````

**Example prompts:**

> "Get the top 50 Hacker News stories right now."

> "Get all job postings from user whoishiring with comments."

> "Get the comments from HN thread 47601859."

### What You Can Scrape

#### 1. Story Feeds

Scrape any HN feed — the same tabs you see on the website.

| `storyType` | HN Page | What It Returns |
|-------------|---------|-----------------|
| `top` | [/news](https://news.ycombinator.com/news) | Front page stories (ranked by score) |
| `new` | [/newest](https://news.ycombinator.com/newest) | Most recent submissions |
| `best` | [/best](https://news.ycombinator.com/best) | Highest-scored stories of all time |
| `ask` | [/ask](https://news.ycombinator.com/ask) | Ask HN discussions |
| `show` | [/show](https://news.ycombinator.com/show) | Show HN project launches |
| `job` | [/jobs](https://news.ycombinator.com/jobs) | YC startup job listings |

```json
{ "storyType": "top", "maxResults": 30 }
````

#### 2. Thread Comments

Extract top-level comments from any HN thread by its ID. Works for any story, Ask HN discussion, or monthly "Who is Hiring?" megathread.

```json
{ "storyIds": [47601859], "includeComments": true, "maxCommentsPerStory": 100 }
```

Find the thread ID in the URL: `news.ycombinator.com/item?id=47601859`

You can pass multiple thread IDs to scrape several threads at once.

#### 3. User Activity

Scrape all submissions and comments from any HN user. Covers both [/submitted](https://news.ycombinator.com/submitted?id=whoishiring) and [/threads](https://news.ycombinator.com/threads?id=pg) pages.

```json
{ "usernames": ["whoishiring"], "maxResults": 50 }
```

**Tip:** To get "Who is Hiring?" job postings, scrape the `whoishiring` user's submissions — these are the monthly hiring megathreads. Then use their thread IDs with `includeComments` to get the individual job posts.

### Input

| Field | Type | Description | Default |
|-------|------|-------------|---------|
| `storyType` | string | Feed to scrape: `top`, `new`, `best`, `ask`, `show`, `job` | `top` |
| `storyIds` | integer\[] | Specific thread IDs to scrape | — |
| `usernames` | string\[] | HN usernames — scrape all their submissions & comments | — |
| `includeComments` | boolean | Also extract comments for each story | `false` |
| `commentDepth` | integer | Reply depth: 1 = top-level, 2 = + replies, 3 = + replies to replies. Max 5. | `1` |
| `maxResults` | integer | Maximum stories/items to return | `100` |
| `maxCommentsPerStory` | integer | Maximum comments (all depths combined) per story | `100` |
| `proxyConfiguration` | object | Apify proxy settings | Auto |

**Priority:** `usernames` > `storyIds` > `storyType`. If multiple are set, the first takes precedence.

### Output

Flat table with stories and comments in the same dataset. Filter by `type` to separate them.

| Field | Type | Description |
|-------|------|-------------|
| `id` | integer | HN item ID |
| `type` | string | `story` or `comment` |
| `title` | string | Story title, or first line of comment (company/role for job posts) |
| `author` | string | HN username |
| `url` | string | External link (stories only) |
| `text` | string | Full text/HTML content |
| `score` | integer | Points (stories only) |
| `num_comments` | integer | Comment count (stories only) |
| `thread_id` | integer | Parent story ID (comments only) |
| `thread_title` | string | Parent story title (comments only) |
| `hn_url` | string | Direct link to item on HN |
| `posted_at` | string | ISO timestamp |
| `scraped_at` | string | ISO timestamp |

### Examples

#### Today's front page

```json
{ "storyType": "top", "maxResults": 30 }
```

#### YC startup jobs

```json
{ "storyType": "job", "maxResults": 50 }
```

#### "Who is Hiring?" job postings

```json
{ "storyIds": [47601859], "includeComments": true, "maxCommentsPerStory": 500 }
```

Thread ID `47601859` = April 2026. Find the latest at [whoishiring's submissions](https://news.ycombinator.com/submitted?id=whoishiring).

#### Ask HN discussions with answers

```json
{ "storyType": "ask", "maxResults": 10, "includeComments": true, "maxCommentsPerStory": 20 }
```

#### All activity from a user

```json
{ "usernames": ["pg"], "maxResults": 100 }
```

#### Multiple threads at once

```json
{ "storyIds": [47601859, 47219668], "includeComments": true, "maxCommentsPerStory": 100 }
```

### Pricing

| Event | Price | Description |
|-------|-------|-------------|
| Actor start | $0.001 | One-time fee per run |
| Item result | $0.50 / 1,000 | Per story or comment returned |

**Examples:**

- 30 front page stories → **$0.016**
- 500 "Who is Hiring" job posts → **$0.251**
- 10 stories + 200 comments → **$0.106**

No monthly fees. No minimum spend.

### FAQ

**Do I need an API key?**
No. Uses the public [HN Firebase API](https://github.com/HackerNews/API) — no authentication required.

**What's the difference between /jobs and "Who is Hiring"?**
`storyType: "job"` returns YC-backed startup listings from the /jobs page. "Who is Hiring?" threads are open community job posts from any company (400–1,000 per month). Use `usernames: ["whoishiring"]` to find the threads, then `storyIds` + `includeComments` to get the posts.

**How fast is it?**
\~10 items/second. 50 stories + 50 comments each = ~800 items in 80 seconds.

**Can I get nested/threaded comments?**
Yes. Set `commentDepth: 2` for direct replies, `3` for replies to replies, up to 5 levels deep. All comments are in a flat table with `parent_id` linking them — reconstruct the tree if needed.

***

[Report issues](https://console.apify.com/actors/Tj7pilnYw3IZFaGwX/issues) · [Reddit Scraper](https://apify.com/santamaria-automations/reddit-scraper) · [Telegram Scraper](https://apify.com/santamaria-automations/telegram-scraper)

# Actor input Schema

## `storyType` (type: `string`):

Which HN feed to scrape. 'top' = front page (/news), 'new' = newest, 'best' = all-time best, 'ask' = Ask HN, 'show' = Show HN, 'job' = YC jobs (/jobs).

## `storyIds` (type: `array`):

Specific HN story/thread IDs to scrape (e.g. \[47601859]). Overrides storyType. Use with includeComments to extract comments from any thread.

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

HN usernames to scrape all submissions from (e.g. \["whoishiring", "pg"]). Returns all their stories and comments.

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

Also extract comments for each story. Useful for 'Who is Hiring' threads, Ask HN discussions, etc.

## `commentDepth` (type: `integer`):

How deep to fetch comment replies. 1 = top-level only, 2 = include direct replies, 3 = replies to replies. Max 5.

## `maxResults` (type: `integer`):

Maximum number of stories to return from the feed.

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

Maximum top-level comments to extract per story (when includeComments is true).

## `proxyConfiguration` (type: `object`):

Apify proxy settings. Datacenter proxies work well for HN.

## Actor input object example

```json
{
  "storyType": "top",
  "includeComments": false,
  "commentDepth": 1,
  "maxResults": 100,
  "maxCommentsPerStory": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `items` (type: `string`):

Dataset containing scraped HN stories or job postings

# 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 = {
    "storyType": "top",
    "commentDepth": 1,
    "maxResults": 100,
    "maxCommentsPerStory": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("santamaria-automations/ycombinator-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 = {
    "storyType": "top",
    "commentDepth": 1,
    "maxResults": 100,
    "maxCommentsPerStory": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("santamaria-automations/ycombinator-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "storyType": "top",
  "commentDepth": 1,
  "maxResults": 100,
  "maxCommentsPerStory": 100
}' |
apify call santamaria-automations/ycombinator-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=santamaria-automations/ycombinator-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Hacker News Scraper — Submissions, Jobs, Users & Comments",
        "description": "Scrape Hacker News top/new/best/ask/show/job/user submissions. Returns title, author, score, comments, URL, and full text. No login required. Pay-per-result.",
        "version": "1.0",
        "x-build-id": "9yLQxABsi477Ww3qA"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/santamaria-automations~ycombinator-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-santamaria-automations-ycombinator-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/santamaria-automations~ycombinator-scraper/runs": {
            "post": {
                "operationId": "runs-sync-santamaria-automations-ycombinator-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/santamaria-automations~ycombinator-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-santamaria-automations-ycombinator-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "storyType": {
                        "title": "Story Feed",
                        "enum": [
                            "top",
                            "new",
                            "best",
                            "ask",
                            "show",
                            "job"
                        ],
                        "type": "string",
                        "description": "Which HN feed to scrape. 'top' = front page (/news), 'new' = newest, 'best' = all-time best, 'ask' = Ask HN, 'show' = Show HN, 'job' = YC jobs (/jobs).",
                        "default": "top"
                    },
                    "storyIds": {
                        "title": "Story IDs",
                        "type": "array",
                        "description": "Specific HN story/thread IDs to scrape (e.g. [47601859]). Overrides storyType. Use with includeComments to extract comments from any thread.",
                        "items": {
                            "type": "integer"
                        }
                    },
                    "usernames": {
                        "title": "Usernames",
                        "type": "array",
                        "description": "HN usernames to scrape all submissions from (e.g. [\"whoishiring\", \"pg\"]). Returns all their stories and comments.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeComments": {
                        "title": "Include Comments",
                        "type": "boolean",
                        "description": "Also extract comments for each story. Useful for 'Who is Hiring' threads, Ask HN discussions, etc.",
                        "default": false
                    },
                    "commentDepth": {
                        "title": "Comment Depth",
                        "minimum": 1,
                        "maximum": 5,
                        "type": "integer",
                        "description": "How deep to fetch comment replies. 1 = top-level only, 2 = include direct replies, 3 = replies to replies. Max 5.",
                        "default": 1
                    },
                    "maxResults": {
                        "title": "Maximum Stories",
                        "minimum": 0,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum number of stories to return from the feed.",
                        "default": 100
                    },
                    "maxCommentsPerStory": {
                        "title": "Max Comments Per Story",
                        "minimum": 0,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum top-level comments to extract per story (when includeComments is true).",
                        "default": 100
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Apify proxy settings. Datacenter proxies work well for HN.",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
