# Hacker News Scraper (`properscraper/hacker-news-search-scraper`) Actor

Search Hacker News stories and comments by keyword, type, date, points and author. Uses the official Hacker News Search API, so it is fast and returns structured results.

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

from $0.10 / 1,000 item saveds

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

Search Hacker News and export the results. Give it keywords and it returns matching stories and comments with their points, comment counts, authors, dates and links.

It uses the official Hacker News Search API, so results are structured, fast, and not limited to what is on the front page today.

Use it to:

- monitor mentions of your product, company or competitors
- find the most discussed stories on a topic over any period
- collect Ask HN and Show HN posts, or job posts, for research
- gather comments on a subject for analysis

### Input

| Field | What it does |
|---|---|
| **Keywords** | One search per line. Leave empty to get everything of the chosen type, newest first. |
| **What to search** | Stories, comments, both, Ask HN posts, Show HN posts or job posts. |
| **Maximum items per search** | Stop after this many results for each line of keywords. Default 100. |
| **Order** | Newest first, or most relevant first. |
| **Posted from / Posted until** | Only items posted within this date range. |
| **Minimum points** | Only items with at least this many points. |
| **Minimum comments** | Only stories with at least this many comments. |
| **Author** | Only items posted by this username. |

```json
{
    "queries": ["apify", "web scraping"],
    "type": "story",
    "minPoints": 50,
    "dateFrom": "2026-01-01",
    "maxItemsPerQuery": 500
}
```

### Output

One record per story or comment:

```json
{
    "query": "web scraping",
    "id": "50350302",
    "type": "story",
    "storyType": null,
    "title": "AI agents hallucinate prices: LLM grounding with live data",
    "url": "https://blog.apify.com/llm-grounding-with-live-data/",
    "text": null,
    "author": "username",
    "points": 15,
    "commentCount": 0,
    "createdAt": "2026-11-03T10:41:28.000Z",
    "storyId": null,
    "storyTitle": null,
    "storyUrl": null,
    "parentId": null,
    "hnUrl": "https://news.ycombinator.com/item?id=50350302",
    "scrapedAt": "2026-11-11T20:30:00.000Z"
}
```

- `type` is `story`, `comment`, `job` or `poll`. `storyType` is `ask` or `show` for Ask HN and Show HN posts.
- `text` is the body of a comment or a text post, as plain text.
- For comments, `storyId`, `storyTitle` and `storyUrl` identify the story, and `parentId` the item replied to.
- `hnUrl` opens the item on Hacker News.

A `SUMMARY` record in the run's key-value store lists, for each search, how many items matched in total and how many were saved.

### Pricing

Pay per result. You are charged once for each story or comment saved to the dataset, at the per-result price shown on this page.

Searches that match nothing cost nothing. The run stops as soon as it reaches the maximum charge you set for it.

### Limits

- Newest-first searches can return any number of results. Most-relevant-first searches are limited to 1,000 results each by the API.
- Keyword search matches the title, text and link of an item. It is a text search, not an exact-phrase search.
- Points and comment counts are as of the time of the run.
- Searches run one after another with a short pause, to stay well within the API's limits.

### Is this allowed?

The Actor uses the official Hacker News Search API, which is provided for searching Hacker News programmatically, without logging in. Items are returned with the public username that posted them. You are responsible for how you use the data.

# Actor input Schema

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

One search per line, for example a product, company or topic. Leave empty to get everything of the chosen type, newest first.

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

The kind of Hacker News item to return.

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

Stop after this many results for each line of keywords.

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

Newest first can return any number of results. Most relevant first is limited to 1,000 per search.

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

Only return items posted on or after this date (YYYY-MM-DD).

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

Only return items posted on or before this date (YYYY-MM-DD).

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

Only return items with at least this many points. Use it to find stories that got attention.

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

Only return stories with at least this many comments.

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

Only return items posted by this Hacker News username.

## Actor input object example

```json
{
  "queries": [
    "open source"
  ],
  "type": "story",
  "maxItemsPerQuery": 100,
  "sortBy": "newest",
  "minPoints": 0,
  "minComments": 0
}
```

# Actor output Schema

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

Every story or comment saved by the run, one record each.

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

Totals for the run and, for each search, how many results were saved and any error.

# 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": [
        "open source"
    ]
};

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

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

```

## MCP server setup

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