# Hacker News Scraper — Stories & Comments by Keyword (`actor-forge/hacker-news-scraper`) Actor

Search Hacker News stories and comments by keyword: Show HN, Ask HN, polls and job posts too, with points, comment count, author, link and date. Filter by minimum points and time window, newest first or by relevance. No login. $0.10 per 1,000 items.

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

## Pricing

from $0.10 / 1,000 hn 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/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 by Keyword

Search Hacker News stories and comments by keyword: Show HN, Ask HN, polls and job posts too, with points, comment count, author, link and date. Filter by minimum points and time window, newest first or by relevance. No login. $0.10 per 1,000 items.

**Search Hacker News by keyword** and get clean rows of **stories and comments**, with **points, comment count, author, link and date**, from the public Algolia HN Search API that Hacker News itself links to. No login, no API key, no browser.

- **Item types**: stories, comments, **Show HN**, **Ask HN**, polls and job posts, alone or combined.
- **Minimum points** to keep only stories that took off, and a **time window** from one hour to a year.
- **Newest first** for monitoring, or **most relevant** for research ("what did HN say about X?").
- Comments carry the title of the story they were posted on; stories carry their outbound link and a Show HN / Ask HN label.

Use it to track launches and mentions of your product or competitors, collect Show HN launches in a niche, research developer opinion on a library, or build a dataset of top stories. Schedule it with **Only new since last run** and pipe new items to Slack, Sheets, n8n or Zapier.

**$0.10 per 1,000 items.** Searches with no matches return a free status row.

### What data does it return?

Every run outputs clean, schema-validated rows like these:

| createdAt | contentType | channel | title | score | replyCount | authorHandle | url |
| --- | --- | --- | --- | --- | --- | --- | --- |
| 2026-10-21T16:44:53.000Z | story | Show HN | Show HN: Omnara – Open-source alternative to Claude Managed Agents | 111 | 34 | kmansm27 | https://news.ycombinator.com/item?id=50183892 |
| 2026-10-19T13:07:07.000Z | story | Show HN | Show HN: I built a task system to handle the drudgery so I could focus on tasks | 61 | 54 | dmayle | https://news.ycombinator.com/item?id=50151980 |
| 2026-10-16T15:55:40.000Z | story |  | Postgres 19 delayed after AI reviewers find more bugs than humans can fix | 227 | 93 | magoghm | https://news.ycombinator.com/item?id=50119991 |
| 2026-10-12T06:36:53.000Z | story |  | Postgres isn't slow, your storage is | 180 | 187 | saisrirampur | https://news.ycombinator.com/item?id=50052163 |

### How much does it cost?

Transparent pay-per-event pricing — you only pay for what you get, and the
actor **always respects your run budget**: set a maximum total charge and it
stops cleanly at the cap instead of overrunning.

| Event | Price | Charged | Worked example |
| --- | --- | --- | --- |
| `hn-item` | $0.0001 | per Hacker News story or comment row | 1,000 items = $0.10 |
| `apify-actor-start` | $0.00005 | per run per GB of memory (platform start fee) | One run at 256 MB = $0.00005 |

### Input options

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `keywords` | array | yes | — | Words or phrases to search Hacker News for: a product, library, company, domain or topic, e.g. "supabase", "rust async" or "stripe.com". Titles, story text, URLs and comments are searched (Algolia HN Search). |
| `hnTypes` | array | no | `[]` | Which Hacker News items to return: stories, comments, Show HN, Ask HN, polls or job posts (any of them). Empty = stories, plus comments when "Include comments" is on. |
| `includeComments` | boolean | no | `true` | When no item types are picked: also return comments, not only stories. |
| `hnMinPoints` | integer | no | — | Only items with at least this many points (upvotes). Comments have no public points, so setting this returns stories only. |
| `hnSort` | string | no | `"date"` | Newest first, or Hacker News search relevance (best text matches and popular items first). |
| `sinceHours` | integer | no | `720` | Only items created in the last N hours: 24 = one day, 168 = one week, 720 = 30 days, up to 8,760 (one year). |
| `maxPosts` | integer | no | `100` | Stop after this many items in total (shared fairly between queries). Each item is one charged row. |
| `excludeKeywords` | array | no | — | Drop items whose title or text contains any of these words or phrases (whole words, case-insensitive), e.g. "hiring". |
| `newSinceLastRun` | boolean | no | `false` | For scheduled runs: skip items already delivered by an earlier run with the same queries and filters, so you only get (and pay for) new ones. Only hashed item IDs are kept. |

