# Hacker News Scraper (`straightforward_hydra/hacker-news-scraper`) Actor

Search Hacker News by keyword, or pull the top / new / best / Ask / Show / Job story lists. Official HN + Algolia APIs, no key needed.

- **URL**: https://apify.com/straightforward\_hydra/hacker-news-scraper.md
- **Developed by:** [Dev D](https://apify.com/straightforward_hydra) (community)
- **Categories:** Jobs, Lead generation, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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/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 Hacker News by keyword, or pull the top / new / best / Ask HN / Show HN / Jobs lists. Official Hacker News + Algolia APIs, no key required.**

This Actor gets you clean, structured Hacker News data two ways: **keyword search** across stories and comments (with points, comments and date filters), or the live **story lists** (top, new, best, Ask, Show, Jobs). Great for brand and product monitoring, tech trend research, and building HN datasets.

> Uses the official Hacker News Firebase API and the Algolia HN Search API — no key, no login, no browser.

***

### What you can do with it

- 🔎 **Monitor mentions** — track your product, company or competitors on HN.
- 📈 **Spot trends** — search a topic and sort by points or date.
- 🗞️ **Mirror the front page** — pull top / new / best stories on a schedule.
- 💼 **Track HN jobs** — pull the "Who is hiring" / Jobs list.
- 🧵 **Research discussions** — search comments and Ask/Show HN threads.

### Features

- ✅ **No API key** — official public endpoints, works out of the box.
- ✅ **Keyword search** — stories, comments, Ask HN, Show HN, polls, or all.
- ✅ **Filters** — minimum points, minimum comments, created-after date.
- ✅ **Story lists** — top, new, best, Ask, Show, Jobs (up to 500 each).
- ✅ **Low-maintenance** — stable official APIs, one clean record per item.

***

### Input

#### Search mode

| Field | Description |
|---|---|
| **Search queries** | Keywords/phrases, e.g. `your product`, `rust`. |
| **What to match** | Stories / comments / Ask HN / Show HN / polls / all. |
| **Newest first** | Sort by date instead of relevance. |
| **Min points / comments** | Keep only items above a threshold. |
| **Created after** | Unix timestamp lower bound. |

#### Stories mode

| Field | Description |
|---|---|
| **Story lists** | top / new / best / ask / show / job. |
| **Stories per list** | How many from each (up to 500). |

#### Example — monitor recent mentions of a product

```json
{
  "mode": "search",
  "queries": ["Apify"],
  "searchType": "all",
  "sortByDate": true,
  "minPoints": 5
}
```

#### Example — today's top 50 stories

```json
{
  "mode": "stories",
  "storyLists": ["top"],
  "storiesPerList": 50
}
```

### Output

Each row is one story or comment:

```json
{
  "id": "38309611",
  "type": "story",
  "title": "OpenAI's board has fired Sam Altman",
  "url": "https://openai.com/blog/openai-announces-leadership-transition",
  "hn_url": "https://news.ycombinator.com/item?id=38309611",
  "author": "davidbarker",
  "points": 5710,
  "num_comments": 2530,
  "text": null,
  "created_at": "2023-11-17T20:28:50Z",
  "matched_query": "openai",
  "source": "search"
}
```

### Run it on a schedule

Schedule the Actor to search your keywords every hour and connect a **Slack / email / webhook / Google Sheets** integration to get alerted the moment you're mentioned on HN.

### Notes & limitations

- Uses the official Hacker News Firebase API and the Algolia HN Search API — no key needed.
- Search covers HN's full history; story lists reflect the current live ranking.
- `points` and `num_comments` are point-in-time values.
- This is public Hacker News data.

***

#### Keywords

Hacker News scraper, Hacker News API, HN scraper, Hacker News search, HN search API, Hacker News data, tech news scraper, brand monitoring, mention tracking, Hacker News comments, Ask HN, Show HN, Hacker News jobs, HN front page, Algolia HN, tech trends, startup news, Hacker News stories, social listening, news monitoring.

# Actor input Schema

## `mode` (type: `string`):

Search = keyword search over stories and comments. Stories = the live top/new/best/ask/show/job lists.

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

Search mode: keywords or phrases to search for, e.g. "your product", "kubernetes". One run per query.

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

Search mode: restrict to stories, comments, Ask HN, Show HN, or all.

## `sortByDate` (type: `boolean`):

Search mode: sort by date (newest first) instead of relevance. Best for monitoring new mentions.

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

Search mode: only keep items with at least this many points. Leave empty for all.

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

Search mode: only keep items with at least this many comments. Leave empty for all.

## `createdAfter` (type: `integer`):

Search mode: only keep items created after this Unix timestamp (seconds). Leave empty for all time.

## `storyLists` (type: `array`):

Stories mode: which live lists to pull.

## `storiesPerList` (type: `integer`):

Stories mode: how many stories to fetch from each list (lists hold up to 500).

## `maxResults` (type: `integer`):

Stop after this many items in total. Leave empty for no limit.

## Actor input object example

```json
{
  "mode": "search",
  "queries": [
    "openai"
  ],
  "searchType": "story",
  "sortByDate": false,
  "storyLists": [
    "top"
  ],
  "storiesPerList": 30
}
```

# 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("straightforward_hydra/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("straightforward_hydra/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 straightforward_hydra/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/7gn8cs6PCA5uQIxHR/builds/1jY2POBmz2iQEuvy0/openapi.json
