# Hacker News Scraper — Stories, Points & Search (`eins332570/hackernews-scraper`) Actor

Scrape Hacker News — top/new/best/ask/show stories, points, comment counts & full-text search — via official Firebase & Algolia APIs. Fetch live lists, search by keyword, or look up items by ID. Great for tech-trend monitoring & content research. No login, no key, no proxy.

- **URL**: https://apify.com/eins332570/hackernews-scraper.md
- **Developed by:** [thanachit singruang](https://apify.com/eins332570) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

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 Scraper — Stories, Points & Search

Scrape **Hacker News** data — stories, points, authors, and comment counts — into **one unified dataset** using the **official Firebase API** (live lists) and the **Algolia HN Search API** (full-text search). No login, no proxies, no browser, no API key.

Pull the live front page (top / new / best / ask / show / job), search the entire HN archive by keyword, or look up specific items by ID.

### What you get

Every story is returned as one row (`recordType: "story"`):

| Field | Description |
|---|---|
| `itemId` | HN item ID |
| `type` | story / comment / job / poll |
| `title` | story title |
| `url` | linked article URL (null for text posts) |
| `author` | submitter username |
| `points` | score / upvotes |
| `numComments` | number of comments |
| `createdAt` | ISO timestamp |
| `text` | body text for Ask HN / text posts |
| `hnUrl` | link to the HN discussion |
| `dead` / `deleted` | moderation flags |

### Input

```json
{
  "lists": ["top"],
  "search": ["rust"],
  "itemIds": ["8863"],
  "limit": 30,
  "sortByDate": false,
  "tags": "story"
}
```

- **lists** — live lists to fetch: `top`, `new`, `best`, `ask`, `show`, `job`.
- **search** — keywords to full-text search HN (Algolia).
- **itemIds** — specific HN item IDs to fetch.
- **limit** — max stories per list/search (1–500).
- **sortByDate** — for search, return newest instead of most relevant.
- **tags** — Algolia tag filter (`story`, `comment`, `show_hn`, `ask_hn`, `poll`).

Provide at least one of `lists`, `search`, or `itemIds`. Stories found across multiple sources are de-duplicated by item ID.

### Sample output

One dataset row (a story from the front page):

```json
{
  "recordType": "story",
  "itemId": "49395628",
  "type": "story",
  "title": "There's no reason for software to be slow anymore",
  "url": "https://danluu.com/perf-opt/",
  "author": "Jach",
  "points": 185,
  "numComments": 146,
  "createdAt": "2026-08-22T01:06:17.000Z",
  "text": null,
  "hnUrl": "https://news.ycombinator.com/item?id=49395628",
  "dead": false,
  "deleted": false
}
```

### Why it's reliable & cheap

Every request hits an **official public HN API** (Firebase for live data, Algolia for search) — no headless browser, no anti-bot walls, no API key. Transient errors (rate limits, 5xx, network blips) are retried automatically, and an unreachable source is reported and skipped — one bad source never fails the whole run.

### Use cases

- **Tech-trend monitoring** — track what's rising on the front page or by keyword
- **Content & competitive research** — find every HN discussion about a product or topic
- **Sentiment & discussion mining** — feed titles and text into an NLP pipeline
- **Growth & PR** — get notified when your company or project hits HN

### FAQ

**Do I need an API key or login?** No. It uses the official public Hacker News Firebase API and the Algolia HN Search API — no key, no account, no proxy.

**Is it free to try?** Yes — click **Try for free** and run the prefilled top-stories list in seconds.

**Can I search old stories, not just the front page?** Yes — `search` queries the entire HN archive via Algolia; `lists` pull the live front page.

**Can I get comments?** Search with `tags: "comment"` to return comment records; every story also carries its comment count.

**Is this allowed?** Both APIs are official, public, and key-free — built for exactly this kind of use.

### Pricing

**Pay per result — $5 per 1,000 stories.** Runs that return nothing cost nothing. No monthly fee, no proxy costs.

# Actor input Schema

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

Front-page style lists to fetch, from: top, new, best, ask, show, job. Each returns up to `limit` live stories.

## `search` (type: `array`):

Full-text search Hacker News (via the Algolia HN Search API). Each query returns up to `limit` matching stories. Example: \["rust", "llm"].

## `itemIds` (type: `array`):

Fetch specific HN items by ID (the number in news.ycombinator.com/item?id=<id>).

## `limit` (type: `integer`):

Cap the number of stories per list or search query (1–500).

## `sortByDate` (type: `boolean`):

For search queries, return the most recent stories instead of the most relevant.

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

Algolia tag filter for search queries (e.g. story, comment, show\_hn, ask\_hn, poll).

## Actor input object example

```json
{
  "lists": [
    "top"
  ],
  "limit": 30,
  "sortByDate": false,
  "tags": "story"
}
```

# Actor output Schema

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

All scraped story records as dataset items.

# 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 = {
    "lists": [
        "top"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("eins332570/hackernews-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 = { "lists": ["top"] }

# Run the Actor and wait for it to finish
run = client.actor("eins332570/hackernews-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 '{
  "lists": [
    "top"
  ]
}' |
apify call eins332570/hackernews-scraper --silent --output-dataset

```

## MCP server setup

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