# Hacker News Search — stories & comments by keyword (`openregistry/hacker-news-search`) Actor

Search Hacker News stories and comments by keyword, date, points, author or thread. Built for brand and topic monitoring: clean text, direct links, no 1,000-result cap when sorted by date. Uses the official HN search API.

- **URL**: https://apify.com/openregistry/hacker-news-search.md
- **Developed by:** [Mahé Perrin](https://apify.com/openregistry) (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

$0.50 / 1,000 result delivereds

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 Search — stories & comments by keyword

Find every Hacker News story and comment that mentions your brand, your product, a competitor or a technology, filtered by date, points, author or discussion.

The Actor queries the **official Hacker News search API** (`hn.algolia.com/api`, public and key-free). No HTML is parsed, so there is nothing to break when the site changes, and a run of a few hundred results takes seconds. This is an independent tool, not affiliated with Hacker News or Y Combinator.

### What it is for

- **Brand monitoring**: schedule a daily run with your product names and `postedAfter` set to yesterday; send new mentions to Slack, a sheet or a webhook.
- **Launch tracking**: collect all comments of your Show HN discussion with `storyId`.
- **Market and topic research**: every story above 100 points about "vector database" since 2023, with comment counts.
- **Lead and hiring signals**: Ask HN and job posts that mention a stack or a problem you solve.
- **Datasets**: comment text as clean plain text, ready for sentiment analysis or an LLM.

### Input example

```json
{
  "queries": ["apify", "\"web scraping\""],
  "contentType": "all",
  "sortBy": "date",
  "postedAfter": "2026-10-01",
  "maxResultsPerQuery": 500
}
```

- `queries` — one search per entry. Leave empty to list everything that passes the filters (for example all front-page stories of a week).
- `contentType` — stories, comments, both, Ask HN, Show HN, front-page stories, job posts or polls.
- `sortBy` — `date` (newest first, **no result cap**) or `relevance` (1,000 per keyword at most, a limit of the search API).
- `postedAfter`, `postedBefore`, `minPoints`, `minComments`, `author`, `storyId` — optional filters.
- `maxResultsPerQuery`, `maxResults` — stop conditions; you control the cost.

### Output

One row per story or comment:

| Field | Meaning |
|---|---|
| `type` | `story`, `comment`, `job`, `poll` |
| `id`, `url` | item id and link to the discussion on news.ycombinator.com |
| `title`, `linkUrl` | story title and the external link it points to |
| `text` | comment text, or body of an Ask HN / Show HN post, converted to plain text (links kept in full) |
| `author`, `authorUrl` | public username and profile link |
| `points`, `commentsCount` | story score and number of comments |
| `createdAt` | posting time, UTC |
| `storyId`, `storyTitle`, `storyUrl` | the discussion a comment belongs to |
| `parentId` | the item a comment replies to |
| `isAskHn`, `isShowHn`, `wasOnFrontPage` | flags |
| `query` | the keyword that returned the row |

A row matched by several keywords is delivered and charged once.

### Limits to know

- Scores of comments are not public: `points` is empty for comments, and `minPoints` keeps stories only.
- The search index follows Hacker News with a delay of a few minutes; points and comment counts are those of the last index update.
- Matching is by word with typo tolerance. Use double quotes (or *Exact phrase*) for strict matches on short or ambiguous brand names.
- The Actor stays under the API's published limit of 10,000 requests per hour and retries on HTTP 429 and 5xx. One request returns up to 200 rows.

### Personal data

Results contain only what users posted publicly on Hacker News under their username. Usernames and comment text can still be personal data: you are responsible for your own use of the results, including compliance with GDPR and similar laws.

### Pricing

Pay per row delivered. Duplicates are never charged.

# Actor input Schema

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

One search per entry: a brand, product, domain name or topic. Put a phrase in double quotes for an exact match. Leave empty to list everything that passes the filters below (for example all stories above 500 points this week).

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

Stories match on title, link and text; comments match on their text and on the title of their story.

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

Newest first is the right choice for monitoring and for full exports.

## `exactPhrase` (type: `boolean`):

Treat every keyword entry as an exact phrase (same as wrapping it in double quotes).

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

YYYY-MM-DD, UTC.

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

YYYY-MM-DD, UTC.

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

Stories only: comment scores are not public, so this filter removes all comments.

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

Stories only.

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

Only items posted by this Hacker News username (case-sensitive).

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

Item id or URL of a story (https://news.ycombinator.com/item?id=...). With "Comments", returns the comments of that discussion.

## `maxResultsPerQuery` (type: `integer`):

Reading of one keyword stops at this many delivered rows.

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

The run stops once this many rows are delivered, so you control the cost.

## Actor input object example

```json
{
  "queries": [
    "web scraping"
  ],
  "contentType": "story",
  "sortBy": "date",
  "exactPhrase": false,
  "maxResultsPerQuery": 100,
  "maxResults": 1000
}
```

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

// Run the Actor and wait for it to finish
const run = await client.actor("openregistry/hacker-news-search").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("openregistry/hacker-news-search").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 openregistry/hacker-news-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,openregistry/hacker-news-search"
        }
    }
}
```

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/dDO53XaZTk1vfs1I4/builds/zbAPhXlYn7d130XAH/openapi.json
