# Hacker News Scraper: Stories, Comments, Show HN and Jobs (`joesimo/hacker-news`) Actor

Read Hacker News through the official Firebase and Algolia APIs: top/new/best/ask/show/job feeds, keyword search with date and points filters, comment trees, Who is Hiring jobs, and public user karma. No login. Failed or empty inputs are free.

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

## Pricing

$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.

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 and Jobs

Read Hacker News through the official public Firebase API and the public Algolia HN Search API. Get clean rows for top, new, best, Ask HN, Show HN and job feeds, keyword search with date and points filters, comment trees, Who is Hiring job posts, and public user karma. No login and no API key.

Empty input runs a short demo of 20 stories from the top feed so you can try the Actor from the Store without filling in a form.

**$0.0005 per item** ($0.50 per 1,000). Invalid inputs, missing items and empty results are saved as free status rows. You are not charged for errors.

### What you get

Each paid row has `status: ok` and a `kind` of `story`, `comment`, `job`, `poll`, `hiring_job` or `user`, with:

- `id`, `title`, `url`, `hnUrl`, `author`, `points`, `commentCount`
- `text` (plain) and `textHtml` (original) for Ask HN, comments and jobs
- `createdAt`, `createdAtUnix`, `tags` (including `show_hn` / `ask_hn` when relevant)
- `parentId`, `storyId`, `depth` for comments
- For users: `username`, `karma`, `about`, `userCreatedAt` (the same public fields HN shows; no emails)
- `scrapedAt`

### How to run it

| Goal | Input |
| --- | --- |
| Top / new / best / ask / show / job feeds | `"feeds": ["top", "ask"]` |
| Keyword search | `"query": "openai", "searchTags": ["story"], "minPoints": 100` |
| Date window | `"dateFrom": "2024-01-01", "dateTo": "2024-12-31", "sortBy": "date"` |
| Specific items | `"itemIds": ["8863"]` or `"itemUrls": ["https://news.ycombinator.com/item?id=8863"]` |
| Public user profile | `"usernames": ["pg"]` |
| Who is Hiring jobs | `"whoIsHiring": true` |
| Comment trees | `"includeComments": true, "commentDepth": 2` |

Use **Max items** to cap paid rows. 0 means no extra cap (the run still stops at your max cost).

### How it works

- Feeds and items come from `https://hacker-news.firebaseio.com/v0/` (the official HN Firebase API). There is no rate limit on that API.
- Keyword search uses `https://hn.algolia.com/api/v1/search` (and `search_by_date`). Algolia allows 10,000 requests per IP per hour.
- The Actor does not open news.ycombinator.com HTML pages and does not use a browser or a proxy.
- Who is Hiring finds the latest Ask HN hiring thread via Algolia, then reads its top-level comments from Firebase.

### Pricing

| Event | Price | When it is charged |
| --- | --- | --- |
| `item` | $0.0005 | One story, comment, job, poll or user row with `status: ok` |
| (free) | $0 | `failed`, `not_found`, `invalid_input`, `empty` |

Cloud tests on 9 November 2026 at 256 MB: a demo of 20 top stories used about $0.000082 (0.82% of the $0.01 price). A Show HN feed of 15 stories used about $0.000279 (3.7% of the $0.0075 price). A Who is Hiring sample of 10 rows used about $0.000243 (4.9% of the $0.005 price). Apify keeps 20% of pay-per-event revenue as its commission.

### Input example

```json
{
  "feeds": ["top", "show"],
  "query": "sqlite",
  "searchTags": ["story"],
  "minPoints": 50,
  "maxItems": 50
}
```

### Output example

```json
{
  "status": "ok",
  "kind": "story",
  "source": "top",
  "id": 8863,
  "title": "My YC app: Dropbox - Throw away your USB drive",
  "url": "http://www.getdropbox.com/u/2/screencast.html",
  "hnUrl": "https://news.ycombinator.com/item?id=8863",
  "author": "dhouston",
  "points": 111,
  "commentCount": 71
}
```

### Limits and notes

- Personal data is limited to public HN usernames and the about/karma fields HN already shows. No emails.
- Deleted or dead items may appear with `deleted` / `dead` flags when you fetch them by id.
- Very deep comment trees grow fast. Prefer `commentDepth` 1 or 2 and a **Max items** cap.
- Default memory is 256 MB. No proxy is required.

### Support

Questions or feature requests: joesimo@mail.grokbot.com

Docs for every Joe Simo Actor: [github.com/Joe-Simo/apify-actors](https://github.com/Joe-Simo/apify-actors)

# Actor input Schema

## `feeds` (type: `array`):

Firebase feeds to read: top, new, best, ask, show, job. The form is prefilled with top. Clear the list (and leave search, items and users empty) to run the 20-story demo.

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

Full-text keyword search via the public Algolia HN Search API. Combine with Search tags, Min points and Date from/to.

## `searchTags` (type: `array`):

Algolia tags to AND with the query: story, comment, show_hn, ask_hn, poll, front_page. Leave empty for any type.

## `sortBy` (type: `string`):

Sort Algolia results by relevance (default) or by date (newest first).

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

Keep only search hits with at least this many points. 0 means no floor.

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

Keep search hits created on or after this date (UTC). Example: 2024-01-01.

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

Keep search hits created on or before this date (UTC).

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

Specific Hacker News item ids (stories, comments, jobs, polls). Example: 8863.

## `itemUrls` (type: `array`):

news.ycombinator.com/item?id=N links. Mixed with Item IDs.

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

Public HN usernames. Returns username, karma, created and about (the same fields the HN profile page shows). No emails.

## `whoIsHiring` (type: `boolean`):

Find the latest Ask HN: Who is hiring? thread and save each top-level job comment as a row.

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

Also fetch comment trees for stories (and for Who is Hiring, nested replies). Each comment is its own paid row.

## `commentDepth` (type: `integer`):

How deep to walk kids when Include comments is on. 1 = top-level only, 2 = replies to those, up to 5. Ignored when comments are off.

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

Stop after this many paid rows (stories, comments, jobs, users). 0 means no extra cap (the run still stops at your max cost). The form is prefilled at 20 so a first Try stays small. Empty input also uses 20 for the demo.

## `timeoutSecs` (type: `integer`):

Timeout for each HTTP request to the Firebase or Algolia API.

## Actor input object example

```json
{
  "feeds": [
    "top"
  ],
  "searchTags": [],
  "sortBy": "relevance",
  "minPoints": 0,
  "itemIds": [],
  "itemUrls": [],
  "usernames": [],
  "whoIsHiring": false,
  "includeComments": false,
  "commentDepth": 1,
  "maxItems": 20,
  "timeoutSecs": 20
}
```

# Actor output Schema

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

One item per story, comment, job or user, plus free status rows for invalid or missing inputs.

## `runSummary` (type: `string`):

JSON summary: items saved, sources used, requests and stop reason.

# 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 = {
    "feeds": [
        "top"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("joesimo/hacker-news").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 = {
    "feeds": ["top"],
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("joesimo/hacker-news").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 '{
  "feeds": [
    "top"
  ],
  "maxItems": 20
}' |
apify call joesimo/hacker-news --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,joesimo/hacker-news"
        }
    }
}
```

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/eKBbtnwMUVjnulPsp/builds/ftyd7ajmHB4oYt3Kj/openapi.json
