# Hacker News Scraper - Posts, Comments & Users (`goat255/hackernews-scraper`) Actor

Search posts and comments by keyword, or pull the live front page with each post's rank. Every row has points, comment count, author, domain and date. Add full comment threads with reply depth, plus user profiles and karma.

- **URL**: https://apify.com/goat255/hackernews-scraper.md
- **Developed by:** [Goutam Soni](https://apify.com/goat255) (community)
- **Categories:** Automation, Lead generation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 item 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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

Search posts and comments by keyword, or pull the live front page with each post's rank. One clean row per post, comment or user. No login and no API key.

### What it does

- **Keyword search** across posts and comments, with filters for minimum points, minimum comments and a date range.
- **Live rankings** - front page, best, newest, Ask, Show and jobs. Every row carries its position, so a scheduled run builds a ranking history.
- **Full comment threads** - each comment is its own row with its reply depth, parent and the post it belongs to.
- **User profiles** - karma, account age, bio and submission count.
- **Domain extracted** for every linked post, so you can group by the site being discussed.
- **No result cap on large runs** - sort by date and the run walks backwards through time for as long as you want.

Common uses: tracking what gets discussed about a product or topic, developer market research, monitoring your own launches, building a training or analysis dataset, and finding the sites that get traction.

### Input

All four modes are optional and can be combined in one run.

| Field | Type | Description |
|---|---|---|
| `searchTerms` | array | Keywords to search. One search per entry. |
| `postType` | string | `any`, `story`, `comment`, `ask`, `show`, `poll`, `front_page`. |
| `sort` | string | `relevance` or `date`. See the note below. |
| `maxResultsPerTerm` | integer | Cap per term. Default 100, up to 5000. |
| `minPoints` | integer | Only posts with at least this many points. |
| `minComments` | integer | Only posts with at least this many comments. |
| `dateFrom` / `dateTo` | string | Date range, `YYYY-MM-DD`. |
| `lists` | array | Live rankings: `top`, `best`, `new`, `ask`, `show`, `job`. |
| `maxItemsPerList` | integer | Cap per list. Default 100, up to 500. |
| `usernames` | array | User profiles to fetch. |
| `itemIds` | array | Specific posts, by link or numeric id. |
| `includeComments` | boolean | Also pull comment threads for every post collected. |
| `maxCommentsPerPost` | integer | Cap on comments per post. Default 100. |
| `proxyConfiguration` | object | Optional. Enable to spread requests across IPs. |

**A note on sorting.** Relevance ranks by popularity but stops at 1000 results per term. Sorting by date walks backwards through time and has no limit. Ask for more than 1000 and the run switches to date automatically, so a large request always returns the full amount.

#### Example input

```json
{
  "searchTerms": ["kubernetes"],
  "sort": "date",
  "maxResultsPerTerm": 2500,
  "minPoints": 10,
  "dateFrom": "2026-01-01",
  "lists": ["top"],
  "includeComments": true,
  "maxCommentsPerPost": 50
}
```

### Output

One row per post, comment or user. Every row starts with `id` and `type` so a mixed run stays easy to split.

A post:

```json
{
  "id": 100000001,
  "type": "story",
  "title": "An example post title",
  "text": null,
  "url": "https://example.com/an-article",
  "domain": "example.com",
  "author": "example_user",
  "points": 89,
  "numComments": 10,
  "createdAt": "2026-07-14T19:25:10Z",
  "rank": 1,
  "list": "top",
  "commentsUrl": "https://news.ycombinator.com/item?id=100000001",
  "authorUrl": "https://news.ycombinator.com/user?id=example_user"
}
```

A comment:

```json
{
  "id": 100000002,
  "type": "comment",
  "text": "The comment body as plain text.",
  "author": "example_user",
  "points": null,
  "createdAt": "2026-07-14T20:02:44Z",
  "depth": 2,
  "parentId": 100000001,
  "storyId": 100000001,
  "storyTitle": "An example post title",
  "commentsUrl": "https://news.ycombinator.com/item?id=100000002",
  "authorUrl": "https://news.ycombinator.com/user?id=example_user"
}
```

A user:

```json
{
  "id": "example_user",
  "type": "user",
  "username": "example_user",
  "karma": 12345,
  "about": "The profile bio as plain text.",
  "submissionCount": 420,
  "createdAt": "2010-02-11T18:21:32Z",
  "profileUrl": "https://news.ycombinator.com/user?id=example_user"
}
```

`rank` and `list` are filled only for rows that came from a live list. Ask posts have no link, so `url` and `domain` are `null` on those.

### Notes

- No login and no API key. Set your input and run.
- Comment bodies are converted from markup to plain text, with paragraph breaks kept.
- Everything is deduplicated across every mode in a run, so a post that appears in two lists is delivered once and charged once.
- Schedule a run on `lists` to record how posts rise and fall over the day.

To improve our actors we collect anonymized usage telemetry (run stats and input patterns). No personal account data is collected.

# Actor input Schema

## `searchTerms` (type: `array`):

Keywords to search. One search per entry. Leave empty if you only want live lists, users or specific posts.

## `postType` (type: `string`):

Which kind of post to search for.

## `sort` (type: `string`):

Relevance ranks by popularity but stops at 1000 results per term. Date walks backwards through time with no limit, so use it for large runs.

## `maxResultsPerTerm` (type: `integer`):

Cap per search term. Above 1000 the run automatically switches to walking by date.

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

Only return posts with at least this many points.

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

Only return posts with at least this many comments.

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

Only return posts created on or after this date. Format YYYY-MM-DD.

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

Only return posts created on or before this date. Format YYYY-MM-DD.

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

Pull the current live rankings. Every row carries its position in the list, so scheduling the run builds a ranking history.

## `maxItemsPerList` (type: `integer`):

Cap per live list.

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

User profiles to fetch: karma, account age, bio and submission count.

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

Specific posts to fetch. Paste the full link or just the numeric id.

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

Also pull the comment thread for every post the run collects. Each comment is its own row and carries its reply depth.

## `maxCommentsPerPost` (type: `integer`):

Cap on comments pulled per post.

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

Optional. Enable to spread requests across IP addresses.

## Actor input object example

```json
{
  "searchTerms": [
    "kubernetes",
    "rust"
  ],
  "postType": "story",
  "sort": "relevance",
  "maxResultsPerTerm": 100,
  "dateFrom": "2026-01-01",
  "dateTo": "2026-07-01",
  "maxItemsPerList": 100,
  "usernames": [
    "example_user"
  ],
  "itemIds": [
    "https://news.ycombinator.com/item?id=1"
  ],
  "includeComments": false,
  "maxCommentsPerPost": 100
}
```

# Actor output Schema

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

No description

# 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 = {
    "searchTerms": [
        "kubernetes"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("goat255/hackernews-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 = { "searchTerms": ["kubernetes"] }

# Run the Actor and wait for it to finish
run = client.actor("goat255/hackernews-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 '{
  "searchTerms": [
    "kubernetes"
  ]
}' |
apify call goat255/hackernews-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,goat255/hackernews-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/bsfltVEnkiq0ef9Yr/builds/NOW2M8E6FEhZhsZWg/openapi.json
