# Hacker News Scraper: Stories, Comments, Show HN & HN Jobs (`api-co/hacker-news-scraper`) Actor

Scrape Hacker News stories, comments, Ask HN, Show HN and front-page lists; search by keyword, date, points or author; and extract HN jobs from the monthly Who Is Hiring threads with remote and keyword filters. Official HN and Algolia APIs.

- **URL**: https://apify.com/api-co/hacker-news-scraper.md
- **Developed by:** [Emilio Cisneros](https://apify.com/api-co) (community)
- **Categories:** News, Jobs, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 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/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, Show HN & HN Jobs

Get **Hacker News** data in clean JSON/CSV/Excel. You can:

- **Search all of HN history** by keywords, dates, points, comment count, author and item type (stories, comments, Ask HN, Show HN, polls, job ads).
- **Get the live lists**: Top (front page), New, Best, Ask, Show and Jobs, with rank.
- **Get full comment trees** in one row per story, with depth, author and plain text. Good for sentiment analysis and LLM summaries.
- **Get parsed "Ask HN: Who is hiring?" jobs** every month: company, roles, locations, remote/hybrid/onsite, salary, employment type, visa sponsorship and apply links. Filter by keywords and remote only.

It uses only the **official HN Firebase API and the Algolia HN Search API**: no proxies, no browser, no login. It's fast and cheap.

### How to use

1. Pick a **mode**: keyword search, front page / Ask HN / Show HN lists, or the monthly *Who is hiring* thread.
2. Add a query and optional filters (date range, minimum points or comments, author).
3. Click **Start** and export stories, comments or job posts as JSON or CSV.

### Why this Actor

| | This Actor | Typical HN scrapers |
|---|---|---|
| Results per search | **Unlimited** (date-window paging) | 1,000 (Algolia cap) |
| Comment trees | Nested, one request per story | Separate runs or missing |
| Who is hiring parsing | Company, role, remote, salary, visa, URLs | Raw text, or a separate paid Actor |
| Email harvesting | **No** (we don't extract personal emails) | Some do |
| Price | **$0.50 / 1,000 items** | $0.20 to $5 / 1,000 |

### Input examples

**Stories about LLM agents with 100+ points in 2026**

```json
{ "mode": "search", "query": "llm agents", "itemTypes": ["story"], "minPoints": 100, "dateFrom": "2026-01-01" }
```

**Current front page with comments**

```json
{ "mode": "top", "maxItems": 30, "includeComments": true }
```

**Remote Rust jobs from the last 3 Who is hiring threads**

```json
{ "mode": "whoishiring", "hiringMonths": 3, "keywords": ["rust"], "remoteOnly": true }
```

**All comments mentioning your product**

```json
{ "mode": "search", "query": "yourproduct", "itemTypes": ["comment"], "maxItems": 5000 }
```

### Output

Story or comment:

```json
{ "id": 41234567, "type": "story", "title": "Show HN: ...", "url": "https://...", "domain": "example.com", "author": "pg", "points": 312, "numComments": 128,
  "createdAt": "2026-10-01T15:04:05.000Z", "text": null, "hnUrl": "https://news.ycombinator.com/item?id=41234567", "isShowHN": true, "rank": 3, "comments": [ { "id": 1, "author": "...", "depth": 1, "text": "..." } ] }
```

Who is hiring job:

```json
{ "company": "Acme AI", "roles": ["Senior Backend Engineer"], "locations": ["San Francisco, CA or REMOTE (US)"], "remote": "remote", "employmentType": "full-time",
  "salary": "$180k-$240k", "visaSponsorship": true, "urls": ["https://acme.ai/careers"], "postedAt": "...", "hnUrl": "...", "threadMonth": "October 2026", "text": "full post" }
```

Job parsing is heuristic: HN posts follow the `Company | Role | Location | Remote | Salary` convention loosely. The full `text` is always included.

### Pricing (pay per event)

- **$0.0005 per item** ($0.50 per 1,000) for stories, comments or jobs.
- **$0.001 per story with a comment tree**, only when *Include full comment tree* is on.
- Error records are free. Set a maximum cost per run and the Actor stops cleanly at your limit.

### How much does it cost?

You only pay for results, never for compute time:

| You get | You pay (Starter/Bronze plan price) |
|---|---|
| 100 items | $0.050 |
| 1,000 items | $0.50 |
| 10,000 items | $5.00 |

Apify's **free plan includes $5 of usage every month**, and free-plan users pay **half price** on this Actor, so that covers about **20,000 items** at no cost. Paid plans get volume discounts (Silver -10%, Gold -20%). Set a *maximum cost per run* and the Actor stops cleanly at your limit.

### Use cases

Brand and competitor monitoring, developer sentiment research, trend analysis, LLM/RAG datasets, tech recruiting and job-market research, and newsletter curation.

### FAQ

**Is it legal?** It reads public data through the official, documented HN APIs. Respect the HN guidelines and the privacy of commenters when you republish data.
**How fresh is it?** The live lists come from Firebase in real time. Algolia search usually updates within minutes.

### Run it from code (API, Python, JavaScript)

```bash
curl -X POST "https://api.apify.com/v2/acts/api-co~hacker-news-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" -d '{"mode": "search", "query": "llm agents", "maxItems": 20}'
```

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("api-co/hacker-news-scraper").call(run_input={"mode": "search", "query": "llm agents", "maxItems": 20})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

```javascript
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('api-co/hacker-news-scraper').call({"mode": "search", "query": "llm agents", "maxItems": 20});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

It also works from **AI agents through the Apify MCP server**, and with Zapier, Make, n8n, Google Sheets and webhooks. You can schedule it in the Apify Console.

# Actor input Schema

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

search = keyword/date/points search across all of HN history. top/new/best/ask/show/jobs = the current live lists. whoishiring = parsed jobs from the monthly 'Ask HN: Who is hiring?' thread. freelancer = the monthly 'Freelancer? Seeking Freelancer?' thread.

## `query` (type: `string`):

Keywords to search for (search mode). Leave empty to list everything that matches the other filters.

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

Which kinds of items to return in search mode. Several types are combined with OR.

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

date = newest first, with no 1,000-result cap. relevance = best match first (Algolia caps at 1,000).

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

Only items created on/after this date (YYYY-MM-DD).

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

Only items created on/before this date (YYYY-MM-DD).

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

Only stories with at least this many points.

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

Only stories with at least this many comments.

## `author` (type: `string`):

Only items by this HN username.

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

Attach each story's comments (nested depth, author, text) in a 'comments' array. Charged as one extra 'comment thread' event per story that has comments.

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

Cap on comments attached per story.

## `hiringMonths` (type: `integer`):

How many monthly threads to parse (1 = the latest month).

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

Only job posts that contain any of these words (e.g. rust, python, 'machine learning'). Case-insensitive.

## `remoteOnly` (type: `boolean`):

Only job posts that mention remote work in the header line.

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

Stop after this many results. You are only charged per result returned.

## Actor input object example

```json
{
  "mode": "search",
  "query": "llm agents",
  "itemTypes": [
    "story"
  ],
  "sort": "date",
  "includeComments": false,
  "maxCommentsPerStory": 100,
  "hiringMonths": 1,
  "remoteOnly": false,
  "maxItems": 20
}
```

# Actor output Schema

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

Hacker News stories, comments or parsed Who is hiring jobs (one item each).

# 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 = {
    "query": "llm agents",
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-co/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 = {
    "query": "llm agents",
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("api-co/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 '{
  "query": "llm agents",
  "maxItems": 20
}' |
apify call api-co/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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