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

Hacker News scraper and search: stories, comments, Ask HN, Show HN and jobs by keyword, author, points and date, or export full comment threads. Official HN Algolia API, no login, no proxy. Great for brand monitoring.

- **URL**: https://apify.com/tomstudio/hacker-news-search.md
- **Developed by:** [Tom Studio](https://apify.com/tomstudio) (community)
- **Categories:** News, Social media, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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 - Search Stories, Comments & Threads

Search **Hacker News** (news.ycombinator.com) for any keyword and export **stories, comments, Ask HN, Show HN, jobs and polls** with title, URL, text, author, points, comment count and date. Or paste story URLs to export **full comment threads** (with parent and depth).

Uses the **official HN Algolia API** - no login, no proxy, no browser. Fast and very cheap. The Actor walks back in time automatically, so you can go **beyond Algolia's 1,000 results per query**.

### Use cases

- **Brand & competitor monitoring**: get every mention of your product on HN. Schedule daily with `lastDays: 1` + `onlyNew: true` and send results to Slack / email via Apify integrations.
- **Launch tracking**: export the full comment thread of your Show HN.
- **Market research & AI datasets**: collect developer opinions on a technology (e.g. "rust", "postgres").
- **Recruiting / leads**: export "job" posts and Who's Hiring comments.

### Input example

```json
{
  "queries": ["apify", "web scraping"],
  "types": ["story", "comment"],
  "lastDays": 30,
  "minPoints": 5,
  "maxItems": 500,
  "storyIds": ["https://news.ycombinator.com/item?id=1"]
}
```

`minPoints` / `minComments` apply to stories (comments have no points in the API).

### Output sample

```json
{
  "id": "50107586",
  "type": "story",
  "title": "Show HN: ...",
  "url": "https://example.com",
  "text": null,
  "author": "someuser",
  "points": 42,
  "numComments": 17,
  "createdAt": "2026-10-15T09:12:00Z",
  "hnUrl": "https://news.ycombinator.com/item?id=50107586",
  "query": "apify"
}
```

Export to JSON, CSV, Excel, Google Sheets, or call via API. Questions? Open an issue on the Actor page.

### Who is this for?

Founders and marketers tracking mentions of their product, developer-relations teams, researchers building datasets of developer opinion, and recruiters reading "Who is hiring" threads.

### FAQ

**Do I need an API key?** No. It uses the public HN Algolia API.
**Can I monitor my brand daily?** Yes: `queries: ["yourbrand"]`, `lastDays: 1`, `onlyNew: true`, plus an Apify schedule.
**How do I export a whole discussion?** Put the story URLs in `storyIds` to get every comment with parent and depth.
**Is there a 1,000 results limit?** Algolia caps one query at 1,000; the Actor walks back in time to go further.
**Can it post or vote?** No, read-only.

### More free tools by tomstudio

- [ATS Jobs Scraper (Workday, Greenhouse, Lever, Ashby...)](https://apify.com/tomstudio/ats-jobs-scraper)
- [TED Tenders Monitor (EU & Swiss public procurement)](https://apify.com/tomstudio/ted-tenders-monitor)
- [SEC EDGAR Filings Monitor](https://apify.com/tomstudio/sec-edgar-filings-monitor)
- [Domain Availability & RDAP Bulk Checker](https://apify.com/tomstudio/domain-rdap-bulk-checker)
- [App Store Reviews Scraper](https://apify.com/tomstudio/app-store-reviews-scraper)
- [Hacker News Search & Comments](https://apify.com/tomstudio/hacker-news-search)
- [Wayback Machine Snapshots](https://apify.com/tomstudio/wayback-machine-snapshots)
- [RSS & Atom Feed Reader](https://apify.com/tomstudio/rss-feed-reader)
- [YouTube Transcript Scraper](https://apify.com/tomstudio/youtube-transcript-scraper)

# Actor input Schema

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

Keywords to search (e.g. your brand, product or competitor). Leave empty and use 'storyIds' to export threads.

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

What to search. Default: stories and comments.

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

Newest first, or Algolia relevance (popular first).

## `lastDays` (type: `integer`):

Optional time window (e.g. 1 for daily alerts).

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

Only items with at least this many points.

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

Only stories with at least this many comments.

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

Optional: only items by this HN user.

## `exactMatch` (type: `boolean`):

Recommended for brand names - avoids fuzzy matches like 'akify' for 'apify'.

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

e.g. https://news.ycombinator.com/item?id=1 - exports the story and every comment (with depth and parent).

## `onlyNew` (type: `boolean`):

Remembers returned items (named key-value store) - use with a schedule for alerts.

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

Maximum items per query (Algolia returns max 1,000 per query; the Actor walks back in time to get more).

## Actor input object example

```json
{
  "queries": [
    "apify"
  ],
  "types": [
    "story",
    "comment"
  ],
  "sortBy": "date",
  "exactMatch": true,
  "storyIds": [],
  "onlyNew": false,
  "maxItems": 200
}
```

# Actor output Schema

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

All results (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": [
        "apify"
    ],
    "storyIds": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("tomstudio/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": ["apify"],
    "storyIds": [],
}

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

```

## MCP server setup

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