### Limits & honest notes

- Hacker News only, through the public Algolia HN Search API (hn.algolia.com), paced at 2 requests per second. For the same search across Bluesky, Lemmy, Mastodon, GitHub and DEV, use Brand Mentions Monitor.
- Search is Algolia full-text search with its own typo tolerance, so a short query can also match similar words. Use "Exclude keywords" or a longer phrase to narrow it.
- Comment and story text is plain text, cut at 1,000 characters (textTruncated says when). Points are public for stories only.
- Public data only: author handles as shown on Hacker News, no e-mail addresses or profiles. Items deleted on HN disappear from the index.
- Respects your run budget: set a maximum total charge and the run stops cleanly at the cap. No matches, bad input or an API outage give a free status row.

### Related ActorForge actors

- [Brand Mentions Monitor](https://apify.com/actor-forge/dev-community-mentions) — Hacker News plus Bluesky, Lemmy, Mastodon, GitHub and DEV in one run
- [Bluesky Posts Search](https://apify.com/actor-forge/bluesky-posts-search) — the same search on Bluesky

### Changelog

- **2026-10-23** — Initial release: Hacker News-only listing with item types (Show HN, Ask HN, polls, jobs), minimum points and relevance sort, $0.10 per 1,000 items.

***

*Built and maintained by **ActorForge**. Reliability first: every actor in the
portfolio is monitored by an automated nightly self-test, and breakages are
typically fixed the same day.*

# Actor input Schema

## `keywords` (type: `array`):

Words or phrases to search Hacker News for: a product, library, company, domain or topic, e.g. "supabase", "rust async" or "stripe.com". Titles, story text, URLs and comments are searched (Algolia HN Search).

## `hnTypes` (type: `array`):

Which Hacker News items to return: stories, comments, Show HN, Ask HN, polls or job posts (any of them). Empty = stories, plus comments when "Include comments" is on.

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

When no item types are picked: also return comments, not only stories.

## `hnMinPoints` (type: `integer`):

Only items with at least this many points (upvotes). Comments have no public points, so setting this returns stories only.

## `hnSort` (type: `string`):

Newest first, or Hacker News search relevance (best text matches and popular items first).

## `sinceHours` (type: `integer`):

Only items created in the last N hours: 24 = one day, 168 = one week, 720 = 30 days, up to 8,760 (one year).

## `maxPosts` (type: `integer`):

Stop after this many items in total (shared fairly between queries). Each item is one charged row.

## `excludeKeywords` (type: `array`):

Drop items whose title or text contains any of these words or phrases (whole words, case-insensitive), e.g. "hiring".

## `newSinceLastRun` (type: `boolean`):

For scheduled runs: skip items already delivered by an earlier run with the same queries and filters, so you only get (and pay for) new ones. Only hashed item IDs are kept.

## Actor input object example

```json
{
  "keywords": [
    "apify"
  ],
  "hnTypes": [],
  "includeComments": true,
  "hnSort": "date",
  "sinceHours": 720,
  "maxPosts": 20,
  "newSinceLastRun": false
}
```

# Actor output Schema

## `mentions` (type: `string`):

One row per Hacker News story or comment, or a free status row when nothing matched.

## `summary` (type: `string`):

Mentions delivered per source, per-source status notes, API requests and billing.

# 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 = {
    "keywords": [
        "apify"
    ],
    "sinceHours": 720,
    "maxPosts": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("actor-forge/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 = {
    "keywords": ["apify"],
    "sinceHours": 720,
    "maxPosts": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("actor-forge/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 '{
  "keywords": [
    "apify"
  ],
  "sinceHours": 720,
  "maxPosts": 20
}' |
apify call actor-forge/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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