# Hacker News Scraper: Stories, Comments & Mentions (`glitchbound/hackernews-scraper`) Actor

Search every Hacker News story and comment since 2006: title, author, points, comment count, text and links. Filter by points, comments, date or type (Show HN, Ask HN, front page). Sort by date to monitor brand and competitor mentions. Official API, no key.

- **URL**: https://apify.com/glitchbound/hackernews-scraper.md
- **Developed by:** [Daniel Meshulam](https://apify.com/glitchbound) (community)
- **Categories:** News, AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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: Stories, Comments & Mentions

Search **every Hacker News story and comment since 2006**, with points, comment counts, authors and links.

Built on the official Algolia-powered HN search API that YC publishes. No key, no login, and far better than scraping `news.ycombinator.com`, which is rate-limited and paginated 30 items at a time.

### What you get

| Field | Example |
|---|---|
| `title`, `author` | `Show HN: I built…`, `pg` |
| `points`, `commentCount` | `412`, `189` |
| `url`, `hnUrl` | the linked article, and the HN thread |
| `text` | comment body or self-post text |
| `createdAt` | ISO 8601 |
| `isShowHN`, `isAskHN`, `tags` | |
| `parentStoryId`, `parentStoryTitle` | on comment rows, what thread it's from |

### Research vs monitoring

**Research** (default), relevance-ranked. *"What has HN said about Postgres?"*

**Monitoring**: `sortByDate: true`, newest first. *"Did anyone mention us today?"* Schedule it hourly and you have brand-mention alerts.

```json
{
  "searchQueries": ["your-product", "your-competitor"],
  "sortByDate": true,
  "createdSince": "2026-07-01",
  "minPoints": 10
}
```

### Front page without a query

Leave `searchQueries` empty and set `contentTypes: ["front_page"]` to list everything currently on the front page. Same for `show_hn` or `ask_hn`, a whole category, no query needed.

### Filters

- `contentTypes`: `story` `comment` `poll` `show_hn` `ask_hn` `front_page`
- `minPoints`, `minComments`, applied by the API itself, so they cost you nothing
- `createdSince` / `createdUntil`

### Who this is for

- **Founders & marketers**: every mention of your product or a competitor, as it happens
- **Launch research**: what got Show HN posts to the front page, and what didn't
- **Trend research**: how a technology's mentions changed over years
- **Recruiters**: the "Who is hiring?" threads, parsed
- **AI / dataset builders**: one of the highest-signal text corpora on the web

### Every story and comment since 2006

Backed by the **Algolia HN Search API**, which is Hacker News' own official
search backend, so this searches the full archive rather than the front page.

**`contentTypes`** picks what comes back: `story`, `comment`, `poll`, `show_hn`,
`ask_hn`, `front_page`. `ask_hn` and `show_hn` are separate types on purpose,
because "what has Show HN launched in this space" and "what has Ask HN asked
about it" are different questions.

`front_page` is the one that works with no query at all: pass it alone and you
get whatever is on the front page right now, which is a scheduled snapshot
rather than a search.

**Filters, all pushed down to the API** so a narrow filter costs less rather
than the same: `minPoints`, `minComments`, `createdSince` and `createdUntil`,
plus `sortByDate` to switch from relevance to newest-first.

**Per row**: title, URL, author, points, comment count, creation date, the HN
item URL, and the text of a comment or self-post. Comment rows carry
`parentStoryTitle`, so a comment is never stranded without its context.

**What it is good for.** `sortByDate` with a brand name is a mention monitor,
and it catches the thread while it is still on the front page. `minPoints` at a
few hundred with a topic is a "what actually resonated" list rather than
everything ever posted. Passing `itemIds` pulls specific threads whole.

**No key, no login.** The Algolia endpoint is public because it is what the HN
site itself calls.

### Notes

- Point and comment filters are pushed down to the API, so a narrow filter is *cheaper*, not slower.
- Comment rows carry `parentStoryTitle`, so you always know what a comment was replying to.
- HN scores keep moving after posting; a run captures the score at that moment.
- Set a **max charge per run** in the run options for a hard spend ceiling. The Actor honors it and stops cleanly.

### Pricing

Pay per result. One row = one story, comment or item. Failed queries come back as `error` rows and are **not** charged.

# Actor input Schema

## `searchQueries` (type: `array`):

What to search Hacker News for, one per line: a product name, a company, a topic. Searches every story and comment since 2006.

## `contentTypes` (type: `array`):

Restrict to: story, comment, poll, show\_hn, ask\_hn, front\_page. Use on its own (with no query) to list everything currently on the front page.

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

Fetch specific HN items by id, e.g. "38000000".

## `maxResultsPerQuery` (type: `integer`):

Cap per query.

## `sortByDate` (type: `boolean`):

Sort by date instead of relevance. Turn this on for monitoring (brand mentions, competitor launches) and leave it off for research.

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

Only items with at least this many points.

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

Only items with at least this many comments.

## `createdSince` (type: `string`):

Only items posted on or after this date (YYYY-MM-DD).

## `createdUntil` (type: `string`):

Only items posted on or before this date (YYYY-MM-DD).

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

Proxy settings.

## `maxItems` (type: `integer`):

A hard ceiling on rows for the entire run, across every target. The per-target limits above cap each one separately, so fifty targets at twenty each is still a thousand rows; this caps the total. The run stops cleanly when it is reached and nothing beyond that point is fetched or charged. Leave empty for no ceiling.

## Actor input object example

```json
{
  "searchQueries": [
    "apify"
  ],
  "maxResultsPerQuery": 100,
  "sortByDate": false,
  "minPoints": 0,
  "minComments": 0,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Stories and comments with points, author and comment counts.

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

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

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

```

## MCP server setup

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