# Hacker News Scraper — Stories, Comments, Ask/Show HN (`hipersoft/hacker-news-scraper`) Actor

Scrape Hacker News stories, comments, Ask HN, Show HN, jobs and polls by keyword, points, comments and date range. Sort by relevance or newest. Title, URL, author, points, comment count, text and HN link. Fast clean HTTP via the HN Algolia API, no key.

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

## Pricing

from $0.004 / item scraped

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/platform/actors/running/actors-in-store#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, Comments & Ask/Show HN, No Key, Clean JSON

Scrape Hacker News by keyword and filters and get back clean, structured JSON — title, URL, author, points, comment count, text, timestamps and the HN item link. Fetch stories, comments, Ask HN, Show HN, jobs, polls or the front page, filtered by points, comments and date range, sorted by relevance or newest. It runs on the public HN Algolia API over fast, plain HTTP. No account, no API key. Built for researchers, trend trackers and anyone mining HN discussion at scale.

### Features

- 🗂️ **Every content type** — `tags` selects Stories, Comments, Ask HN, Show HN, Polls, Jobs or Front page.
- 🔎 **Keyword or filter-only** — set a `query`, or leave it empty and list purely by tag and filters.
- 📊 **Threshold filters** — `minPoints` and `minComments` keep only items that cleared a bar.
- 📅 **Date range** — `dateFrom` and `dateTo` (ISO or `YYYY-MM-DD`) scope results to a window.
- 🔀 **Sort your way** — `sortBy` toggles relevance (best match) or date (newest first).
- 🧹 **Clean text** — HTML and entities in story/comment bodies are stripped and decoded into readable `text`.
- ⚡ **Fast, keyless HTTP** — paginates the HN Algolia API automatically, up to `maxItems`.

### What you get

Every item becomes one clean JSON record:

```json
{
  "type": "story",
  "id": "40912345",
  "title": "Show HN: I built a Rust-based log parser",
  "url": "https://example.com/rust-log-parser",
  "author": "pg_user",
  "points": 284,
  "numComments": 96,
  "text": null,
  "storyId": null,
  "parentId": null,
  "createdAt": "2026-07-20T15:04:00.000Z",
  "hnUrl": "https://news.ycombinator.com/item?id=40912345",
  "tags": ["story", "show_hn"]
}
```

### Input

```json
{
  "query": "rust",
  "tags": "story",
  "sortBy": "date",
  "minPoints": 50,
  "minComments": 10,
  "maxItems": 200
}
```

| Field | Description |
| --- | --- |
| `query` | Keyword to search. Leave empty to list by tag/filters only (e.g. all front-page stories). |
| `tags` | What to fetch: Stories, Comments, Ask HN, Show HN, Polls, Jobs or Front page. |
| `sortBy` | Relevance (best match) or date (newest first). |
| `minPoints` / `minComments` | Only items with at least this many points / comments. |
| `dateFrom` / `dateTo` | ISO date or `YYYY-MM-DD` lower / upper bound. |
| `maxItems` | Max items to return. |

### Use cases

- Track how a topic (a framework, a company, a trend) is discussed on HN over time.
- Pull all high-scoring Show HN or Ask HN posts in a date range for a newsletter.
- Mine top comments on a story for sentiment or research.
- Build a dataset of front-page stories with points and comment counts.

### Pricing

Pay-per-event: you're billed a small amount per run and per item scraped — you only pay for what you get. See the **Pricing** tab for current rates.

### FAQ

**Do I need a Hacker News account or API key?**
No. The actor runs on the public [Hacker News](https://news.ycombinator.com/) Algolia Search API over plain HTTP — no account, login or API key.

**How many items can I scrape per run?**
As many as you set with `maxItems`. The actor paginates the Algolia API automatically until it reaches your limit.

**What content types can I fetch?**
Use `tags` to select Stories, Comments, Ask HN, Show HN, Polls, Jobs or the Front page. Leave `query` empty to list purely by tag and filters.

**What's the output format?**
Structured JSON — one record per item with `type`, `title`, `url`, `author`, `points`, `numComments`, cleaned `text`, timestamps, `tags` and the `hnUrl` item link. Export as JSON, CSV, Excel or via the API.

**Can I filter by points, comments or date?**
Yes. Use `minPoints` and `minComments` for thresholds, `dateFrom` / `dateTo` (ISO or `YYYY-MM-DD`) for a window, and `sortBy` to switch between relevance and newest-first.

### Related Actors

Tracking developer discussion and trends? Combine this with our other developer-data scrapers:

- [Stack Overflow & Stack Exchange Scraper](https://apify.com/hipersoft/stackexchange-scraper) — questions by tag or search across Stack Exchange sites.
- [GitHub Scraper](https://apify.com/hipersoft/github-scraper) — repositories and user profiles with stars, topics, licenses and leads.
- [Wikipedia Scraper](https://apify.com/hipersoft/wikipedia-scraper) — full article text, summaries and pageviews in any language.
- [npm Package Scraper](https://apify.com/hipersoft/npm-scraper) — search and look up npm packages with metadata, dependencies and downloads.

### Notes

This Actor uses the public Hacker News Algolia Search API. It is an independent tool and is not affiliated with, endorsed by, or sponsored by Y Combinator or Algolia; "Hacker News" is a trademark of its respective owner.

# Actor input Schema

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

Keyword to search. Leave empty to list by tag/filters only (e.g. all front-page stories).

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

What to fetch.

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

Relevance (best match) or date (newest first).

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

Only items with at least this many points.

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

Only items with at least this many comments.

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

ISO date or YYYY-MM-DD lower bound.

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

ISO date or YYYY-MM-DD upper bound.

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

Max items to return.

## `proxyConfiguration` (type: `object`):

Optional. The HN Algolia API works without a proxy.

## Actor input object example

```json
{
  "tags": "story",
  "sortBy": "relevance",
  "minPoints": 0,
  "minComments": 0,
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

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

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

# Run the Actor and wait for it to finish
run = client.actor("hipersoft/hacker-news-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": ""
}' |
apify call hipersoft/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=hipersoft/hacker-news-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/TALZT0t06JtlW2MU2/builds/LZVKn0SgTlYOF5eNy/openapi.json
