# Hacker News Scraper — Stories, Comments & Ask HN by Keyword (`convertfleetdotonline/hacker-news-scraper`) Actor

Search and export Hacker News stories, comments, Ask HN, Show HN and polls by keyword. Points, author, comment counts, URLs & timestamps. Official public API — no login, no key, no proxy. JSON/CSV export.

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

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## 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 by Keyword

Search and export **Hacker News** content as clean structured data. Give it any
keyword and get back **stories, comments, Ask HN, Show HN and polls** with
points, author, comment counts, URLs and timestamps — ready for JSON, CSV,
Excel, Google Sheets or your database.

Built on Hacker News' **official public search API**, so it is fast, stable and
needs **no login, no API key and no proxy**.

### 🔍 What you can do

- Track every mention of a **product, company, competitor or topic** on Hacker News
- Pull the **front page** on a schedule for a news/monitoring dashboard
- Collect **Ask HN / Show HN** threads for product and market research
- Export **top comments** for sentiment and community analysis
- Feed Hacker News discussions into an **LLM / RAG** pipeline

### ⚙️ Input

```json
{
  "queries": ["openai", "rust"],
  "searchType": "story",
  "sortBy": "relevance",
  "maxItemsPerQuery": 100,
  "minPoints": 50
}
```

| Field | Description |
|---|---|
| `queries` | Keywords to search. Empty → current front page. |
| `searchType` | `story`, `comment`, `ask_hn`, `show_hn`, `poll` or `front_page`. |
| `sortBy` | `relevance` or `date` (newest first). |
| `maxItemsPerQuery` | 1–1000 items per query. |
| `minPoints` | Only items with at least this many points. |

### 📤 Output (one item per result)

```json
{
  "objectID": "38765432",
  "type": "story",
  "title": "Show HN: I built …",
  "url": "https://example.com",
  "author": "pg",
  "points": 512,
  "num_comments": 231,
  "text": null,
  "created_at": "2026-01-04T12:00:00.000Z",
  "hn_url": "https://news.ycombinator.com/item?id=38765432",
  "query": "openai"
}
```

### ❓ FAQ

**Do I need a Hacker News or Algolia account?**
No. This Actor uses the free public Hacker News search API — no key, no login.

**How fresh is the data?**
Real time. `sortBy: "date"` returns items the moment they are indexed.

**Can I get every comment on a thread?**
Use `searchType: "comment"` with the thread keyword, or search by the story
author. Very large threads are paginated automatically up to your item cap.

**How do I run it on a schedule?**
Use the built-in Apify Scheduler or call the run-sync API endpoint from Make,
Zapier, n8n or your own code.

### ⚖️ Disclaimer

Not affiliated with Y Combinator or Hacker News. Reads only publicly available
data via the official public API. You are responsible for how you use the data.

### 🔌 Integrations

Works with the Apify API, Scheduler, webhooks, Make, Zapier, n8n, Google Sheets and Slack.

# Actor input Schema

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

Keywords to search Hacker News for (e.g. "openai", "rust"). Leave empty to fetch the current front page.

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

Which Hacker News item type to return.

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

Rank by relevance, or return newest first.

## `maxItemsPerQuery` (type: `integer`):

Upper bound of items returned for each query (1–1000).

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

Only return stories/comments with at least this many points.

## Actor input object example

```json
{
  "queries": [
    "openai",
    "rust",
    "startup"
  ],
  "searchType": "story",
  "sortBy": "relevance",
  "maxItemsPerQuery": 100,
  "minPoints": 0
}
```

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

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

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

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/4XQuhdr5P5yMVhIQH/builds/QwEoI1Q28qm5jNuo8/openapi.json
