# Hacker News Scraper (`blazing_stake/hackernews-scraper`) Actor

Search and scrape Hacker News stories, comments and discussions via the official HN Algolia API. Filter by keyword, type, points, date. No API key.

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

## Pricing

$2.00 / 1,000 item scrapeds

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

Search and scrape **Hacker News** stories, comments, and discussions via the official HN Algolia API. Filter by keyword, content type, points, and date. Clean JSON, no API key.

### 🎯 What it does

- **Search** HN by keyword, or grab the latest front-page stories
- Filter by **content type**: stories, comments, Show HN, Ask HN, polls, jobs
- Filter by **minimum points** and sort by **relevance** or **date**
- Optionally fetch **top comments** for each story
- Returns: title, URL, author, points, comment count, text, timestamps, HN link

### 💡 Use cases

- **Tech trend monitoring** — track what's hot in a topic (AI, startups, a language)
- **Content research** — find top discussions for a keyword
- **Sentiment / opinion mining** — feed comments into LLMs
- **Competitor / product monitoring** — get alerted to mentions
- **Lead generation** — find founders and devs discussing a space
- **Dataset building** — collect HN data for analysis / ML

### 📥 Input

| Field | Type | Description |
|-------|------|-------------|
| `queries` | array | Search keywords (empty = front page) |
| `tags` | string | story / comment / show\_hn / ask\_hn / poll / job / front\_page |
| `sortBy` | string | relevance or date |
| `minPoints` | integer | Minimum points filter |
| `maxItems` | integer | Max items to scrape |
| `includeComments` | boolean | Fetch top comments per story |

#### Example input

```json
{
  "queries": ["artificial intelligence"],
  "tags": "story",
  "sortBy": "relevance",
  "minPoints": 100,
  "maxItems": 200
}
```

### 📤 Output

```json
{
  "objectID": "38912345",
  "title": "Show HN: I built an AI agent framework",
  "url": "https://example.com",
  "author": "pg",
  "points": 2346,
  "numComments": 951,
  "createdAt": "2026-07-01T12:00:00Z",
  "hnUrl": "https://news.ycombinator.com/item?id=38912345"
}
```

### ⚡ Performance

Uses the HN Algolia Search API directly — no browser, no API key, no quota. Blazing fast.

# Actor input Schema

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

Keywords to search Hacker News. Leave empty to get the latest/front-page stories.

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

What to search: story, comment, poll, show\_hn, ask\_hn, job, or front\_page.

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

relevance (best match + popularity) or date (newest first).

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

Only include stories with at least this many points (0 = no filter).

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

Maximum number of items to scrape across all queries.

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

Fetch top comments for each story (slower, more data).

## Actor input object example

```json
{
  "queries": [
    "startup",
    "rust programming"
  ],
  "tags": "story",
  "sortBy": "relevance",
  "minPoints": 0,
  "maxItems": 100,
  "includeComments": false
}
```

# Actor output Schema

## `results` (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": [
        "artificial intelligence"
    ]
};

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

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

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/XDZueTUA2vwV1FFXe/builds/h0GuxUiv0KQdYqNef/openapi.json
