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

Search Hacker News stories, comments, Ask HN, Show HN and front-page items by keyword, date range, minimum points or comments. Returns title, URL, author, points, comment count and timestamps. Public Algolia API, no login.

- **URL**: https://apify.com/literate\_universe/hacker-news-search-scraper.md
- **Developed by:** [John Rutherford](https://apify.com/literate_universe) (community)
- **Stats:** 2 total users, 1 monthly users, 80.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 item rows

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Hacker News Search Scraper

Search **Hacker News** stories, comments, Ask HN, Show HN, polls and jobs by keyword, date range, minimum points, minimum comments or author. Clean rows with title, link, HN discussion link, points, comment count and timestamps. Public Algolia API, no login.

For brand and competitor monitoring, developer-marketing research, sentiment tracking, link discovery and building datasets of tech discussion.

### What you get

One row per item:

| Field | Meaning |
|---|---|
| `object_id`, `type` | HN id and story / comment / ask\_hn / show\_hn / poll / job |
| `title`, `url`, `hn_url` | Headline, outbound link, discussion link |
| `author`, `points`, `num_comments`, `created_at` | Who, score, discussion size, when (ISO) |
| `text` | Story text or comment body as plain text |
| `story_id`, `parent_id` | Thread context for comments |
| `tags` | Raw HN tags |

Sample row:

```json
{
  "type": "story",
  "title": "Show HN: A faster way to scrape public APIs",
  "url": "https://example.com/post",
  "hn_url": "https://news.ycombinator.com/item?id=41234567",
  "author": "pg",
  "points": 312,
  "num_comments": 148,
  "created_at": "2026-09-01T14:22:10.000Z"
}
```

### Input

| Option | Default | What it does |
|---|---|---|
| **Search query** | | Keywords; empty lists everything matching the filters |
| **Item types** | Stories | Stories, comments, Ask HN, Show HN, front page, polls, jobs |
| **Sort by** | Relevance | Or newest first |
| **Since / Until** | | ISO date window |
| **Min points / Min comments** | 0 | Quality floor |
| **Author username** | | One user's items |
| **Max items** | 200 | Cap output |

Schedule it hourly with **Sort by = newest** and a brand keyword for a mention alert.

### Pricing

Pay per event: one small charge per item row.

### Notes and limits

- Algolia caps a single query at about 1,000 results per filter combination. Narrow the date window to go deeper.
- Comment text is plain text with HTML removed.

# Actor input Schema

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

Keywords to search for. Leave empty to list everything matching the other filters.

## `tags` (type: `array`):

Which kinds of items to return.

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

Relevance ranks by points and comments; date is newest first.

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

Optional, e.g. 2026-01-01.

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

Optional.

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

Skip items with fewer upvotes.

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

Skip items with fewer comments.

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

Only items by this HN user.

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

Stop after this many items.

## Actor input object example

```json
{
  "query": "web scraping",
  "tags": [
    "story"
  ],
  "sortBy": "relevance",
  "minPoints": 0,
  "minComments": 0,
  "maxItems": 200
}
```

# Actor output Schema

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

One row per story or comment. Append ?format=csv for CSV.

# 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 = {
    "query": "web scraping"
};

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

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

```

## MCP server setup

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