# Hacker News Scraper: Stories, Comments & Who Is Hiring (`tagadanar/hacker-news-scraper`) Actor

Search Hacker News stories and comments by keyword, author, date and points, past the 1,000-result limit. Front-page lists, full comment threads as flat rows, monthly Who is hiring posts and user profiles. $0.50 per 1,000 rows.

- **URL**: https://apify.com/tagadanar/hacker-news-scraper.md
- **Developed by:** [Tagada Data](https://apify.com/tagadanar) (community)
- **Categories:** News, Social media, 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.35 / 1,000 rows

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 & Who Is Hiring

Get Hacker News as clean, flat rows. **Search stories and comments** by keyword, author, date range, minimum points and minimum comments, and keep going past the usual 1,000-result limit by walking back through the dates. Pull the **front page and the other live lists** (Top, New, Best, Ask HN, Show HN, Jobs) with their rank, **whole comment threads** from story links (one row per comment, with depth and parent so you can rebuild the tree), the job posts of the latest **"Who is hiring?"** thread, and **user profiles**. Every row has a `type` field (`story`, `comment`, `job`, `poll`, `user`), so one dataset holds a mixed run and still filters cleanly in a spreadsheet.

**$0.50 per 1,000 rows on Free ($0.35 on Gold), plus $0.001 per run. Platform usage is included.** No API key, no login, no proxy needed.

### What you get

One flat row per story, comment, job post or user. Fields that do not apply to a row type are null.

| Field | What it is |
| --- | --- |
| `type` | `story`, `comment`, `job`, `poll` or `user` |
| `id` | Hacker News item ID (the username for a user row) |
| `title` / `url` / `domain` | Story title, the link it points to, and that link's domain |
| `author` | Hacker News username of the poster |
| `points` / `numComments` | Story score and comment count |
| `createdAt` | When it was posted (ISO 8601, UTC); account creation date for a user |
| `text` / `textHtml` | Comment, Ask HN text or user "about": plain text (links spelled out in full) and the original HTML |
| `storyId` / `storyTitle` / `storyUrl` | For a comment: the story it belongs to |
| `parentId` / `depth` | For a comment: what it replies to, and how deep (1 = a direct reply to the story). `depth` is filled for comments read from a thread, not for comments found by search |
| `rank` | Position on the front-page list it came from |
| `headline` | Hiring-thread posts: the first line, usually `Company \| Role \| Location \| Remote` |
| `tags` | `story`, `comment`, `ask_hn`, `show_hn`, `job`, `poll`, `front_page` |
| `karma` / `submittedCount` | User rows: karma and number of submissions |
| `hnUrl` | The item or profile on news.ycombinator.com |
| `source` / `input` | Which part of your input produced the row (`search`, `list`, `item`, `comments`, `hiring`, `user`) and the search term, list, link or username |
| `retrievedAt` | When the row was fetched (ISO 8601) |

Comments from **Add comment threads** and **Story URLs** come in thread order: each reply right after its parent.

### Why this one

- **Past 1,000 results.** The Hacker News search engine stops at 1,000 hits per query. With **Newest first** the actor walks back through the dates and keeps going, up to 10,000 rows per search term.
- **Comments as rows, not a nested blob.** Comment search by keyword (who mentions your product), and full threads with depth and parent ID, ready for a spreadsheet, a sentiment model or an AI agent.
- **Exact words.** A search for `rust` does not also return `trust` or `just` (the search engine's typo matching is switched off by default; one toggle turns it back on). The search engine also matches usernames, so a keyword can return the odd comment whose author's name contains it.
- **Hiring threads in one click.** The latest "Who is hiring?", "Who wants to be hired?" or "Freelancer?" thread as one row per post, with the first line split out.
- **Mixed runs.** Search terms, lists, story links, the hiring thread and user profiles in the same run; a story found twice is delivered once.

### Who uses it

- **Founders, DevRel and marketing teams**: watch every new Hacker News story and comment that mentions their product or a competitor (a scheduled run with *Only the last N days* = 1).
- **Recruiters and job seekers**: the monthly "Who is hiring?" posts as rows, with company, role and location in the headline.
- **Researchers and AI builders**: discussion threads and comment datasets on a topic, with dates and scores, for analysis or training data.
- **Investors and analysts**: Show HN launches and front-page stories above a points threshold, with their links and domains.

### Examples

Prefill: stories about web scraping, best matches first.

```json
{"searchTerms":["web scraping"]}
```

Every comment from the last 7 days that mentions your product (schedule it daily with `lastDays` 1):

```json
{"searchTerms":["apify","crawlee"],"contentType":"comment","sort":"newest","lastDays":7,"maxResults":1000}
```

All Show HN posts about Rust in 2025 with at least 50 points, newest first:

```json
{"searchTerms":["rust"],"contentType":"show_hn","sort":"newest","dateFrom":"2025-01-01","dateTo":"2025-12-31","minPoints":50,"maxResults":2000}
```

The front page right now, with the 20 first comments of each story:

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

A whole discussion thread as rows:

```json
{"storyUrls":["https://news.ycombinator.com/item?id=22238335"],"maxCommentsPerStory":2000}
```

This month's "Who is hiring?" job posts:

```json
{"hiringThread":"who_is_hiring","maxResults":1000}
```

Everything one user posted, plus their profile:

```json
{"authors":["pg"],"contentType":"all","sort":"newest","userProfiles":["pg"],"maxResults":500}
```

### Results, zeros and errors

- A search the site answered with no match, a front-page list where nothing passed your filters, and a story or user that does not exist are reported as such in the run status and cost nothing beyond the run start.
- A search the site refused, or that the run clock stopped, is named in the status and is never reported as "no match". If the site rate-limits a search, the actor waits once, then moves on and bills only what it delivered.
- Relevance search returns at most 1,000 results per search term (a limit of the search engine); the status says so, and **Newest first** goes past it.
- Invalid input ends the run right away with an "Input error: ..." message and only the $0.001 start charge.

### Pricing

- $0.001 per run (start).
- $0.50 per 1,000 rows on Free, with lower prices on higher Apify plans ($0.35 per 1,000 on Gold). Stories, comments, job posts and user profiles all count as one row each. Platform usage is included.

Set a maximum charge per run in Apify if you want a hard ceiling; the actor stops at it and says so in the status.

### FAQ

**Can I get more than 1,000 results for one keyword?** Yes: set *Sort* to *Newest first*. The actor then walks back through the dates, up to 10,000 rows per search term (split a bigger job into date ranges).

**How do I monitor new mentions?** Schedule a daily run with your keywords, *Content type* = *Stories and comments*, *Sort* = *Newest first* and *Only the last N days* = 1.

**Are deleted comments included?** No. Deleted and removed comments are skipped; their visible replies are kept, with their real depth.

**Are the comments in the same order as on the site?** They come in thread order (every reply right after its parent), oldest reply first at each level, not in the site's live ranking.

**How fresh is it?** Lists and profiles are read live. A story posted in the last minute or two may not be in search yet; for a brand-new story link the actor returns the story and says the thread is not indexed yet.

### Data use

The data comes from the public Hacker News APIs (the official API and the public search API). It is the same content anyone can read on news.ycombinator.com without an account. Usernames are public handles; the actor does not collect e-mail addresses or anything beyond the public profile (karma, creation date, about text). If you process comments or profiles about people, you are responsible for doing so lawfully (for example under the GDPR).

# Changelog

This Actor's version history is a separate document: https://apify.com/tagadanar/hacker-news-scraper/changelog.md

# Actor input Schema

## `searchTerms` (type: `array`):

Keywords to search on Hacker News, one per line (up to 100). Each term is searched in titles, URLs, story text and, with Content type set to comments, in comment text. Leave empty to use only the lists, story URLs, hiring thread or user profiles below.

## `contentType` (type: `string`):

What the search terms look for: stories, comments, both, Ask HN posts, Show HN posts or job posts.

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

Relevance returns the best matches first (at most 1,000 per search term, a limit of the search engine). Newest returns the most recent first and keeps going past 1,000 by walking back through the dates.

## `exactWords` (type: `boolean`):

On: a search for "rust" does not also return "trust" or "just" (near-spellings). Turn off to accept typo matches.

## `authors` (type: `array`):

Only posts by these Hacker News usernames. Combine with search terms, or use alone (with no search term) to get everything these users posted, filtered by Content type.

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

YYYY-MM-DD (UTC). Applies to searches and front-page lists.

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

YYYY-MM-DD (UTC), inclusive. Applies to searches and front-page lists.

## `lastDays` (type: `integer`):

Shortcut for a rolling window: only posts from the last N days. Replaces Posted on or after when both are set. Handy for a scheduled run that watches new mentions.

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

Only stories with at least this many points. Stories only (comments have no public score).

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

Only stories with at least this many comments.

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

Hacker News lists in their live order, with a rank field: Top (the front page, up to 500), New, Best, Ask HN, Show HN and Jobs. Date, points and comment filters apply.

## `storyUrls` (type: `array`):

news.ycombinator.com/item?id=... links or bare item IDs (up to 500). Returns the story and its whole comment thread as flat rows (depth, parent ID), up to Max comments per story. A comment link returns that comment and its replies.

## `hiringThread` (type: `string`):

Pull the job posts (top-level comments) of the latest monthly thread. Each row has a headline field with the post's first line (usually Company | Role | Location | Remote). Max results caps the posts. For an older month, paste that thread's URL in Story URLs.

## `userProfiles` (type: `array`):

Hacker News usernames or profile links (up to 500). One row each: karma, account creation date, about text, number of submissions.

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

For every story found by a search or a list, also return its comments as flat rows (up to Max comments per story). Each comment row is billed like any other row.

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

Cap on comment rows per story for Story URLs and Add comment threads. Comments come in thread order (a reply right after its parent). Default 100, max 10,000.

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

Cap on rows per search term, per front-page list and for the hiring thread (comment threads come on top, see Max comments per story). Default 100, max 10,000.

## Actor input object example

```json
{
  "searchTerms": [
    "web scraping"
  ],
  "contentType": "story",
  "sort": "relevance",
  "exactWords": true,
  "hiringThread": "none",
  "includeComments": false,
  "maxCommentsPerStory": 100,
  "maxResults": 100
}
```

# Actor output Schema

## `dataset` (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 = {
    "searchTerms": [
        "web scraping"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tagadanar/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 = { "searchTerms": ["web scraping"] }

# Run the Actor and wait for it to finish
run = client.actor("tagadanar/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 '{
  "searchTerms": [
    "web scraping"
  ]
}' |
apify call tagadanar/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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