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

Search and export Hacker News stories, comments, Ask HN, Show HN and job posts: title, URL, points, comment count, author, date and text. Filter by front page, author, points and date range.

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

## Pricing

from $0.30 / 1,000 items

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 and export Hacker News (news.ycombinator.com) stories, comments, Ask HN, Show HN, job posts and polls to JSON, CSV or Excel. Filter by keyword, front page, author, minimum points, minimum comments and date range, and get the title, linked URL and domain, points, comment count, author, date and full text.

No login, API key or proxy needed.

### What you can use it for

- **Brand and product monitoring**: see every time your company, product or competitor is discussed on HN.
- **Launch tracking**: follow Show HN posts and their points and comments over time.
- **Tech trend research**: measure how often a technology is discussed by year or month.
- **Hiring and job research**: export job posts and "Who is hiring" comments.
- **Datasets for AI**: collect comment threads as clean text for analysis or model training.

### What data you get

| Field | Description |
|---|---|
| `id`, `type`, `hnUrl` | HN item ID, item type and discussion link |
| `title` | Story title (for comments, the parent story's title) |
| `url`, `domain` | The linked article and its domain |
| `author` | HN username |
| `points`, `numComments` | Score and number of comments |
| `createdAt` | Post time (ISO 8601) |
| `text` | Story text or comment as plain text |
| `storyId`, `parentId` | Thread context for comments |
| `isFrontPage`, `query`, `scrapedAt` | Front-page flag, matching query, scrape time |

### How to use it

1. Add **Search queries**, or leave them empty to list everything that matches your filters.
2. Pick the **Content type** (stories, comments, Ask HN, Show HN, jobs, polls or everything).
3. Choose the **Sort** and any filters: front page only, author, minimum points or comments, date range.
4. Click **Start** and export from the **Output** tab.

#### Example input

```json
{
  "queries": ["rust", "postgres"],
  "contentType": "story",
  "sortBy": "date",
  "minPoints": 50,
  "dateFrom": "2026-01-01",
  "maxItemsPerQuery": 500
}
```

Front page right now: leave queries empty, set **Front page only** and sort by date.

#### Example output

One record from a real run:

```json
{
  "query": "web scraping",
  "id": "22180559",
  "type": "story",
  "title": "Congrats! Web scraping is legal! (US precedent)",
  "url": "https://parsers.me/us-court-fully-legalized-website-scraping-and-technically-prohibited-it/",
  "domain": "parsers.me",
  "author": "ehurynovich",
  "points": 1057,
  "numComments": 388,
  "createdAt": "2020-01-29T14:06:37.000Z",
  "text": null,
  "storyId": "22180559",
  "parentId": null,
  "hnUrl": "https://news.ycombinator.com/item?id=22180559",
  "isFrontPage": false,
  "scrapedAt": "2026-11-12T17:07:43.468Z"
}
```

### Pricing

Pay per event: **$0.30 per 1,000 items** saved, plus a tiny standard start fee and Apify platform usage (usually a fraction of a cent per run). Set **Max cost per run** to cap spending.

### Tips and limits

- Each query returns up to 1,000 items. To go further, split by date range (for example one run per month) or use more specific queries.
- Points and comment counts are refreshed by the search index regularly, so very recent posts may lag a little.
- A `RUN_SUMMARY` record shows total matches and items saved per query.

### FAQ

**Is this the official Hacker News API?** It uses the public HN Search API by Algolia, which indexes all Hacker News items and supports full-text search and filters.

**Can I monitor new posts that mention my product?** Yes. Schedule it daily with **Newest first** and a recent **Posted on or after** date.

### Legal note

This Actor reads public Hacker News data through the public HN Search API. Use the data in line with Hacker News' guidelines, privacy laws and your own legitimate purpose.

# Actor input Schema

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

Keywords to search on Hacker News. Leave empty to list items that match the filters below, for example today's front page.

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

Which kind of Hacker News item to return.

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

Relevance (popular items first) or date (newest first).

## `frontPageOnly` (type: `boolean`):

Only items that are currently on the Hacker News front page.

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

Optional. Only items posted by this Hacker News user, for example pg or dang.

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

Optional. Only stories with at least this many points.

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

Optional. Only stories with at least this many comments.

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

Optional date, YYYY-MM-DD.

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

Optional date, YYYY-MM-DD.

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

Up to 1,000 per query. Split long date ranges into several runs to collect more.

## Actor input object example

```json
{
  "queries": [
    "web scraping"
  ],
  "contentType": "story",
  "sortBy": "relevance",
  "frontPageOnly": false,
  "maxItemsPerQuery": 50
}
```

# Actor output Schema

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

No description

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

No description

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

No description

# 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"
    ]
};

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

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

```

## MCP server setup

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