# Hacker News Scraper - Stories, Comments & Who's Hiring Jobs (`consequential_programmer/hacker-news-scraper`) Actor

Scrape Hacker News with the official APIs: keyword search with date, points & author filters, front page, new, best, Ask & Show HN, full comment threads, plus monthly Who is hiring? posts parsed into jobs (company, role, remote, salary, tech stack, apply link). No login.

- **URL**: https://apify.com/consequential_programmer/hacker-news-scraper.md
- **Developed by:** [Nirajan Prasai](https://apify.com/consequential_programmer) (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 $0.50 / 1,000 story scrapeds

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's Hiring Jobs

**Get Hacker News data as clean JSON, CSV or Excel.** It runs on the **official HN APIs** (Algolia search and the Firebase API), so there's no login, no browser and no proxy. It's fast, cheap and reliable.

Four modes in one Actor:

1. 🔎 **Keyword search** across all of Hacker News history: stories, comments, Ask HN, Show HN, job ads and polls. Filter by **date range**, **minimum points**, **minimum comments** and **author**, and sort by relevance or **newest first** (no 1,000-result cap).
2. 📰 **Front page and live lists:** top (front page), new, best, Ask HN, Show HN and jobs, each with its rank.
3. 💼 **"Who is hiring?" jobs:** every monthly *Ask HN: Who is hiring?* post parsed into **structured job data**: company, roles, locations, **remote / onsite / hybrid**, **visa sponsorship**, employment type, **salary mentions**, **technologies** (Python, Rust, Go, React, Kubernetes, LLM...), apply emails and links. Filter for **remote only**, by **keywords** or by **location**.
4. 🧵 **Specific items and full comment threads:** any story or comment by ID or URL. Optionally add the full **comment tree** with depth, parent and reply count.

### Use cases

- **Job seekers and recruiters:** a searchable spreadsheet of hundreds of startup jobs each month (YC companies included), filtered to remote Python roles in Europe, for example
- **Sales and lead generation:** companies that are hiring, with a direct apply email, the tech stack they use and their location
- **Market and trend research:** track mentions of your product, competitors or technologies ("Rust", "Postgres", "AI agents") over time, ranked by points
- **Founders and marketers:** monitor Show HN launches, see what reached the front page, and collect feedback from comment threads
- **AI and data teams:** high-quality technical discussions for RAG, sentiment analysis or LLM fine-tuning

### Example inputs

Remote Python jobs from the last 3 months of "Who is hiring?":

```json
{ "mode": "whoIsHiring", "hiringMonths": 3, "remoteOnly": true, "jobKeywords": ["python"], "maxResults": 0 }
```

Every story about Postgres since January with at least 50 points, newest first:

```json
{ "mode": "search", "queries": ["postgres"], "sortBy": "date", "dateFrom": "2026-01-01", "minPoints": 50, "maxResults": 0 }
```

Today's front page, with the top 20 comments of each story:

```json
{ "mode": "lists", "lists": ["top"], "maxResults": 30, "includeComments": true, "maxCommentsPerStory": 20 }
```

### Example output

A parsed **"Who is hiring?" job**:

```json
{
  "type": "job",
  "threadMonth": "November 2026",
  "company": "MixRank (YC S11)",
  "headline": "MixRank (YC S11) | Software Engineers | 100% Remote (Global) | Full-Time",
  "roles": ["Software Engineers"],
  "locations": ["100% Remote (Global)"],
  "remote": true,
  "visaSponsorship": null,
  "employmentTypes": ["full-time"],
  "salaryMentions": [],
  "technologies": ["Python", "Rust", "TypeScript", "JavaScript", "iOS", "Android", "PostgreSQL", "Linux"],
  "applyEmails": [],
  "links": ["https://www.ycombinator.com/companies/mixrank/jobs/Fnwsojk-j"],
  "description": "MixRank (YC S11) | Software Engineers | ... full post text ...",
  "postedBy": "Kiran_MixRank",
  "hnUrl": "https://news.ycombinator.com/item?id=50339013"
}
```

A **story**:

```json
{
  "type": "story",
  "id": 8863,
  "title": "My YC app: Dropbox - Throw away your USB drive",
  "url": "http://www.getdropbox.com/u/2/screencast.html",
  "domain": "getdropbox.com",
  "hnUrl": "https://news.ycombinator.com/item?id=8863",
  "author": "dhouston",
  "points": 104,
  "numComments": 71,
  "createdAt": "2007-04-04T19:16:40+00:00",
  "isShowHN": false
}
```

**Comments** come with `storyId`, `parentId`, `depth`, `author`, `text`, `createdAt` and `replyCount`. The dataset has ready-made **Stories**, **Who is hiring? jobs** and **Comments** views.

### Pricing

Pay-per-event: you pay a small fee for each **story**, each **comment** and each **parsed hiring post** saved, plus a tiny start fee per run. Items that don't exist are listed for free. Stories that match several queries are saved, and charged, only once. Use **Max results** and **Maximum cost per run** to cap spending.

### Tips

- **Relevance** search returns at most 1,000 results per query, as Algolia allows. Choose **Newest first** to get everything, since the Actor walks back through time on its own.
- Salary, role and location fields come from the free-text posts, so they're best-effort. The full `description` is always included.
- "Who wants to be hired?" threads are skipped on purpose to protect job seekers' privacy.

### Is it legal?

The Actor uses Hacker News's **public, official APIs**, which are provided for exactly this kind of use, and reads only public posts. Usernames and any emails posted in hiring threads are personal data under laws like the GDPR. Use them responsibly and respect what each post asks, for example "no recruiters". See [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/).

### FAQ

- **How am I charged?** You pay for each story, comment or hiring post actually saved, plus a small start fee. Missing items are listed for free. The same story matching several queries is charged only once.
- **What if a query or list is empty or invalid?** Unknown lists and bad item IDs are skipped with a warning. Search with no query falls back to "AI agents" so a default run still returns data.
- **How do I cap cost?** Set **Max results** and **Maximum cost per run**. Leave comments off unless you need them — each comment is a billed event.
- **Is this allowed?** The Actor uses Hacker News's official public APIs and reads only public posts. Use usernames and any personal details in posts responsibly.

# Actor input Schema

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

search = keyword search across all of HN history; lists = front page / new / best / Ask / Show / jobs right now; whoIsHiring = the monthly 'Ask HN: Who is hiring?' thread parsed into structured job posts; items = specific stories or comments by ID/URL.

## `maxResults` (type: `integer`):

Maximum stories, comments or job posts per search query, per list or per hiring thread. 0 = no limit. Comment threads (if enabled) are counted separately.

## `queries` (type: `array`):

Keywords to search for (mode: search). Leave empty to list everything matching the filters.

## `itemType` (type: `string`):

What to search for.

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

Relevance (max 1,000 results per query) or newest first (no limit).

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

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

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

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

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

Only stories with at least this many points (search & lists).

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

Only stories with at least this many comments (search).

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

Only items by this HN user (search).

## `lists` (type: `array`):

Which live HN lists to scrape (mode: lists): top (front page), new, best, ask, show, job.

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

Story/comment IDs or news.ycombinator.com/item?id=... URLs (mode: items).

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

For every story, also save its comments (with depth and parent) as separate items.

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

0 = all comments.

## `maxCommentDepth` (type: `integer`):

1 = top-level comments only. 0 = all levels.

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

Mode whoIsHiring: scrape the latest N monthly 'Who is hiring?' threads.

## `hiringThreadIds` (type: `array`):

Optional: exact thread IDs/URLs instead of the latest months.

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

Keep only posts that mention REMOTE in their header line.

## `jobKeywords` (type: `array`):

Keep only posts containing any of these words (case-insensitive), e.g. Python, Rust, founding engineer.

## `jobLocation` (type: `string`):

Keep only posts mentioning this text, e.g. London, Berlin, Sydney.

## Actor input object example

```json
{
  "mode": "search",
  "maxResults": 20,
  "queries": [
    "AI agents"
  ],
  "itemType": "story",
  "sortBy": "relevance",
  "minPoints": 0,
  "minComments": 0,
  "lists": [
    "top"
  ],
  "includeComments": false,
  "maxCommentsPerStory": 100,
  "maxCommentDepth": 0,
  "hiringMonths": 1,
  "remoteOnly": false
}
```

# Actor output Schema

## `stories` (type: `string`):

No description

## `jobs` (type: `string`):

No description

## `allItems` (type: `string`):

No description

# 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",
    "maxResults": 20,
    "queries": [
        "AI agents"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("consequential_programmer/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",
    "maxResults": 20,
    "queries": ["AI agents"],
}

# Run the Actor and wait for it to finish
run = client.actor("consequential_programmer/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",
  "maxResults": 20,
  "queries": [
    "AI agents"
  ]
}' |
apify call consequential_programmer/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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