# Hacker News Trends — Topic, Engagement & Viral-Story Analytics (`nexgendata/hacker-news-scraper`) Actor

Analyze Hacker News and surface what's trending. Clean JSON analytics — story counts, average and top scores, topic and domain breakdowns, engagement tiers, top authors, and current viral stories with plain-English insights. No API key. Pay per record.

- **URL**: https://apify.com/nexgendata/hacker-news-scraper.md
- **Developed by:** [NexGenData](https://apify.com/nexgendata) (community)
- **Categories:** Social media, Marketing, News
- **Features:** Limited permissions
- **Stats:** 51 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $50.00 / 1,000 story records

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 & Tech Trend Tracker

Hacker News Trends is a NexGenData tool on Apify that returns story, topic, domain and engagement analytics from Hacker News.

Extract stories and metadata from Hacker News' official Firebase API, with
optional trend enrichment — engagement velocity, topic classification, domain
breakdown — and structured JSON straight into an Apify dataset.

### 📊 Sample Output

![6 real rows delivered by Hacker News Trends — Topic, Engagement & Viral-Story Analytics — run cTGy3X4g68kSEPARS on build 0.0.21](https://api.apify.com/v2/key-value-stores/8gLgXMBveEI1tTz1z/records/hacker-news-scraper-sample)

| `id` | `title` | `url` | `hnUrl` | `author` | `time` |
|---|---|---|---|---|---|
| 49831968 | F-Droid 2.0 | https://f-droid.org/2026/09/24/f-droid-2.0-a-new-chapter-for-android-… | https://news.ycombinator.com/item?id=49831968 | daveoc64 | 1790263572 |
| 49823738 | Show HN: Make cursed fonts like Times New Bastard | https://bastardica.mitpit.com | https://news.ycombinator.com/item?id=49823738 | MitPitt | 1790204008 |
| 49833867 | Show HN: Whiteboard (YC W26) – An open-source IDE for thoughtful soft… | https://github.com/devdotfast/whiteboard | https://news.ycombinator.com/item?id=49833867 | sidharthkmenon | 1790270496 |
| 49832938 | Why is the liver so weirdly regenerative? | https://dynomight.substack.com/p/liver | https://news.ycombinator.com/item?id=49832938 | jbotz | 1790266980 |
| 49800085 | Fearless SIMD v1.0 | https://linebender.org/blog/fearless-simd-1-0/ | https://news.ycombinator.com/item?id=49800085 | verdagon | 1790079817 |
| 49801436 | 2DWillNeverDie | https://2dwillneverdie.com/ | https://news.ycombinator.com/item?id=49801436 | surprisetalk | 1790085608 |

Real rows from run `cTGy3X4g68kSEPARS` on build 0.0.21 (2026-09-25), unedited apart from masked emails/phones and shortened long text; fields the source does not publish are empty.

### 🧾 JSON sample record

One real record from run `cTGy3X4g68kSEPARS` (emails/phones masked, long text shortened):

```json
{
  "id": 49831968,
  "title": "F-Droid 2.0",
  "url": "https://f-droid.org/2026/09/24/f-droid-2.0-a-new-chapter-for-android-freedom.html",
  "hnUrl": "https://news.ycombinator.com/item?id=49831968",
  "author": "daveoc64",
  "score": 887,
  "commentCount": 251,
  "type": "story",
  "time": 1790263572,
  "text": null,
  "domain": "f-droid.org",
  "pointsPerHour": 100,
  "commentsPerHour": 28.3,
  "discussionRatio": 0.28,
  "engagementTier": "viral",
  "hoursOld": 8.9,
  "topics": [
    "Web"
  ],
  "age": "8h",
  "contentType": "link"
}
```

### 🔗 Related Actors

More from the NexGenData **Startup, VC & funding** family:

- [Crunchbase News Scraper — Funding News API](https://apify.com/nexgendata/crunchbase-news-scraper?fpr=2ayu9b)
- [Founders Fund Portfolio Scraper — Portfolio API](https://apify.com/nexgendata/founders-fund-portfolio-scraper?fpr=2ayu9b)
- [Greylock Portfolio Scraper — VC Portfolio API](https://apify.com/nexgendata/greylock-portfolio-scraper?fpr=2ayu9b)
- [Show HN Tracker — New Launch Feed API](https://apify.com/nexgendata/hn-show-hn-tracker?fpr=2ayu9b)
- [Index Ventures Portfolio Scraper — VC API](https://apify.com/nexgendata/index-ventures-portfolio-scraper?fpr=2ayu9b)
- [Lightspeed Portfolio Scraper — VC Portfolio API](https://apify.com/nexgendata/lightspeed-portfolio-scraper?fpr=2ayu9b)

10 more in this family on the [NexGenData Store page](https://apify.com/nexgendata?fpr=2ayu9b).

### Pricing (live, as published on the Apify Store)

| Event | Price |
|---|---|
| `apify-actor-start` | **$0.00005** per event (one event per GB of run memory, minimum one) |
| Result — one story row | **$0.05** per item |

That is **$50 per 1,000 stories**, or **20 stories per $1**.

**Cost breakdown:** 30 stories = **$1.50**. 100 stories = **$5.00**.

You are charged per story row delivered to your dataset:

- The trend summary in Tracker mode is written to the run's **OUTPUT** key-value
  record, not to the dataset, so it is **not** a billed result.
- Comments attached to a story ride inside that story's row and add **no** extra
  billable results.
- A run that delivers no stories — empty feed, blocked source, or no
  `searchType` chosen — charges **no** result events.

### Input parameters

| Parameter | Type | Range | Default | Description |
|---|---|---|---|---|
| `searchType` | string | `top`, `new`, `best`, `ask`, `show`, `job`, `search` | `top` (used when left empty) | Which HN feed to read, or `search` for a keyword search across all HN stories (newest first). There is deliberately no default: an empty input never fetches or bills anything. |
| `query` | string | any keyword | — | For `search`: the word(s) to find in story titles and links, e.g. `rust`, `apify`. |
| `sinceDays` | integer | 1+ | all time | For `search`: only stories posted in the last N days. |
| `outputMode` | string | `tracker`, `raw` | `raw` in code, `tracker` prefilled in the UI | `tracker` adds engagement/topic/domain fields to every row and writes a trend summary to OUTPUT. `raw` gives flat story records. |
| `maxResults` | number | 1–100 | 30 | How many stories to extract. Each delivered story is one billable result. |
| `includeComments` | boolean | true/false | false | Attach up to the **top 10 top-level comments** per story. This is not the full comment tree. |

### Output

One row per story. Field names as delivered:

```json
{
  "id": 49570669,
  "title": "Actively exploited sandbox RCE in all Chromium versions",
  "url": "https://nvd.nist.gov/vuln/detail/cve-2026-85046",
  "hnUrl": "https://news.ycombinator.com/item?id=49570669",
  "author": "negura",
  "score": 386,
  "commentCount": 222,
  "type": "story",
  "time": 1788558721,
  "text": null,
  "topComments": [
    {"id": 49570901, "author": "tptacek", "text": "The sandbox escape is the interesting half.", "time": 1788559000}
  ]
}
```

`topComments` appears only when `includeComments` is true. In `tracker` mode each
row additionally carries `domain`, `pointsPerHour`, `commentsPerHour`,
`discussionRatio`, `engagementTier`, `hoursOld`, `topics`, `age` and
`contentType`.

The Tracker summary (in OUTPUT, not the dataset) holds `topicBreakdown`,
`domainBreakdown`, `engagementTiers`, `contentTypeBreakdown`, `topAuthors`,
`viralStories` and generated `insights`.

### Quick start

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("nexgendata/hacker-news-scraper").call(run_input={
    "searchType": "top",
    "outputMode": "tracker",
    "maxResults": 30,
    "includeComments": False,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["score"], item["title"])

summary = client.key_value_store(run["defaultKeyValueStoreId"]).get_record("OUTPUT")
print(summary["value"]["insights"])
```

### Real-world use cases

- **Competitive intelligence** — daily `searchType: new`, `maxResults: 100`, flag
  stories mentioning competitor names.
- **Newsletter content** — daily `searchType: top`, take titles plus top comments.
- **Job board aggregation** — `searchType: job`, extract companies and roles.
- **Trend monitoring** — `outputMode: tracker`, watch `topicBreakdown` and
  `engagementTiers` move week over week.

### Run behaviour

- **Genuine empty:** if HN answers and the feed is empty, or every story in it
  has been deleted, the run **succeeds with 0 rows** and the status message says
  why. Nothing is charged for results.
- **Source failure:** a non-200, unreachable, or shape-changed response is
  retried (4 attempts on the feed, 3 per item) and then the run **fails** with a
  status message naming the cause. Nothing is charged for results.
- **Time limit:** the run derives a deadline from its own timeout, stops cleanly,
  says "Stopped early at the run time limit", and only the delivered rows are
  charged.

### FAQ

**Will this get blocked or rate-limited?** It uses Hacker News' own public
Firebase API, which is documented for automated access and needs no key. HN can
still throttle or return errors under load; when that happens the run retries and
then fails loudly rather than returning a silent empty result.

**How fresh is the data?** Live — the actor reads HN's current feed on each run.

**Is my data private?** Results stay in your Apify account.

**How is this different from HN Algolia?** Algolia is a full-text search index
over HN history. This actor reads the live Firebase feeds (top/new/best/ask/show/
job) and enriches them; it is not a historical search.

### Agentic payments

This actor supports autonomous payment via Skyfire, and is discoverable through
Apify's MCP server (`mcp.apify.com`). The published pay-per-event pricing above
applies unchanged.

### Apify platform bonus

New to Apify? Sign up with the NexGenData [referral link](https://www.apify.com/?fpr=2ayu9b) — you get platform credits on signup and help fund maintenance of this actor fleet.

***

*A NexGenData utility actor.*

# Actor input Schema

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

Which HN feed to scrape. Defaults to 'top' when left empty. 'Top' = current front page (best for trend tracking). 'New' = latest submissions. 'Best' = highest-rated recent stories. 'Ask' = Ask HN discussions. 'Show' = Show HN launches. 'Job' = hiring posts. 'search' = keyword search across all Hacker News stories, newest first (set 'query', optionally 'sinceDays').

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

Keyword or phrase to find in Hacker News stories (title, URL, text), e.g. 'rust', 'apify', 'Show HN AI agent'. Used only when searchType is 'search'.

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

Optional, for searchType 'search': keep stories posted in the last N days. Leave empty for all time.

## `outputMode` (type: `string`):

Choose output format. 'Tech Trend Tracker' adds engagement scoring (points/hour velocity), topic classification (AI/ML, Security, Startup, etc.), domain analysis and story age to every row, and writes a trend summary report to the run's OUTPUT record. 'Raw Data' gives flat story records for bulk export. Both modes bill one result per story — the trend summary is not a billed dataset row.

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

Number of stories to extract, 1-100. Each delivered story is one billable result. 30 covers the front page.

## `includeComments` (type: `boolean`):

Fetch up to the top 10 comments per story into the story row. Useful for sentiment analysis. Increases run time; comments do not add billable results.

## Actor input object example

```json
{
  "searchType": "top",
  "outputMode": "tracker",
  "maxResults": 30,
  "includeComments": false
}
```

# Actor output Schema

## `overview` (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 = {
    "searchType": "top",
    "outputMode": "tracker",
    "maxResults": 30,
    "includeComments": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("nexgendata/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 = {
    "searchType": "top",
    "outputMode": "tracker",
    "maxResults": 30,
    "includeComments": False,
}

# Run the Actor and wait for it to finish
run = client.actor("nexgendata/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 '{
  "searchType": "top",
  "outputMode": "tracker",
  "maxResults": 30,
  "includeComments": false
}' |
apify call nexgendata/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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