# Hacker News Scraper: stories and comments by keyword (`bepolabs/hacker-news`) Actor

Pull matching stories and comments from Algolia's public index, with discussion URL, reply total and timestamp. Schedule runs, call it by API, or hand it to an AI agent over MCP. Costs 0.16 USD per 1,000 results.

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

## Pricing

$0.16 / 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

### 🟧 What is Hacker News Search?

Turn search terms into a table of Hacker News stories and comments, with title, link, author, points, date and thread id. Keep only recent or popular items; no login and no proxy needed.

- **Brand monitoring**: see every story and comment that names your company or its rivals
- **Release tracking**: measure how your Show HN post did, in points and comments
- **Market research**: collect the best-voted discussions on a topic since a date
- **Content ideas**: find the questions developers raise in Ask HN

![Hacker News Search: Hacker News stories, comments, Ask HN, Show HN and jobs for any search, with points, comment count, date and text.](https://api.apify.com/v2/key-value-stores/wdeAWGooHdIhvFgSY/records/hacker-news-hero.png)

#### ✨ Why use this Actor?

- ✅ **Official source**: Algolia's HN Search, the search behind hn.algolia.com
- ✅ **Every item type**: `tags`: story, comment, ask_hn, show_hn or job
- ✅ **Filters**: `since`, `minPoints` and `sort` by relevance or date
- ✅ **Several searches per run**: each query is reported in the run summary
- ✅ **Cheap**: 0.16 USD per 1,000 items; failed queries are not charged

### 📦 What data can you get with Hacker News Search?

| | | |
|---|---|---|
| 📰 Title | 🔗 Link and HN URL | 👤 Author |
| 🔺 Points | 💬 Comment count | 📅 Created at |
| 📝 Text of comments and Ask HN | 🧵 Story and parent id | 🏷️ Type and tags |
| 🔎 Query it came from |  |  |

### 🚀 How to use Hacker News Search

Hacker News Search works in a few clicks, no coding needed:

1. [Create a free Apify account](https://console.apify.com/sign-up) (the free plan includes 5 USD of monthly credit).
2. Open [Hacker News Search](https://apify.com/bepolabs/hacker-news) and click **Try for free**.
3. Enter one or more search terms, pick stories or comments and, optionally, a date and a minimum of points.
4. Click **Start** and wait for the run to finish (most runs take seconds).
5. Download your data as JSON, CSV, Excel, XML or HTML, or send it straight to Google Sheets, Make, Zapier or your AI agent.

![How Hacker News Search works](https://api.apify.com/v2/key-value-stores/wdeAWGooHdIhvFgSY/records/hacker-news-workflow.png)

### ⬇️ Input

Only `queries` is required; by default the Actor returns the 100 most relevant stories per query.

##### Item type

`tags` picks story (default), comment, ask_hn, show_hn or job.

##### Newest first

Set `sort` to `date` and `since` to a date for monitoring; schedule the run daily.

##### Only popular

`minPoints` keeps items with at least that many points.

| Field | Type | What it does | Default |
|---|---|---|---|
| **Search terms** (`queries`) | array | One search per term; results are deduped across terms. | `["web scraping"]` |
| **Type** (`tags`) | string | Which kind of Hacker News item to search: "story", "comment", "ask_hn", "show_hn", "job", "poll" or "front_page" (stories currently on the front page). | `"story"` |
| **Sort** (`sort`) | string | relevance (with points) or date (newest first). | `"relevance"` |
| **Created since** (`since`) | string | Keep items created on or after this date, e.g. |  |
| **Minimum points** (`minPoints`) | integer | Keep stories with at least this many points. | `0` |
| **Maximum items per term** (`maxItemsPerQuery`) | integer | Maximum number of items returned for each search term (1 to 1,000), most relevant or newest first depending on the sort. | `100` |
| **Maximum retries** (`maxRetries`) | integer | Retries per request with exponential backoff on network errors, 429 and 5xx. | `3` |

![Hacker News Search input form](https://api.apify.com/v2/key-value-stores/wdeAWGooHdIhvFgSY/records/hacker-news-input.png)

#### Input example

```json
{
    "queries": [
        "web scraping",
        "apify"
    ],
    "tags": "story",
    "minPoints": 50,
    "maxItemsPerQuery": 20
}
```

### ⬆️ Output

Every story or comment becomes one row. The run summary (`OUTPUT`) lists every query with the items found and the error if one failed.

![Hacker News Search output table](https://api.apify.com/v2/key-value-stores/wdeAWGooHdIhvFgSY/records/hacker-news-output.png)

#### Output example

One row of the dataset (query "web scraping", a real run of 2026-10-16):

```json
{
    "id": "22180559",
    "type": "story",
    "title": "Congrats! Web scraping is legal! (US precedent)",
    "url": "https://parsers.me/us-court-fully-legalized-website-scraping-and-technically-prohibited-it/",
    "hnUrl": "https://news.ycombinator.com/item?id=22180559",
    "author": "ehurynovich",
    "points": 1057,
    "numComments": 388,
    "createdAt": "2020-01-29T14:06:37Z",
    "text": null,
    "storyId": 22180559,
    "parentId": null,
    "tags": [
        "story"
    ],
    "query": "web scraping"
}
```

View the results as a table or JSON in the Output tab and download them as JSON, CSV, Excel, XML, HTML or RSS, all fields or only those you pick.

### 💰 How much does Hacker News Search cost?

Hacker News Search is priced **per event**: **0.16 USD per 1,000 results** (0.00016 USD per result), with no monthly rental. Each saved row is billed; failed queries cost nothing.

| You get | You pay |
|---|---|
| 100 results | 0.02 USD |
| 1,000 results | 0.16 USD |
| 10,000 results | 1.6 USD |
| 100,000 results | 16 USD |

💡 Apify's free plan gives you 5 USD of credit every month, enough for about **31,250 results** at no cost. Set a spending limit per run and the Actor stops there.

### ⚖️ Hacker News Search vs. the alternatives

| | Hacker News Search | HTML scrapers | hn.algolia.com |
|---|---|---|---|
| **Official source** | ✅ | ❌ | ✅ |
| **Several queries in one run** | ✅ | varies | ❌ |
| **Points and date filters** | ✅ | rarely | ✅ |
| **Export, schedule, API and MCP** | ✅ | ✅ | ❌ |

### 🔌 Integrations, API and MCP

#### Connect Hacker News Search to your AI agent (MCP)

Give Claude, ChatGPT, Cursor or any MCP client direct access to Hacker News Search through the [Apify MCP server](https://mcp.apify.com). Add this URL to its settings:

```text
https://mcp.apify.com/?actors=bepolabs/hacker-news
```

For Claude Desktop, add it under `mcpServers` in `claude_desktop_config.json`:

```json
{
    "mcpServers": {
        "hacker-news": {
            "command": "npx",
            "args": [
                "-y",
                "@apify/actors-mcp-server",
                "--actors",
                "bepolabs/hacker-news"
            ],
            "env": {
                "APIFY_TOKEN": "<your Apify API token>"
            }
        }
    }
}
```

Then ask: *"Find Hacker News stories about our product from the last 30 days with more than 20 points and sum up the comments."*

#### Run it from your code

Python (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("bepolabs/hacker-news").call(run_input={"queries":["web scraping","apify"],"tags":"story","minPoints":50,"maxItemsPerQuery":20})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

JavaScript (`npm install apify-client`):

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('bepolabs/hacker-news').call({"queries":["web scraping","apify"],"tags":"story","minPoints":50,"maxItemsPerQuery":20});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### No-code integrations

Send results to **Google Sheets, Slack, Airtable, HubSpot, Make, Zapier, n8n** and more from the Integrations tab, start runs on a **schedule**, or trigger your own endpoint with a **webhook** when a run finishes. The [Apify API](https://docs.apify.com/api/v2) gives you full control over runs and datasets.

### ❓ FAQ

##### How far back does it go?

To the start of Hacker News; use `since` to limit the window.

##### Can I get comments?

Yes, set `tags` to `comment`; each row has the comment text, its story and parent.

##### How many items per query?

Up to `maxItemsPerQuery` (default 100).

##### Is it legal to use Hacker News Search?

The Actor reads the open search index that Y Combinator and Algolia offer for exactly this kind of search. Usernames are public; respect authors' rights if you republish their text.

##### What if something is missing or does not work?

Open an issue on the **Issues** tab; we read each one and reply. Feature requests are welcome too.

### 💬 Your feedback

Tell us what Hacker News Search should add on the **Issues** tab or leave a review; your notes decide what we work on next.

### 🔗 Related Actors

| Actor | What it does |
|---|---|
| 🦋 [Bluesky Posts](https://apify.com/bepolabs/bluesky-posts) | Bluesky posts for any search or handle with text, date, author, likes, reposts, replies, links and hashtags. No login. |
| 📰 [RSS Feed Reader](https://apify.com/bepolabs/rss-reader) | Any RSS, Atom or JSON feed, or just a website URL, to one clean list of articles, with full text on request. |
| 💼 [ATS Jobs](https://apify.com/bepolabs/ats-jobs) | Every open job from company career boards on Greenhouse, Lever, Ashby, Workable, SmartRecruiters and Recruitee in one deduped feed. |
| 🌍 [Remote Jobs](https://apify.com/bepolabs/remote-jobs) | Remote jobs from Remote OK, Himalayas, Jobicy and Arbeitnow in one deduped feed, with salary, posted date and apply link. |
| 🏛️ [SAM.gov Contract Opportunities](https://apify.com/bepolabs/sam-gov) | US federal contract opportunities by keyword, NAICS, set-aside or agency, with deadlines, contacts and attachments. |
| 🏛️ [UK Tenders](https://apify.com/bepolabs/uk-tenders) | UK public contracts from Contracts Finder and Find a Tender by keyword, CPV, value, region and deadline, with daily alerts. |
| 🏛️ [US Federal Grants Finder](https://apify.com/bepolabs/us-grants) | Grants.gov opportunities by keyword, agency or CFDA number, with award amounts, deadlines, eligibility and contacts. |
| 🧩 [Chrome Web Store Scraper](https://apify.com/bepolabs/chrome-web-store) | Users, rating, version, last update, developer, category and permissions of any Chrome extension. |

# Changelog

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

# Actor input Schema

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

One search per term; results are deduped across terms. Leave empty with tags "front_page".

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

Which kind of Hacker News item to search: "story", "comment", "ask_hn", "show_hn", "job", "poll" or "front_page" (stories currently on the front page).

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

relevance (with points) or date (newest first).

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

Keep items created on or after this date, e.g. 2026-01-01.

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

Keep stories with at least this many points.

## `maxItemsPerQuery` (type: `integer`):

Maximum number of items returned for each search term (1 to 1,000), most relevant or newest first depending on the sort.

## `maxRetries` (type: `integer`):

Retries per request with exponential backoff on network errors, 429 and 5xx.

## Actor input object example

```json
{
  "queries": [
    "web scraping"
  ],
  "tags": "story",
  "sort": "relevance",
  "minPoints": 0,
  "maxItemsPerQuery": 100,
  "maxRetries": 3
}
```

# Actor output Schema

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

Dataset items, one row per result, in the overview table view.

# 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": [
        "web scraping"
    ]
};

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

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

```

## MCP server setup

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