# Hacker News Search API - Stories, Comments, Show HN (`lost.fany/hacker-news-search-scraper`) Actor

Search and monitor Hacker News: stories, comments, Show HN, Ask HN, jobs and the front page, by keyword, author, date and points. Official Algolia API, no key. dryRun prices a run before you pay; charged only for items delivered.

- **URL**: https://apify.com/lost.fany/hacker-news-search-scraper.md
- **Developed by:** [Natalia Ivanova](https://apify.com/lost.fany) (community)
- **Categories:** News, Social media, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 item scrapeds

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 Search API - Stories, Comments, Show HN

Search and monitor **Hacker News** — stories, comments, Show HN, Ask HN, Launch HN, jobs and the current front page — for any words: your brand, competitors, a domain, a technology, a topic. Get clean rows with points, comment counts, author, timestamps, the outbound link and the HN thread link, plus which of your queries matched. Runs on the official **Algolia Hacker News Search API**: no key, no scraping, no rate-limit games.

### What you can do with it

- **Brand and competitor monitoring** — every mention of `yourproduct.com` or `Competitor X` in stories and comments since yesterday, straight to Slack or email with Apify integrations.
- **Launch tracking** — all `Show HN` / `Launch HN` posts of the week with points and comments; find what resonated.
- **Content research** — top stories about "rust", "vector database" or "remote work" this month, sorted by points.
- **Hiring signals** — HN job posts mentioning a stack or a city.
- **AI agents** — "what is HN saying about X this week?" through the Apify MCP server.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `queries` | array | `[]` | Words or phrases; each searched separately, results merged and deduplicated (`matchedQueries` shows which matched). Empty = everything of the chosen types. |
| `types` | array | `["story"]` | `story`, `comment`, `show_hn`, `ask_hn`, `launch_hn`, `job`, `poll`, `front_page`. |
| `since` / `until` | string | `7 days` / now | `2026-09-01`, `today`, `yesterday`, `24 hours`, `30 days`, `1 year`; empty `since` = all time. |
| `sort` | select | `date` | `date` (newest), `relevance`, `points`, `comments`. |
| `minPoints` / `minComments` | number | `0` | Thresholds. |
| `exactPhrase` | boolean | `false` | Match queries as exact phrases. |
| `includeText` | boolean | `true` | Comment/story text, HTML stripped. |
| `maxItems` | number | `500` | Cap (Algolia returns at most 1,000 hits per query). |

Examples:

```json
{ "queries": ["apify", "apify.com"], "types": ["story", "comment"], "since": "24 hours" }
```

```json
{ "types": ["show_hn"], "since": "7 days", "sort": "points", "minPoints": 20 }
```

```json
{ "queries": ["postgres"], "types": ["story"], "since": "30 days", "sort": "comments", "minComments": 50 }
```

### Output

```json
{
  "id": "49643982",
  "type": "show_hn",
  "title": "Show HN: A faster way to scrape sitemaps",
  "url": "https://example.com",
  "hnUrl": "https://news.ycombinator.com/item?id=49643982",
  "storyId": "49643982",
  "storyTitle": null,
  "storyUrl": null,
  "author": "someuser",
  "points": 142,
  "commentsCount": 37,
  "createdAt": "2026-09-10T08:12:44Z",
  "text": null,
  "isFrontPage": true,
  "matchedQueries": ["scrape"],
  "scrapedAt": "2026-09-10T15:00:00Z"
}
```

Comments carry `text`, `storyId`, `storyTitle` and `storyUrl` so you can jump to the thread. The `OUTPUT` record in the key-value store lists hits per query and the number of API requests.

### Use cases

Ready-made examples you can run without configuring anything:

- [Algolia Hacker News search without a key](https://apify.com/lost.fany/hacker-news-search-scraper/examples/algolia-hacker-news-search) — ready-made task, run it as is
- [Monitor Hacker News for brand mentions](https://apify.com/lost.fany/hacker-news-search-scraper/examples/hacker-news-brand-monitoring) — ready-made task, run it as is

#### Algolia Hacker News search without a key

Full-text search over stories and comments through the official Algolia HN API — no key, no scraping, no rate-limit games.

```json
{ "queries": ["postgres"], "types": ["story", "comment"] }
```

#### Hacker News search API for brand monitoring

Run it on a schedule with your brand, your competitors and your domain as queries, and every new mention arrives as a row.

```json
{ "queries": ["yourbrand", "yourdomain.com"], "sort": "date" }
```

#### Scrape Show HN launches

Show HN and Launch HN posts with points, comment counts and the outbound link — a weekly read on what shipped.

```json
{ "types": ["show_hn"], "sort": "points" }
```

### Pricing

Pay per event: a small fee per Actor start plus a fee per item returned. Current prices are in the **Pricing** tab.

### Good to know

- Algolia's HN index updates within seconds of a post; points and comment counts are as of the search time. Run again later for fresh numbers.
- One query returns at most 1,000 hits. Narrow the period or split by type for exhaustive pulls.
- Searching with no query and a wide period returns a lot; keep `since` tight or set `minPoints`.

### Use with AI agents (MCP)

Add the Actor to the [Apify MCP server](https://apify.com/apify/actors-mcp-server) and ask: "What did Hacker News say about SQLite this week?" → `{ "queries": ["sqlite"], "types": ["story", "comment"], "since": "7 days" }`.

### Related Actors

- [Remote Jobs Scraper](https://apify.com/lost.fany/remote-jobs-scraper)
- [Prediction Markets API](https://apify.com/lost.fany/polymarket-kalshi-prediction-markets)
- [SEC EDGAR API](https://apify.com/lost.fany/sec-edgar-filings)

### Disclaimer

Not affiliated with Y Combinator or Hacker News. Data comes from the public Algolia HN Search API; content belongs to its authors.

### Cost control

Pay per event only works if you can see the bill before you pay it:

- Set `dryRun` to count every result and print what a full run would cost - nothing is charged, and only a few sample rows are stored.
- You are charged only for rows actually delivered to the dataset; a run that finds nothing costs nothing beyond the start event.
- `maxItems` is respected exactly, and the run stops before the platform's Max total charge for the run.
- Every run writes a `COST` record to the key-value store: chargeable events, charged events, the amount in USD and whether a limit was hit.

# Actor input Schema

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

Words or phrases to search for (brand, competitor, topic, domain). Each is searched separately; results are merged and deduplicated. Empty = everything of the selected types in the period.

## `types` (type: `array`):

What to return. Default covers stories and comments: brand and competitor mentions on Hacker News live mostly in comment threads, so stories alone miss most of them.

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

Only items created after this: 2026-09-01, today, yesterday, '24 hours', '7 days', '1 year'. Default is the last 30 days: a narrower window makes a first run look empty on quieter keywords.

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

Only items created before this moment. Empty = now.

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

Newest first, best relevance (Algolia ranking), most points or most comments.

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

Skip items with fewer points.

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

Skip stories with fewer comments.

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

Match each query as an exact phrase instead of all words anywhere.

## `includeText` (type: `boolean`):

Include comment text / story text (HTML stripped).

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

Stop after this many items (Algolia returns at most 1,000 per query).

## `dryRun` (type: `boolean`):

Count every result and show what a full run would cost, without charging for it. Only a few sample rows are stored. Use it to check the price before you pay.

## Actor input object example

```json
{
  "queries": [
    "Apify",
    "web scraping"
  ],
  "types": [
    "story",
    "comment"
  ],
  "since": "30 days",
  "sort": "date",
  "minPoints": 0,
  "minComments": 0,
  "exactPhrase": false,
  "includeText": true,
  "maxItems": 500,
  "dryRun": false
}
```

# Actor output Schema

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

Stories and comments with points, comment counts, author, links and matched queries.

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

Counts and errors of the run.

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

// Run the Actor and wait for it to finish
const run = await client.actor("lost.fany/hacker-news-search-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": [
        "Apify",
        "web scraping",
    ] }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lost.fany/hacker-news-search-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/rjzkHtOvoscOD9Ohu/builds/UW8345w7yGSE12vsa/openapi.json
