# Hacker News Scraper — Stories, Comments & Front Page by Keyword (`intelscrape/hacker-news-scraper`) Actor

Hacker News Scraper: search Hacker News stories and comments by keyword and date, or pull the Top, New, Best, Ask HN, Show HN and Jobs lists, with points, comment counts, authors, URLs and the top comments of each story. Official public APIs. No API key. Pay per item.

- **URL**: https://apify.com/intelscrape/hacker-news-scraper.md
- **Developed by:** [IntelScrape](https://apify.com/intelscrape) (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

Pay per event

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 & Front Page by Keyword

![Hacker News Scraper — Stories, Comments & Front Page by Keyword](https://api.apify.com/v2/key-value-stores/hRabN9WfDGrT4nSvV/records/hacker-news-scraper-banner.png)

🇨🇳 **Hacker News 采集器**：按关键词和日期搜索 Hacker News 的帖子和评论，或抓取 Top、New、Best、Ask HN、Show HN 和招聘列表，包含得分、评论数、作者、链接以及每个帖子的热门评论。使用官方公开 API，无需密钥，按条付费。

🇸🇬 **Pengikis Hacker News**: cari cerita dan komen Hacker News mengikut kata kunci dan tarikh, atau ambil senarai Top, New, Best, Ask HN dan Show HN dengan mata, komen dan pengarang. Tiada kunci API.

#### 🤖 NEW: Connect This To Your AI!

Use this actor from Claude, ChatGPT, Cursor or any MCP client through the **[IntelScrape MCP Server](https://apify.com/intelscrape/skip--trace)**, or call it directly over the Apify API.

#### 🏆 Featured Bots by IntelScrape

- [Skip Trace Pro](https://apify.com/intelscrape/skip-trace-pro)
- [TruePeopleSearch Scraper](https://apify.com/intelscrape/truepeoplesearch-scraper)
- [TikTok Email Scraper](https://apify.com/intelscrape/tiktok-scraper)
- [Amazon Product Reviews Scraper](https://apify.com/intelscrape/amazon-product-review-scraper)
- [Website Contact Scraper](https://apify.com/intelscrape/contact-info-scraper)
- [Skip Trace MCP Server](https://apify.com/intelscrape/skip--trace)

⚡ Works with n8n, Make, Zapier, Google Sheets and the Apify API.

![price](https://img.shields.io/badge/price-%240.50%20per%201K%20items-blue) ![billing](https://img.shields.io/badge/billing-pay%20per%20item-green) ![API key](https://img.shields.io/badge/API%20key-not%20required-brightgreen) ![archive](https://img.shields.io/badge/archive-since%202007-orange)

**Keyword search across all Hacker News stories and comments, plus live Top/New/Best/Ask/Show/Jobs lists, with top comments attached.**

> **Honest coverage & billing:** Search relevance and coverage follow Algolia HN Search. You pay only for results actually delivered, and a built-in cost guard stops the run at your max-charge limit.

🌍 Built for teams in the **US, China and Singapore**, and anyone who needs this data in a spreadsheet or pipeline.

⭐ Found it useful? Please leave a review; it helps others find it.

⚖️ **Lawful business use only.** Collect public data only, and comply with the source site's terms, copyright and data-protection laws (GDPR, CCPA, China PIPL, Singapore PDPA).

*Examples below are illustrative; names and values may be fictional or out of date.*

### What is Hacker News Scraper?

Hacker News is where developers, founders and investors decide what matters in tech. A launch that hits the front page can bring tens of thousands of visitors; a critical thread can shape a brand for years. **Hacker News Scraper** lets you search every story and comment since 2007 by keyword, brand or domain, or pull the live front-page lists, and returns clean rows with points, comment counts, authors and the top replies, for monitoring, research, lead generation or AI analysis.

### What does it do?

- **Keyword & domain search**: stories, comments, Ask HN or Show HN, newest first, with a date window and a minimum-points filter
- **Live lists**: Top, New, Best, Ask, Show and Jobs with their current rank
- **Rich rows**: title, URL, domain, text, author, points, comment count, created time and HN link
- **Top comments (on by default)**: the leading comments of each story with author, time and reply count
- **Many queries per run** with deduplicated, consistent output
- **Official public APIs**: Algolia HN Search and the Hacker News Firebase API, so data is accurate and stable

### Why choose us over cheaper scrapers?

- **Honest output**: limits are documented, missing data is labeled, never invented
- **Clean, consistent schema** ready for Excel, Sheets, BI tools or an LLM
- **No account risk**: no logins, no cookies, no API keys
- **Pay per result** with a built-in cost guard; no subscription, failed items are never charged
- **Fast and light**: no residential proxy, so runs finish in seconds and stay cheap
- **Maintained by IntelScrape** and fixed fast when the source changes

### Who is it for?

- **Brand & launch monitoring**: see every time your product, domain or competitor is mentioned
- **Developer marketing**: find threads to join and topics that resonate
- **Investors & analysts**: track interest in startups, tools and technologies
- **Recruiting**: pull Who is Hiring and Jobs posts
- **Researchers**: build datasets of tech discussion
- **AI agents**: summarise what HN thinks about a topic this week

### How to use it

#### In Apify Console (no code)

1. Click **Try for free** / **Start**. The form is prefilled with a working example.
2. Change the inputs (see examples below).
3. Click **Start**, then export the results as **JSON, CSV, Excel, XML or HTML**, or open them in Google Sheets.
4. Optional: **Schedule** the actor to run hourly, daily or weekly.

#### Via API

```bash
curl -X POST "https://api.apify.com/v2/acts/intelscrape~hacker-news-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode": "search", "queries": ["openai", "web scraping"], "type": "story", "sinceDays": 30, "maxItems": 50}'
```

Or use the official [Apify JavaScript](https://docs.apify.com/api/client/js/) and [Python](https://docs.apify.com/api/client/python/) clients:

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("intelscrape/hacker-news-scraper").call(run_input={"mode": "search", "queries": ["openai", "web scraping"], "type": "story", "sinceDays": 30, "maxItems": 50})
for item in client.dataset(run["default_dataset_id"]).iterate_items():
    print(item)
```

#### With AI agents (MCP)

Add Apify's MCP server (`https://mcp.apify.com`) or the [IntelScrape MCP Server](https://apify.com/intelscrape/skip--trace) to Claude Desktop, Cursor, ChatGPT or any MCP client, then ask in plain language, e.g. *"Run intelscrape/hacker-news-scraper with the default input and summarise the results."*

### Input examples

**Search two keywords, last 30 days (default)**

```json
{
  "mode": "search",
  "queries": ["openai", "web scraping"],
  "type": "story",
  "sinceDays": 30,
  "maxItems": 50
}
```

**Current front page with comments**

```json
{
  "mode": "list",
  "list": "top",
  "maxItems": 30,
  "includeTopComments": true
}
```

**Every comment mentioning your domain this year**

```json
{
  "mode": "search",
  "queries": ["mycompany.com"],
  "type": "comment",
  "sinceDays": 365,
  "maxItems": 1000
}
```

### Output fields

| Field | Description |
|---|---|
| `id / type / hnUrl` | HN item id, story/comment/ask_hn/show_hn, link |
| `query / rank / list` | Matching query, or rank in a live list |
| `title / url / domain` | Story title and link |
| `text` | Self-post or comment text (HTML removed) |
| `author / points / commentCount / createdAt` | Engagement and timing |
| `parentStoryId` | For comments, the story they belong to |
| `topComments[]` | id, author, createdAt, text, replies |

#### Sample output

```json
{
  "id": 41234567,
  "type": "story",
  "query": "openai",
  "title": "OpenAI announces …",
  "url": "https://openai.com/index/…",
  "domain": "openai.com",
  "author": "pg_fan",
  "points": 812,
  "commentCount": 433,
  "createdAt": "2026-10-14T16:02:11Z",
  "hnUrl": "https://news.ycombinator.com/item?id=41234567",
  "topComments": [{ "author": "dang", "text": "…", "replies": 12 }]
}
```

### Pricing (pay per event)

| Event | When it is charged | Price |
|---|---|---|
| **Actor start** | once per run | $0.005 |
| **Item** | per story or comment row | $0.0005 |
| **Top comments** | per story with comments attached (on by default; turn off to skip) | $0.0005 |

#### Cost examples

| Run | Cost |
|---|---|
| Default run: 2 queries × 50 stories with comments | about $0.08–$0.105 |
| Front page (30) with comments | about $0.035 |
| 1,000 comments mentioning a domain | $0.505 |

Platform usage is included in these prices. Set **Max charge per run** in the run options to cap spend; the actor stops cleanly when the limit is reached and keeps everything collected so far.

### Tips for best results

- Search a bare domain (e.g. "stripe.com") to find every link to it.
- Use minPoints 100+ to keep only stories that reached the front page.
- Turn off top comments for the cheapest bulk export.
- Schedule hourly with sinceDays 1 for a real-time brand alert.

### FAQ

#### Is the data official?

Yes. It comes from Hacker News's official Firebase API and the Algolia HN Search API that powers search on the site.

#### How far back can I search?

To the start of Hacker News in 2007.

#### Why are some story URLs empty?

Ask HN and text posts have no external link; their text is in the text field.

#### Do deleted items show up?

No, deleted and dead items are not returned by the APIs.

#### Do I need an API key?

No.

#### Can I get the full comment tree?

This actor attaches top-level comments (up to 20 per story). For full trees, run it in comment mode on the story's keywords or open the hnUrl.

### Honest limits

- Search relevance and coverage follow Algolia HN Search.
- Points and comment counts are a snapshot at run time.
- Only top-level comments are attached per story.
- Very broad queries are capped by maxItems.

### Related IntelScrape bots

- [Brand Mentions Monitor](https://apify.com/intelscrape/brand-mentions-monitor): mentions from news, HN & Bluesky
- [Reddit Posts Scraper](https://apify.com/intelscrape/reddit-posts-scraper): posts & comments by keyword
- [Google Trending Searches](https://apify.com/intelscrape/google-trending-searches-scraper): daily trending searches by country
- [Google News Scraper](https://apify.com/intelscrape/google-news-scraper): headlines & summaries
- [Bluesky Posts Scraper](https://apify.com/intelscrape/bluesky-posts-scraper): posts & profiles from Bluesky
- [Skip Trace MCP Server](https://apify.com/intelscrape/skip--trace): IntelScrape tools for AI agents

### Legal

This actor collects publicly available data only. You are responsible for using the results lawfully and in line with the source's terms and applicable privacy laws (GDPR, CCPA, PIPL, PDPA). Process personal data only with a legitimate purpose. IntelScrape is not affiliated with, endorsed by or sponsored by the data source; all trademarks belong to their owners.

# Actor input Schema

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

Search all of Hacker News, or pull a live list.

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

Keywords, brands or domains (search mode).

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

What to search.

## `sinceDays` (type: `integer`):

Search window.

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

Skip low-scoring stories.

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

Cap per query (search) or list length (list mode).

## `list` (type: `string`):

Which live list.

## `includeTopComments` (type: `boolean`):

Attach the top comments of each story. Charged per story that has comments.

## `topCommentsPerStory` (type: `integer`):

How many top-level comments to attach.

## `proxyConfiguration` (type: `object`):

Not needed normally. The actor switches to Apify Proxy automatically if the source starts rate-limiting.

## Actor input object example

```json
{
  "mode": "search",
  "queries": [
    "openai",
    "web scraping"
  ],
  "type": "story",
  "sinceDays": 30,
  "minPoints": 0,
  "maxItems": 50,
  "list": "top",
  "includeTopComments": true,
  "topCommentsPerStory": 5,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (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 = {
    "queries": [
        "openai",
        "web scraping"
    ],
    "includeTopComments": true
};

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

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

```

## MCP server setup

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