# Hacker News Trend Aggregator (`navy_currant/hacker-news-trend-aggregator`) Actor

Scrape Hacker News stories and comments via the official Algolia + Firebase APIs. Keyword search with date/points filters, plus live top/best/new/ask/show/job rankings. No credentials, no proxy required.

- **URL**: https://apify.com/navy\_currant/hacker-news-trend-aggregator.md
- **Developed by:** [Ishaan](https://apify.com/navy_currant) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 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.

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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use 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 Trend Aggregator

Scrape **Hacker News** stories and comments using the official **Algolia HN Search API** and **Firebase API** — no account, no API key, no proxy spend required.

### What it does

- **Keyword search** — query stories and/or comments by relevance or date, with `since`/`until` date range and `minPoints`/`minComments` filters
- **Live rankings** — pull the current **top**, **best**, **new**, **Ask HN**, **Show HN**, or **jobs** lists straight from HN's Firebase feed
- **Unified output** — stories and comments in one dataset with consistent field names, ready for analysis or AI pipelines

### Why use this actor

| Competitor actor | Problem | This actor |
|---|---|---|
| harvestlab/hacker-news-scraper (5 users) | Barely launched, search-only | Search **and** live ranked lists |
| Generic multi-source actors | No HN-specific depth | Native points/comments/date filters |
| Roll-your-own API calls | Pagination + hydration + charge logic to maintain | One input, clean schema, pay-per-result |

Hacker News is the canonical signal source for startup, AI, and developer-tooling intelligence — a natural input for **RAG pipelines**, trend dashboards, and competitive research.

### Output fields

| Field | Type | Description |
|---|---|---|
| `type` | string | `story`, `comment`, `job`, or `poll` |
| `object_id` | string | HN item ID |
| `url` | string | HN permalink (`news.ycombinator.com/item?id=…`) |
| `external_url` | string | Linked article URL (stories) |
| `title` | string | Story title (or parent story title for comments) |
| `text` | string | Self-text (Ask/Show) or comment body |
| `author` | string | HN username |
| `author_url` | string | HN user profile link |
| `points` | integer | Score |
| `num_comments` | integer | Comment count |
| `story_id` | string | Parent story ID (comments) |
| `story_title` | string | Parent story title (comments) |
| `created_at` | string | ISO 8601 timestamp |
| `created_at_i` | integer | Unix timestamp |
| `tags` | array | HN/Algolia tags |

### Usage examples

Keyword search, high-signal stories from 2025 by recency:

```json
{
  "mode": "search",
  "searchTerms": ["AI agents", "LLM"],
  "itemType": "story",
  "sortBy": "date",
  "minPoints": 50,
  "since": "2025-01-01T00:00:00Z",
  "maxResults": 1000
}
````

Live front-page snapshot:

```json
{
  "mode": "top",
  "maxResults": 100
}
```

### Pricing

**Pay per event:** $0.001 per result.

Example: 10,000 items ≈ **$10**.

### Technical notes

- Uses the official `hn.algolia.com` search API and `hacker-news.firebaseio.com` Firebase API — both free, public, no key
- **Zero proxy cost** — official APIs, no anti-bot bypass
- Polite rate limiting
- Automatically stops when the user's spending limit is reached — charge respected per result, no overrun

### Common use cases

- **AI / startup intelligence** — track what the HN community is discussing
- **RAG pipelines** — feed fresh, high-signal tech discourse into retrieval systems
- **Trend monitoring** — daily pulls of top/best lists for a dashboard
- **Developer-tooling research** — find Show HN launches and Ask HN demand signals
- **Sentiment / discourse analysis** — collect comment threads on a topic

### Data compliance

This actor accesses only **public** Hacker News data through YC's official, publicly documented APIs. No login credentials are used. Hacker News content is intentionally public; suitable for research and business use.

# Actor input Schema

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

search = keyword query via the Algolia API. top/best/new/ask/show/job = live ranked lists from the official Firebase API.

## `searchTerms` (type: `array`):

Keywords or phrases to search. Each term runs as a separate query. Leave empty to return the most recent/relevant items overall.

## `itemType` (type: `string`):

Restrict search results to stories, comments, or both.

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

relevance = best match first; date = newest first.

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

Only return items with at least this many points. 0 = no filter.

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

Only return items with at least this many comments. 0 = no filter.

## `since` (type: `string`):

Return only items created after this ISO 8601 timestamp (e.g. 2025-01-01T00:00:00Z).

## `until` (type: `string`):

Return only items created before this ISO 8601 timestamp (e.g. 2025-12-31T23:59:59Z).

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

Maximum results to return (per search term in search mode, or total for ranked lists). Higher values increase cost and run time.

## Actor input object example

```json
{
  "mode": "search",
  "searchTerms": [
    "AI agents",
    "LLM"
  ],
  "itemType": "story",
  "sortBy": "relevance",
  "minPoints": 0,
  "minComments": 0,
  "maxResults": 50
}
```

# 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 = {
    "searchTerms": [
        "AI agents",
        "LLM"
    ],
    "since": "",
    "until": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("navy_currant/hacker-news-trend-aggregator").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 = {
    "searchTerms": [
        "AI agents",
        "LLM",
    ],
    "since": "",
    "until": "",
}

# Run the Actor and wait for it to finish
run = client.actor("navy_currant/hacker-news-trend-aggregator").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 '{
  "searchTerms": [
    "AI agents",
    "LLM"
  ],
  "since": "",
  "until": ""
}' |
apify call navy_currant/hacker-news-trend-aggregator --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Hacker News Trend Aggregator",
        "description": "Scrape Hacker News stories and comments via the official Algolia + Firebase APIs. Keyword search with date/points filters, plus live top/best/new/ask/show/job rankings. No credentials, no proxy required.",
        "version": "0.1",
        "x-build-id": "qBpOaBKhKVHYUwpuK"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/navy_currant~hacker-news-trend-aggregator/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-navy_currant-hacker-news-trend-aggregator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/navy_currant~hacker-news-trend-aggregator/runs": {
            "post": {
                "operationId": "runs-sync-navy_currant-hacker-news-trend-aggregator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/navy_currant~hacker-news-trend-aggregator/run-sync": {
            "post": {
                "operationId": "run-sync-navy_currant-hacker-news-trend-aggregator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "search",
                            "top",
                            "best",
                            "new",
                            "ask",
                            "show",
                            "job"
                        ],
                        "type": "string",
                        "description": "search = keyword query via the Algolia API. top/best/new/ask/show/job = live ranked lists from the official Firebase API.",
                        "default": "search"
                    },
                    "searchTerms": {
                        "title": "Search terms (search mode)",
                        "type": "array",
                        "description": "Keywords or phrases to search. Each term runs as a separate query. Leave empty to return the most recent/relevant items overall.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "itemType": {
                        "title": "Item type (search mode)",
                        "enum": [
                            "story",
                            "comment",
                            "all"
                        ],
                        "type": "string",
                        "description": "Restrict search results to stories, comments, or both.",
                        "default": "story"
                    },
                    "sortBy": {
                        "title": "Sort by (search mode)",
                        "enum": [
                            "relevance",
                            "date"
                        ],
                        "type": "string",
                        "description": "relevance = best match first; date = newest first.",
                        "default": "relevance"
                    },
                    "minPoints": {
                        "title": "Minimum points (search mode)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return items with at least this many points. 0 = no filter.",
                        "default": 0
                    },
                    "minComments": {
                        "title": "Minimum comments (search mode)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return items with at least this many comments. 0 = no filter.",
                        "default": 0
                    },
                    "since": {
                        "title": "Since date (search mode)",
                        "type": "string",
                        "description": "Return only items created after this ISO 8601 timestamp (e.g. 2025-01-01T00:00:00Z)."
                    },
                    "until": {
                        "title": "Until date (search mode)",
                        "type": "string",
                        "description": "Return only items created before this ISO 8601 timestamp (e.g. 2025-12-31T23:59:59Z)."
                    },
                    "maxResults": {
                        "title": "Max results",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum results to return (per search term in search mode, or total for ranked lists). Higher values increase cost and run time.",
                        "default": 50
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
