# Hacker News Topic Intelligence (`forgelabs/hacker-news-topic-intelligence`) Actor

Type any topic and get the most-discussed Hacker News stories ranked by engagement and velocity, with top comments, demand signals (people asking for tools) and domain leaderboards. Monitor mode returns only new stories. Flat CSV, official APIs.

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

## Pricing

Pay per event

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 Topic Intelligence

**Type a topic and get the Hacker News stories people actually argued about, ranked, with the top comments next to each one.** No story IDs, no API code. Leave the default input as it is and you get the 30 most-discussed "AI agents" stories from the last 30 days in about 15 seconds.

### What you get (real output, Oct 15 2026, default input)

| Rank | Story | Points | Comments | Points/hour | Domain |
|---|---|---|---|---|---|
| 1 | Feds Target AI Critics as "Foreign Agents" | 396 | 457 | 0.75 | kenklippenstein.com |
| 2 | AI coding agents generate more code, but not more software | 364 | 310 | 4.45 | arstechnica.com |
| 3 | There are no "rogue" AI agents | 396 | 269 | 0.89 | eoinhiggins.substack.com |
| 4 | Early rogue AI agent activity and attempts to hack found on urlquery.net | 267 | 313 | 0.51 | transluce.org |
| 5 | Nvidia wants to put a watchdog chip next to every AI agent | 230 | 298 | 0.55 | cnbc.com |

Each row also has the **top 3 comments in HN's own ranking order**, as flat columns. For example, the top comment on story #2:

> "This is from March 2026, but it does match what I've encountered professionally. Code review was always a significant bottleneck and is even more so with agentic coding…"

You also get a plain-text **SUMMARY** report in the key-value store: top stories, demand signals and the domains that get shared most.

### Why this one

| | This Actor | Typical HN scrapers |
|---|---|---|
| Search by any topic, ranked by engagement | ✅ points + 2× comments, or by velocity | Usually front page or keyword list only |
| Top comments in the same row (CSV-ready) | ✅ | Separate comment dumps or none |
| Velocity (points per hour) to spot rising stories | ✅ | ❌ |
| Demand signals: "is there a tool…", "alternatives to…", Ask HN questions | ✅ flagged per row | ❌ |
| Monitor mode: only stories you haven't seen | ✅ | Rare |
| Precise title matching or broad matching | ✅ | ❌ |
| Official public APIs only (Algolia HN Search + HN Firebase) | ✅ | Varies |

### Use cases

- **Founders and PMs**: see which pains people complain about, mine Ask HN for "is there a tool for X" requests, and validate ideas before you build.
- **Marketers and DevRel**: find which domains and angles get traction for your topic, and track mentions of your product or competitors on a schedule.
- **Investors and analysts**: weekly trend reports on any technology, with the real sentiment from comments.
- **AI agents and RAG**: clean, flat JSON from one call, so it works well as an MCP or agent tool.

### Input

| Field | Default | What it does |
|---|---|---|
| `topics` | `["AI agents"]` | One ranked list per topic (a product, company, domain or keyword) |
| `daysBack` | 30 | Time window |
| `maxStoriesPerTopic` | 30 | Top N after ranking |
| `sortBy` | engagement | engagement, points, comments, velocity or newest |
| `matchIn` | title | `title` is precise; `everywhere` also searches story text and URLs |
| `storyTypes` | all | Limit to `ask_hn` to mine questions, or `show_hn` to track launches |
| `topCommentsPerStory` | 3 | 0 to 10 (0 is cheaper) |
| `minPoints` | 5 | Drops noise |
| `onlyNewSinceLastRun` | false | Monitor mode. Schedule it daily to get only new stories |

### Pricing (pay per result)

- Story with top comments: **$2.00 per 1,000** ($0.002 each)
- Story without comments: **$1.00 per 1,000**

The default run (30 stories with comments) costs about **$0.06**. A daily monitor of 3 topics at roughly 20 new stories a day comes to about **$3.60 a month**. You never pay for empty runs or errors.

### Output fields

`rank, topic, title, storyType, points, comments, engagementScore, pointsPerHour, commentToPointRatio, demandSignal, url, domain, hnUrl, author, createdAt, ageHours, storyText, topComment1..N, topComment1By..N, storyId`

### API / MCP

```bash
curl -X POST "https://api.apify.com/v2/acts/forgelabs~hacker-news-topic-intelligence/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" -d '{"topics":["Postgres","SQLite"],"daysBack":7}'
```

You can also call it from any MCP client through Apify's MCP server (`mcp.apify.com`).

### FAQ

**Is this allowed?** Yes. It uses only the official public Hacker News APIs (hn.algolia.com and hacker-news.firebaseio.com). No login and no scraping of HTML pages.
**How is `demandSignal` computed?** A phrase heuristic ("is there a tool", "looking for", "alternatives to", "I'd pay"…) applied to the title and text, plus Ask HN questions. Treat it as a filter that helps you find candidates, not as ground truth.
**Why fewer stories than I asked for?** Only stories matching your topic inside the time window, and above `minPoints`, are returned. Widen `daysBack`, lower `minPoints` or set `matchIn` to `everywhere`.

# Actor input Schema

## `topics` (type: `array`):

Any topics, products, companies or keywords. Each gets its own ranked list, e.g. "AI agents", "Postgres", "your-competitor.com".

## `daysBack` (type: `integer`):

Only stories posted within this many days.

## `maxStoriesPerTopic` (type: `integer`):

Top N stories after ranking.

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

How to rank stories.

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

Filter out low-signal stories.

## `storyTypes` (type: `array`):

Pick Ask HN only to mine questions and pain points, or Show HN only to track launches.

## `topCommentsPerStory` (type: `integer`):

Top-ranked comments (HN's own order) added as flat columns. 0 = none (cheaper, faster).

## `onlyNewSinceLastRun` (type: `boolean`):

Schedule this Actor and get only stories you have not received before.

## `monitorStateName` (type: `string`):

Use different names to run independent monitors.

## `matchIn` (type: `string`):

Titles-only gives precise, on-topic results; broad also matches story text and URLs.

## Actor input object example

```json
{
  "topics": [
    "AI agents"
  ],
  "daysBack": 30,
  "maxStoriesPerTopic": 30,
  "sortBy": "engagement",
  "minPoints": 5,
  "storyTypes": [
    "story",
    "ask_hn",
    "show_hn"
  ],
  "topCommentsPerStory": 3,
  "onlyNewSinceLastRun": false,
  "monitorStateName": "hn-intel-state",
  "matchIn": "title"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `discussion` (type: `string`):

No description

## `summary` (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 = {
    "topics": [
        "AI agents"
    ],
    "daysBack": 30,
    "maxStoriesPerTopic": 30,
    "topCommentsPerStory": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("forgelabs/hacker-news-topic-intelligence").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 = {
    "topics": ["AI agents"],
    "daysBack": 30,
    "maxStoriesPerTopic": 30,
    "topCommentsPerStory": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("forgelabs/hacker-news-topic-intelligence").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 '{
  "topics": [
    "AI agents"
  ],
  "daysBack": 30,
  "maxStoriesPerTopic": 30,
  "topCommentsPerStory": 3
}' |
apify call forgelabs/hacker-news-topic-intelligence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,forgelabs/hacker-news-topic-intelligence"
        }
    }
}
```

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/ptgBWsdIDwFQQtJ7z/builds/qv1kpjP8EuspIgKL2/openapi.json
