# Hacker News Scraper | Stories, Comments, Ask & Show HN (`muzafferkadir/hacker-news-scraper`) Actor

Scrape Hacker News by keyword: stories, comments, Ask HN, Show HN, or the front page. Points, author, date, URL. Official Algolia API, no API key.

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

## Pricing

from $0.50 / 1,000 items

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?

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

Scrape **Hacker News** by keyword — **stories, comments, Ask HN, Show HN, and the front page** — with points, author, date, and URL. Built on the **official HN Algolia API**: no API key or setup needed.

Search a topic, a company, or your product name and get a clean, structured feed you can export to CSV, Excel, or JSON — great for tech trend research and mention monitoring.

### Features

- **Official, unlimited source** — reads the public HN Algolia search API.
- **Everything on HN** — stories, comments, Ask HN, Show HN, polls, or the live front page.
- **Powerful filters** — sort by relevance or newest, and keep only items above a points threshold.
- **Mention monitoring** — schedule it on your brand or product name and catch every HN discussion.

### Use cases

- **Tech & startup trend research** — track what's trending on any topic over time.
- **Brand / product monitoring** — get every HN story and comment mentioning you (great for "Show HN" feedback).
- **Investor deal-sourcing** — follow Show HN launches and Ask HN threads.
- **Datasets** — build HN text datasets for analysis or LLM pipelines.

### Input

| Field | Type | Description |
| --- | --- | --- |
| `searchQueries` | string\[] | Keywords to search. Leave empty with `tag: front_page` for the front page. |
| `tag` | enum | `story`, `comment`, `ask_hn`, `show_hn`, `poll`, or `front_page`. |
| `sortBy` | enum | `relevance` or `date` (newest first). |
| `minPoints` | integer | Keep only items with at least this many points. |
| `maxItems` | integer | Max items per query. Default 100. |

#### Example

```json
{
  "searchQueries": ["AI agents", "vector database"],
  "tag": "story",
  "sortBy": "relevance",
  "minPoints": 50,
  "maxItems": 200
}
```

### Output

```json
{
  "objectId": "13663751",
  "type": "story",
  "title": "The Rust Programming Language, 2nd Edition",
  "url": "https://doc.rust-lang.org/book/",
  "author": "nanxor",
  "points": 346,
  "numComments": 108,
  "text": null,
  "createdAt": "2026-02-01T10:00:00Z",
  "hnUrl": "https://news.ycombinator.com/item?id=13663751",
  "query": "rust programming",
  "scrapedAt": "2026-08-11T19:00:00.000Z"
}
```

Download the dataset as **JSON, CSV, Excel, or XML**, or pull it via the Apify API.

### Pricing

Pay-per-event: **$0.01 per run start** (per GB of run memory) plus **$0.50 per 1,000 items**. You only pay for items actually returned. See the **Pricing** tab for current rates.

### FAQ

**Do I need an API key?**
No. This Actor uses the public HN Algolia API — no key, no auth.

**How do I get the front page?**
Set `tag` to `front_page` and leave `searchQueries` empty.

**Can I get a story's comments?**
Set `tag` to `comment` and search — or filter by a story to follow its discussion.

**Can I monitor mentions of my product?**
Yes — schedule the Actor with your product name as the query and `sortBy: date`.

### Disclaimer

This is an **unofficial** Actor. It is not affiliated with or endorsed by Y Combinator or Hacker News. It uses the public HN Algolia API and returns publicly available content. You are responsible for how you use the data.

# Actor input Schema

## `searchQueries` (type: `array`):

Keywords to search. Leave empty and set Tag to "front_page" to get the current front page.

## `tag` (type: `string`):

Which kind of item to fetch: stories, comments, Ask HN, Show HN, polls, or the front page.

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

Order results by search relevance or by newest first.

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

Keep only items with at least this many points.

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

Stop after this many items for each query.

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

Optional. Leave empty for most runs.

## Actor input object example

```json
{
  "searchQueries": [
    "AI agents"
  ],
  "tag": "story",
  "sortBy": "relevance",
  "maxItems": 100
}
```

# 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 = {
    "searchQueries": [
        "AI agents"
    ],
    "tag": "story",
    "sortBy": "relevance",
    "minPoints": 0,
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("muzafferkadir/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 = {
    "searchQueries": ["AI agents"],
    "tag": "story",
    "sortBy": "relevance",
    "minPoints": 0,
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("muzafferkadir/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 '{
  "searchQueries": [
    "AI agents"
  ],
  "tag": "story",
  "sortBy": "relevance",
  "minPoints": 0,
  "maxItems": 100
}' |
apify call muzafferkadir/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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