# Hacker News Scraper - Stories, Comments & Alerts (`yck69/hackernews-scraper`) Actor

Search Hacker News by keyword, front page, Show/Ask HN or user. Points, comments, time windows past the 1,000 cap, new-item alerts. Official HN API.

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

## Pricing

from $2.00 / 1,000 item extracteds

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 & Alerts

Search **Hacker News** stories, comments, Show HN, Ask HN, jobs and users, or read the live **front page**, with points, comment counts, authors and dates. Built on the official Hacker News Search API (hn.algolia.com), so it is fast and never blocked.

- **Keyword monitoring**: schedule it and get **only the new matches** since the last run (`onlyNew`), with points and comment growth tracked.
- **Beyond the 1,000-result cap**: results are fetched in time windows, so you can pull years of mentions of a brand or topic.
- **Filters**: minimum points, minimum comments, "since 24h / 7d / 3m / a date", story type.
- **Top comments** of every returned story, and **all items of a user**.

**$2 per 1,000 items.** You pay only for the results you receive.

### How to use it

1. Click **Try for free** at the top of this page.
2. Fill the input (the defaults work as a first test).
3. Click **Start**, or schedule the Actor for monitoring and alerts.
4. Download the results as JSON, CSV or Excel, or call the Actor from the API.

### Use cases

- Founders and PR teams watching mentions of their product or competitors.
- Developer-relations and growth teams finding threads worth joining.
- Researchers building datasets of discussion around a topic.
- Newsletter curators collecting the best of the week.

### Input examples

**Track mentions of a brand (alert-style)**

```json
{
  "mode": "search",
  "searchQueries": [
    "apify"
  ],
  "since": "7d",
  "sort": "date",
  "onlyNew": true,
  "monitorName": "brand-watch"
}
```

**Front page right now**

```json
{
  "mode": "front_page",
  "maxItems": 30
}
```

**Show HN with at least 50 points**

```json
{
  "mode": "show_hn",
  "minPoints": 50,
  "since": "30d"
}
```

### Input reference

| Field | Name | Type | Description |
|---|---|---|---|
| `mode` | What to collect | string | Pick a source. Search finds every story (or comment) mentioning your keywords since a date. |
| `searchQueries` | Search queries | array | Keywords, product or brand names. Each query is searched separately (exact words, typo-tolerant). |
| `itemTypes` | Item types | array | Which kind of items the search returns. Add "comment" to catch every mention of a brand in discussions. |
| `sort` | Sort | string | Newest first walks back in time without the 1,000-result cap. |
| `since` | Since | string | Only items posted after this date (2026-10-01) or within a period (24h, 7d, 3m, 1y). |
| `minPoints` | Minimum points | integer | Skip stories with fewer points. |
| `minComments` | Minimum comments | integer | Skip stories with fewer comments. |
| `usernames` | Usernames (mode: user) | array | HN usernames whose posts and comments you want. |
| `includeComments` | Also fetch comments of each story | boolean | Adds the top comments of every returned story (each comment is one result). |
| `maxCommentsPerStory` | Max comments per story | integer | Used when comments are included. |
| `onlyNew` | Monitoring: only new items since last run | boolean | Remembers what earlier runs returned (per query set) and outputs only new items, plus items whose points or comments changed. Ideal on a schedule. |
| `monitorName` | Monitor name | string | Optional name to keep several independent monitors. |
| `maxItems` | Max results | integer | Stop after this many results (you pay per result). |

### Output

Each result is one JSON object. Main fields: `id`, `type`, `title`, `url`, `domain`, `author`, `points`, `commentsCount`, `createdAt`, `text`, `storyId`, `parentId`, `hnUrl`, `matchedQuery`.

When you schedule the Actor with a `monitorName`, rows also carry `isNew`, `firstSeenAt` and (where relevant) a `changes` object listing what moved since the previous run.

Example (shortened):

```json
{
  "id": 50441350,
  "type": "show_hn",
  "title": "Show HN: Aircad – Professional drafting and 3D modeling in the browser",
  "url": "https://aircad.com",
  "domain": "aircad.com",
  "author": "peetle",
  "points": 95,
  "commentsCount": 47,
  "createdAt": "2026-11-10T15:01:19Z",
  "text": "Aircad is a professional CAD system running in the browser with deep AI integration. It includes profession…",
  "storyId": 50441350,
  "hnUrl": "https://news.ycombinator.com/item?id=50441350",
  "matchedQuery": "web scraping",
  "scrapedAt": "2026-11-16T13:42:59.742Z"
}
```

### What it does not do

- Only public Hacker News content; deleted or dead items are not returned.
- Comment text is plain text (HTML tags removed).

### Data source and legality

Official Hacker News Search API (hn.algolia.com, by Algolia for Y Combinator). Public data, no login. The Actor does not log in, does not solve captchas and does not bypass anti-bot protection. You are responsible for using the data in line with the source's terms and the laws that apply to you (including data-protection law when the data concerns people).

### FAQ

**Does it need a proxy or API key?**

No. The official API is open and the Actor paces its requests.

**How do alerts work?**

Turn on `onlyNew`, give the run a `monitorName`, and schedule it. Each run returns only items not seen before, then remembers them.

### Pricing

Pay per event: $2 per 1,000 items. A tiny start fee per run applies. Apify platform usage is included for the Actor owner's pay-per-event model.

### Support

Questions or a missing field? Open an issue from the Actor page and tell us the input you used.

# Actor input Schema

## `mode` (type: `string`):

Pick a source. Search finds every story (or comment) mentioning your keywords since a date.

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

Keywords, product or brand names. Each query is searched separately (exact words, typo-tolerant).

## `itemTypes` (type: `array`):

Which kind of items the search returns. Add "comment" to catch every mention of a brand in discussions.

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

Newest first walks back in time without the 1,000-result cap.

## `since` (type: `string`):

Only items posted after this date (2026-10-01) or within a period (24h, 7d, 3m, 1y).

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

Skip stories with fewer points.

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

Skip stories with fewer comments.

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

HN usernames whose posts and comments you want.

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

Adds the top comments of every returned story (each comment is one result).

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

Used when comments are included.

## `onlyNew` (type: `boolean`):

Remembers what earlier runs returned (per query set) and outputs only new items, plus items whose points or comments changed. Ideal on a schedule.

## `monitorName` (type: `string`):

Optional name to keep several independent monitors.

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

Stop after this many results (you pay per result).

## Actor input object example

```json
{
  "mode": "search",
  "searchQueries": [
    "web scraping"
  ],
  "itemTypes": [
    "story"
  ],
  "sort": "date",
  "since": "30d",
  "minPoints": 20,
  "includeComments": false,
  "maxCommentsPerStory": 20,
  "onlyNew": false,
  "maxItems": 50
}
```

# Actor output Schema

## `overview` (type: `string`):

Stories.

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

Mentions (incl. comments).

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

Every field of every row.

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

The SUMMARY record.

# 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": [
        "web scraping"
    ],
    "since": "30d",
    "minPoints": 20,
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("yck69/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": ["web scraping"],
    "since": "30d",
    "minPoints": 20,
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("yck69/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": [
    "web scraping"
  ],
  "since": "30d",
  "minPoints": 20,
  "maxItems": 50
}' |
apify call yck69/hackernews-scraper --silent --output-dataset

```

## MCP server setup

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