# Hacker News Scraper - Stories, Comments, Who is Hiring (`kasumilab/hacker-news-scraper`) Actor

Search Hacker News stories and comments, or export the front page, newest, Ask HN, Show HN and the monthly 'Who is hiring?' thread as clean rows. Uses the official HN Algolia API, no login, no proxy.

- **URL**: https://apify.com/kasumilab/hacker-news-scraper.md
- **Developed by:** [Kasumi Lab](https://apify.com/kasumilab) (community)
- **Categories:** News, 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.

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, Who is Hiring

Search **Hacker News** stories and comments by keyword, or export the front page, the newest stories, Ask HN, Show HN and the monthly **"Ask HN: Who is hiring?"** thread as clean rows.

The Actor reads the official [HN Search API by Algolia](https://hn.algolia.com/api). No API key, no login and no proxy are needed. A run of 100 items takes about a second.

### What you can do with it

- Track mentions of your product, company or competitors on Hacker News.
- Collect the top stories about a topic for a newsletter or research.
- Export the latest "Who is hiring?" thread as a job list with company, role and location columns.
- Pull every comment that mentions a keyword for sentiment analysis.
- Build an alert: schedule the Actor with `sortBy: date` and `postedWithinDays: 1`.

### Input

| Field | What it does |
|---|---|
| `mode` | `search` (stories by keyword), `comments` (comments by keyword), `front-page`, `newest`, `ask-hn`, `show-hn`, or `who-is-hiring` (job posts from the latest monthly thread). |
| `query` | Keywords. Required for useful results in `search` and `comments`; optional filter in the other modes, for example `remote` in `who-is-hiring`. |
| `sortBy` | `relevance` (default) or `date` for newest first. |
| `minPoints` | Keep only stories with at least this many points. |
| `postedWithinDays` | Keep only items created in the last N days. `0` means no limit. |
| `maxItems` | Stop after this many items. Default 200. The API returns at most 1,000 items per query. |

Stories about web scraping from the last year, best first:

```json
{
  "mode": "search",
  "query": "web scraping",
  "postedWithinDays": 365,
  "maxItems": 100
}
```

Remote jobs from the latest "Who is hiring?" thread:

```json
{
  "mode": "who-is-hiring",
  "query": "remote",
  "maxItems": 0
}
```

### Output

One item per story or comment:

```json
{
  "type": "story",
  "id": "50085171",
  "title": "Game of Life – But Multiplayer, Hypermedia and Python",
  "url": "https://stario.dev/apps/life",
  "hnUrl": "https://news.ycombinator.com/item?id=50085171",
  "author": "bobowski",
  "points": 54,
  "numComments": 20,
  "createdAt": "2026-10-14T10:13:39Z",
  "textHtml": null,
  "text": null,
  "storyId": "50085171",
  "storyTitle": null,
  "storyUrl": "https://news.ycombinator.com/item?id=50085171",
  "parentId": null,
  "scrapedAt": "2026-10-16T08:13:30.745Z"
}
```

In `who-is-hiring` mode each item is a top-level post from the thread and gets extra fields parsed from its first line (`Company | Role | Location | ...`):

```json
{
  "type": "comment",
  "id": "50104234",
  "author": "onnimonni",
  "createdAt": "2026-10-15T14:30:58Z",
  "headline": "Treat Health | Full-stack Engineer (Elixir, Phoenix LiveView, React) | Helsinki, Finland | ONSITE | Full-time | Compensation in the link below",
  "company": "Treat Health",
  "role": "Full-stack Engineer (Elixir, Phoenix LiveView, React)",
  "location": "Helsinki, Finland",
  "remote": null,
  "text": "Treat Health | Full-stack Engineer ... \nTreat Health is building healthcare where ...",
  "hnUrl": "https://news.ycombinator.com/item?id=50104234"
}
```

`remote` is `true` when the headline mentions remote work, `false` when it says "no remote" or "onsite only", and `null` otherwise. `company`, `role` and `location` follow the thread's usual `|` convention and are `null` for posts that use a different format.

### Limits and notes

- The HN Search API returns at most 1,000 items per query. Narrow the query or the date range to go deeper.
- `points` and `numComments` are `null` for comments.
- `minPoints` is ignored for comments.
- Text fields are provided as HTML (`textHtml`) and as plain text (`text`).
- The "Who is hiring?" thread is found automatically (the latest story by the `whoishiring` account whose title contains "Who is hiring"). Replies to job posts are not included.

### Pricing

You pay per item saved to the dataset, plus a tiny fee per run start.

# Actor input Schema

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

`search` finds stories by keyword. `comments` finds comments by keyword. `front-page`, `newest`, `ask-hn`, `show-hn` list those sections. `who-is-hiring` exports the job posts from the latest monthly 'Ask HN: Who is hiring?' thread.

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

Keywords to search for. Used by `search` and `comments`, and as an optional filter in the other modes (for example `remote` in `who-is-hiring`). Leave empty to list everything.

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

`relevance` ranks by relevance, then points and comments. `date` returns the newest first.

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

Keep only stories with at least this many points. Ignored for comments.

## `postedWithinDays` (type: `integer`):

Keep only items created in the last N days. 0 means no date limit.

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

The run stops after saving this many stories or comments. 0 means no limit (hard cap 1,000 per query, set by the HN API).

## Actor input object example

```json
{
  "mode": "search",
  "query": "web scraping",
  "sortBy": "relevance",
  "minPoints": 0,
  "postedWithinDays": 365,
  "maxItems": 100
}
```

# Actor output Schema

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

All stories and comments saved by this run, as JSON. Add ?format=csv or ?format=xlsx for other formats.

# 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 = {
    "mode": "search",
    "query": "web scraping",
    "postedWithinDays": 365,
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("kasumilab/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 = {
    "mode": "search",
    "query": "web scraping",
    "postedWithinDays": 365,
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("kasumilab/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 '{
  "mode": "search",
  "query": "web scraping",
  "postedWithinDays": 365,
  "maxItems": 100
}' |
apify call kasumilab/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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