# Hacker News Scraper - Stories, Comments & Search (No API Key) (`flash_scraper/hn-scraper`) Actor

Search all of Hacker News by keyword and export clean rows: type, title, url, author, points, comments, date, text, and the HN discussion link. Filter by tag (story/comment/Ask HN/Show HN), author, min points/comments, and recency. Sort by relevance or newest. Free Algolia HN Search API, no API key.

- **URL**: https://apify.com/flash\_scraper/hn-scraper.md
- **Developed by:** [Flash Scrape](https://apify.com/flash_scraper) (community)
- **Categories:** News, Social media, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 all of **Hacker News** by keyword and export clean, structured rows — stories, comments, Ask HN, Show HN and polls — ready for a spreadsheet, database, or your own app. Filter by tag, author, minimum points/comments and recency, and sort by relevance or newest first.

Powered by the free, official **Algolia Hacker News Search API** — **no API key, no login, no proxy required.**

***

### What you get

Each result is a flat row with these fields:

| Field | Description |
|-------|-------------|
| `type` | `story`, `comment`, `ask_hn`, `show_hn` or `poll` |
| `title` | Story/post title |
| `author` | Hacker News username |
| `points` | Score at time of fetch |
| `num_comments` | Number of comments |
| `created_at` | ISO timestamp |
| `url` | Outbound link (story URL) if any |
| `hn_url` | Direct link to the Hacker News discussion |
| `object_id` | Hacker News item ID |
| `story_id` | Parent story ID (for comments) |
| `text` | Full story/comment body (optional) |

***

### Example uses

- **Brand & product monitoring** — track every mention of your company, product, or competitor on HN.
- **Trend research** — pull the top stories about "AI agents", "web scraping", or "rust" over the last 30 days.
- **Dev marketing / launches** — watch Show HN and Ask HN for your niche.
- **Author tracking** — grab everything a specific user has posted.
- **Datasets for analysis** — export thousands of rows for sentiment, keyword, or timing analysis.

***

### Input

| Option | What it does |
|--------|--------------|
| **Search query** | Keywords to match (leave empty to fetch by tag/filter only) |
| **What to fetch** | Stories, Comments, Ask HN, Show HN, Polls, Front page, or Everything |
| **Sort by** | Relevance (best matches) or Newest first |
| **Author** | Restrict to one HN username |
| **Minimum points** | Keep only items with ≥ N points |
| **Minimum comments** | Keep only items with ≥ N comments |
| **Posted within (days)** | Keep only items from the last N days |
| **Include full text** | Include the story/comment body |
| **Max results** | How many items to return (1–5000) |

#### Example input

```json
{
  "query": "web scraping",
  "tags": "story",
  "searchType": "relevance",
  "minPoints": 50,
  "sinceDays": 365,
  "maxItems": 100
}
```

***

### Output sample

```json
{
  "type": "story",
  "title": "Show HN: I built a web scraper that never gets blocked",
  "author": "janedoe",
  "points": 412,
  "num_comments": 137,
  "created_at": "2025-11-02T14:11:09.000Z",
  "url": "https://example.com/scraper",
  "hn_url": "https://news.ycombinator.com/item?id=41888888",
  "object_id": "41888888",
  "story_id": null,
  "text": "..."
}
```

***

### Pricing

This Actor uses **pay-per-result**: you're charged only for the rows you actually receive. No monthly platform fees, no wasted compute.

***

### Notes

- Data comes from the public Algolia HN Search index, which HN updates continuously.
- `points` and `num_comments` reflect values at fetch time and change as threads grow.
- The Actor retries automatically on rate limits and transient errors, and paginates for you.

Built by **Flash Scrape** — clean, reliable, no-nonsense data Actors.

# Actor input Schema

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

Keywords to search for across Hacker News, e.g. 'apify', 'web scraping', 'your product name'. Leave empty to fetch by tag/filter only (e.g. newest stories).

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

Which kind of Hacker News item to return.

## `searchType` (type: `string`):

'Relevance' returns the best keyword matches; 'Newest' returns the most recent items first.

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

Restrict results to a single Hacker News username (exact, case-sensitive), e.g. 'pg'.

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

Only keep items with at least this many points (0 = no filter).

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

Only keep items with at least this many comments (0 = no filter).

## `sinceDays` (type: `integer`):

Only keep items posted in the last N days (0 = all time).

## `includeText` (type: `boolean`):

Include the story/comment body text in each row. Turn off for smaller rows.

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

Maximum number of items to return.

## Actor input object example

```json
{
  "query": "web scraping",
  "tags": "story",
  "searchType": "relevance",
  "minPoints": 0,
  "minComments": 0,
  "sinceDays": 0,
  "includeText": true,
  "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 = {
    "query": "web scraping"
};

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

# Run the Actor and wait for it to finish
run = client.actor("flash_scraper/hn-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": "web scraping"
}' |
apify call flash_scraper/hn-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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