# Hacker News Scraper: Stories, Comments & Search (`fjordlabs/hacker-news`) Actor

Scrape Hacker News front page, new, best, Ask HN, Show HN and jobs, search stories and comments by keyword, date and points, and get full comment trees. Official APIs, no key.

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

## Pricing

from $0.14 / 1,000 stories

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, search and comment trees

Scrape **Hacker News** in one cheap run: the **front page (top), new, best, Ask HN, Show HN and job** lists, a **keyword search** across all of HN's history with **date range, minimum points and minimum comments**, or **specific stories by ID or URL** with their **full comment tree**. You get clean rows with the title, link, domain, points, comment count, author, time and text, plus one row per comment with its depth, parent and thread position.

Built for developer-tool founders and marketers tracking mentions of their product or competitors, VCs and analysts watching launches (Show HN, Launch HN), recruiters reading job posts, researchers and data scientists building tech-sentiment datasets, newsletter writers, and AI agents that need "what is HN saying about X?". It uses Hacker News' **official Firebase API** and the **Algolia HN Search API**: no API key, no login, no browser.

![Example output of Hacker News Scraper: a table with title, points, commentsCount, domain, createdAt and more](https://api.apify.com/v2/key-value-stores/bp61pnREuVYPEvqbu/records/output-hacker-news)

### What you get

- 📰 **Lists:** top (front page order, with `rank`), new, best, Ask HN, Show HN, jobs
- 🔎 **Search:** keywords in stories, comments, Ask HN, Show HN, Launch HN, jobs, polls or stories that reached the front page; sort by relevance or date
- 📅 **Filters:** posted after / before (ISO dates or `7 days`, `24 hours`), minimum points, minimum comments. They work on lists too
- 💬 **Comment trees:** one row per comment with `depth`, `parentId` and thread order, max comments per story and max depth, deleted and flagged comments skipped
- 🏷️ **Post kind:** every story is tagged `story`, `ask`, `show`, `launch`, `tell`, `job` or `poll`
- 🔁 **Monitoring:** `searchSort: "date"` + `dateFrom: "24 hours"` on a daily schedule returns only new mentions, and it isn't stuck at Algolia's 1,000-result limit
- 🧹 **Clean text:** HN's HTML is turned into plain text, with links written out in full

### Input examples

Today's front page with the top of each discussion:

```json
{
  "mode": "top",
  "maxItems": 30,
  "includeComments": true,
  "maxCommentsPerStory": 20,
  "maxCommentDepth": 2
}
```

Every story about Postgres with 50+ points in the last 3 months:

```json
{
  "mode": "search",
  "searchQuery": "postgres",
  "searchType": "story",
  "searchSort": "date",
  "dateFrom": "3 months",
  "minPoints": 50,
  "maxItems": 500
}
```

A story and its whole thread:

```json
{
  "mode": "items",
  "storyIds": ["https://news.ycombinator.com/item?id=8863"],
  "maxCommentsPerStory": 500
}
```

### Output example

One row per story:

```json
{
  "type": "story",
  "id": 8863,
  "itemType": "story",
  "postKind": "story",
  "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,
  "commentsCount": 71,
  "createdAt": "2007-04-04T19:16:40+00:00",
  "text": null,
  "source": "item",
  "rank": null
}
```

And one row per comment:

```json
{
  "type": "comment",
  "id": 9224,
  "storyId": 8863,
  "parentId": 8863,
  "depth": 1,
  "author": "BrandonM",
  "text": "I have a few qualms with this app: ...",
  "createdAt": "2007-04-05T15:16:54+00:00",
  "replies": 1,
  "storyTitle": "My YC app: Dropbox - Throw away your USB drive",
  "hnUrl": "https://news.ycombinator.com/item?id=9224"
}
```

Filter on `type` (`story` / `comment`) or use the **Stories only** and **Comments only** dataset views. List rows have `rank` (position on the list); search rows have `source: "search:<query>"`. A run summary is saved as `SUMMARY` in the key-value store.

### Pricing

Pay only for results:

| Event | Price |
|---|---|
| Actor start | $0.00005 |
| Story (row) | $0.0002 (**$0.20 per 1,000**) |
| Comment (row) | $0.0001 (**$0.10 per 1,000**) |

Example: the front page (30 stories) costs $0.006; with 20 comments each, about $0.07. A daily "new mentions of my product" search usually costs well under a cent. Errors (an unknown or unreadable item ID, a list or search that can't be fetched) are logged as error rows and **never charged**. Invalid input (e.g. `dateFrom` after `dateTo`) ends the run before anything is fetched, with one free error row and the reason in the run's status message.

### Notes and limits

- Data comes from Hacker News' public APIs, the same data anyone sees on news.ycombinator.com. No login and no cookies. The Actor doesn't open news.ycombinator.com pages.
- HN's own lists hold up to 500 stories (top, new, best) or 200 (Ask, Show, jobs). Use search for more, or for older stories.
- Relevance search returns at most 1,000 results per query (Algolia's limit). Date-sorted search has no such limit: the Actor walks back in time automatically.
- Comments are fetched level by level, so with a small **Max comments per story** you get the top-level discussion first. HN's ranking order is kept within each thread.
- Points and comment counts in search results come from the search index and can lag the live site by a few minutes.
- Author usernames are public HN pseudonyms and are included. The Actor doesn't scrape user profiles, karma or "about" texts.
- On lists, the date/points/comments filters are applied to the stories on that list only, so `maxItems` can return fewer rows than asked (e.g. `minPoints: 500` on `new`). Use search to filter across all of HN.
- A single comment fetched by ID (mode = items) has `storyId`, `depth` and `storyTitle` empty; comment search hits have `depth` and `replies` empty.
- When you set a **max charge per run**, the Actor stops as soon as it is reached and never pushes rows it can't charge.
- Poll options aren't fetched (the poll row itself is).

### Changelog

- **2026-11-20:** Public on the Apify Store.
- **2026-11-10:** Invalid input now ends as a successful run with one free error row that says what to fix, instead of a failed run.
- **2026-11-08:** Reliability review before the wave-2 launch, with more tests.

### How to use Hacker News Scraper

1. Pick **what to scrape**: top (front page), new, best, Ask HN, Show HN, jobs, a **search**, or specific **item IDs/URLs**.
2. For search, enter keywords and optionally a **date range**, **minimum points** and the type (stories, comments, Show HN...).
3. Turn on **Include comments** to get each story's comment tree, with a cap per story and an optional depth limit.
4. Click **Start**, then export stories and comments as JSON, CSV or Excel, or schedule it to monitor mentions.

### Use it from code (API)

Run it from Python with the official client (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("fjordlabs/hacker-news").call(run_input={'mode': 'search', 'searchQuery': 'postgres', 'searchSort': 'date', 'dateFrom': '7 days', 'maxItems': 100})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

Or with one HTTP call that returns the results directly:

```bash
curl -X POST "https://api.apify.com/v2/acts/fjordlabs~hacker-news/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" -d '{"mode": "search", "searchQuery": "postgres", "searchSort": "date", "dateFrom": "7 days", "maxItems": 100}'
```

It also works with Make, Zapier, n8n, Google Sheets and webhooks through Apify's integrations.

### Use with AI agents (MCP)

Agents can call this Actor as a tool through Apify's MCP server (mcp.apify.com). Add `fjordlabs/hacker-news` to the server's Actors. Results are clean JSON with a small default size, so they fit well in an agent's context.

### FAQ

**Do I need an API key?**
No. The Actor uses Hacker News' official Firebase API and the public Algolia HN Search API.

**How many results can I get?**
HN's lists hold up to 500 stories. Search by date has no 1,000-result cap: the Actor walks back in time, so you can export years of stories.

**Can I monitor mentions of my product?**
Yes. Use mode = search, searchSort = date and dateFrom = `24 hours` on a daily schedule; you only pay for new matches.

**How are comments structured?**
One row per comment with depth, parentId and storyId, in HN's thread order. Deleted and flagged comments are skipped.

**Is personal data collected?**
Only public HN usernames on posts and comments. User profiles, karma and about texts are not scraped.

**Am I charged for errors?**
No. Rows that fail are never charged; you only pay for results.

### More from fjordlabs

- [Google Trends Scraper](https://apify.com/fjordlabs/google-trends)
- [Google Trends Trending Now](https://apify.com/fjordlabs/google-trending-now)
- [Google News Scraper](https://apify.com/fjordlabs/google-news)
- [Google Play Reviews & App Data Scraper](https://apify.com/fjordlabs/google-play-reviews)
- [App Store Reviews & App Data Scraper (iOS)](https://apify.com/fjordlabs/app-store-reviews)
- [Bulk PageSpeed & Core Web Vitals Audit](https://apify.com/fjordlabs/pagespeed-audit)
- [Google Autocomplete Keyword Expander](https://apify.com/fjordlabs/google-autocomplete)
- [App Store & Google Play Search Rank + Top Charts (ASO)](https://apify.com/fjordlabs/app-store-search-charts)
- [SEO & AI-Search Readiness Audit](https://apify.com/fjordlabs/seo-ai-readiness-audit)
- [Website Tech Stack Detector](https://apify.com/fjordlabs/tech-stack-detector)
- [Steam Reviews & Game Data Scraper](https://apify.com/fjordlabs/steam-reviews)
- [Chrome Web Store Extension Details Scraper](https://apify.com/fjordlabs/chrome-web-store)
- [Google Ads Transparency Center Scraper](https://apify.com/fjordlabs/google-ads-transparency)
- [Shopify Store Products Scraper](https://apify.com/fjordlabs/shopify-products)
- [Sitemap URL Extractor](https://apify.com/fjordlabs/sitemap-extractor)
- [EU Public Tenders Scraper (TED)](https://apify.com/fjordlabs/eu-tenders-ted)
- [Domain Intel: WHOIS/RDAP, DNS, SSL, SPF/DMARC](https://apify.com/fjordlabs/domain-intel)
- [App Store & Google Play App Details + Developer Portfolio](https://apify.com/fjordlabs/app-details-portfolio)
- [Website Screenshot API: Full Page, Mobile, PDF](https://apify.com/fjordlabs/website-screenshot)
- [Wayback Machine Site History](https://apify.com/fjordlabs/wayback-history)

# Actor input Schema

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

A Hacker News list (front page, newest, best, Ask HN, Show HN, jobs), a keyword/date search, or specific items by ID or URL.

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

How many stories (or search hits) to return. HN's own lists hold up to 500 (top/new/best) or 200 (ask/show/job) stories; search can go much further with sort = date.

## `searchQuery` (type: `string`):

Keywords for mode = search, e.g. "rust" or "open source llm". Leave empty to get everything that matches the type, date and points filters.

## `searchType` (type: `string`):

Which kind of item to search.

## `searchSort` (type: `string`):

Relevance (max 1,000 results per query) or date, newest first (no 1,000 limit; best for monitoring).

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

ISO date (2026-10-01), date-time, or relative like "7 days", "24 hours", "3 months". Applies to search and lists.

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

ISO date (a date alone means the end of that day) or relative like "1 day".

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

Only stories with at least this many points (e.g. 100). Applies to search and lists.

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

Only stories with at least this many comments. Applies to search and lists.

## `storyIds` (type: `array`):

Hacker News item IDs (8863) or URLs (https://news.ycombinator.com/item?id=8863). Stories, jobs, polls or single comments.

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

Also return each story's comment tree, one row per comment (charged per comment). Default: on for mode = items, off otherwise.

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

Upper levels of the thread are fetched first, so a small cap keeps the top-level discussion.

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

1 = top-level comments only, 2 = plus direct replies, and so on. 0 = no limit.

## Actor input object example

```json
{
  "mode": "top",
  "maxItems": 10,
  "searchType": "story",
  "searchSort": "relevance",
  "minPoints": 0,
  "minComments": 0,
  "maxCommentsPerStory": 50,
  "maxCommentDepth": 0
}
```

# Actor output Schema

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

No description

## `summary` (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": "top",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("fjordlabs/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 = {
    "mode": "top",
    "maxItems": 10,
}

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

```

## MCP server setup

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