# Hacker News Search: Business & Product Stories (`datalantern/hacker-news-search`) Actor

Search public Hacker News story metadata by keyword, date and score. Export deduplicated titles, links, dates and discussion counts without author profiles or comment text.

- **URL**: https://apify.com/datalantern/hacker-news-search.md
- **Developed by:** [Data Lantern](https://apify.com/datalantern) (community)
- **Categories:** News, 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 Search: Public Story Metadata

Export public Hacker News story metadata for topic research, reading lists, and recurring news monitoring. Keep the useful links and scores without collecting author profiles or copying full articles.

### What can this tool do?

Search public Hacker News story metadata through the Algolia HN Search service. Collect topic links for product research, a reading list, or a recurring industry-news review without collecting author profiles or copying article contents.

- Search 1–20 keywords or phrases in the order supplied.
- Sort each query by relevance or newest first.
- Filter by a UTC start date and minimum points.
- Deduplicate story IDs across queries within a run.
- Limit output across the entire run, rather than separately for every query.

The service is Algolia's public HN Search API. It is not Hacker News' official Firebase API or an official Hacker News search endpoint.

### What data does it return?

One row per distinct matching story. Fields are consistent; unavailable values are `null`.

| Field | Meaning |
|---|---|
| `storyId` | Stable Hacker News story ID, stored as a string. |
| `title` | Plain-text story title; personal email addresses are masked. |
| `url` | Public HTTP(S) link supplied by the source, or `null` for a text-only story. The linked page is not fetched. |
| `discussionUrl` | Hacker News discussion URL for this story. |
| `publishedAt` | Source publication date normalized to UTC, or `null` if unusable. |
| `points` | Source score, or `null`. |
| `commentCount` | Source comment count, not the comments themselves. |
| `query` | The first query that produced this row during the run. |

Author names, usernames, user profiles, comments, and full linked articles are not output.

### How to use it

Paste this JSON into the Actor input:

```json
{
  "queries": ["web scraping"],
  "maxResults": 100,
  "sort": "relevance",
  "since": "",
  "minPoints": 0
}
```

| Input | Default | Accepted values |
|---|---|---|
| `queries` | `["web scraping"]` | 1–20 nonblank strings, each at most 200 characters. Duplicate strings are removed. An empty array is invalid. |
| `maxResults` | `100` | Integer 1–5,000, shared by all queries. |
| `sort` | `"relevance"` | `"relevance"` or `"newest"`, applied to each query. |
| `since` | No cutoff | A real `YYYY-MM-DD` date, inclusive from midnight UTC. Omit it or use `""` to disable the cutoff. |
| `minPoints` | `0` | Integer 0–1,000,000. |

Earlier queries may fill the global output limit before later queries are reached. The tool makes at most 50 search-page requests per run, requests up to 100 hits per page, and waits one second between page requests. The source may expose fewer pages than requested. Results can therefore be partial even when `maxResults` has not been reached.

For repeated topic monitoring, use `"sort": "newest"` and set `since` to the date you last checked, keeping a small overlap. Save rows in your own sheet or database keyed by `storyId`, then update that row when points or comment counts change. The tool does not remember previous datasets or exclude previously exported IDs between runs.

If a search response is valid but no stories match the filters, the run succeeds with zero rows and an explanatory note. An unreadable or blocked query stops without a bypass attempt; other queries may still succeed. If no query response can be read, the run fails with a source error. Inspect output notes when only part of the input succeeded.

### Pricing

Pay per result: **$0.30 per 1,000 stories**, plus **$0.001 for a run returning at least one valid story**.

The one-time `actor-start` event costs $0.001 and is triggered only when the first valid matching story is ready. Each returned story incurs one `story` event at $0.0003. Invalid input, a valid zero-match search, or a run with no valid results emits neither event.

For example, 10 returned stories incur $0.001 + 10 × $0.0003 = **$0.004 in Actor event charges**. A partial-success run still has only one start charge, plus charges for the stories actually returned. No result is guaranteed by a search input.

### Is it legal?

The tool reads [Algolia's public HN Search API](https://hn.algolia.com/api), using story metadata only. It does not log in, fetch private pages, collect author profiles, or bypass access controls. Failed or blocked queries are stopped rather than retried through alternative identities or proxies.

Public access is not a blanket license for every commercial use. Review the source's applicable terms and retain source/discussion links when using or redistributing results. The [official HN Firebase API](https://github.com/HackerNews/API) is a different service.

### FAQ

**Does a valid empty result mean the tool is broken?**

No. A keyword, date, or minimum-points filter can legitimately match nothing. A readable search with zero matching rows succeeds, emits no result or start events, and explains the outcome.

**Can I export all historical Hacker News stories?**

No. Query pagination is bounded by the source, the 50-request safety cap, and the global output limit. This is a topic-search tool, not a complete historical archive.

**Are points and comment counts fixed?**

No. They are source values observed when the page is read and can change. Fetch the same story again and upsert by `storyId` when tracking changes.

**Does it collect comments or identify users?**

No. It returns a comment count and a discussion link, not comment bodies, author names, usernames, or user-profile data.

**Why can two query orders produce different output?**

Queries are processed in order. Results are deduplicated globally and the first queries can consume the shared `maxResults` budget.

### Feedback

When reporting an issue, include the input, expected behavior, and the source error or output note. Use public examples only; do not include API tokens, account details, or private data.

# Actor input Schema

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

1–20 nonblank keyword queries. Results are deduplicated across the whole run.

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

Global result cap across all queries. 1–5000, with a separate 50-request safety cap.

## `sort` (type: `string`):

Relevance or newest first, as supplied by the Algolia HN Search API.

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

Optional inclusive YYYY-MM-DD date. It must be a real calendar date.

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

Only stories meeting this score are returned.

## Actor input object example

```json
{
  "queries": [
    "web scraping"
  ],
  "maxResults": 100,
  "sort": "relevance",
  "minPoints": 0
}
```

# Actor output Schema

## `results` (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 = {
    "queries": [
        "web scraping"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("datalantern/hacker-news-search").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": ["web scraping"] }

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

```

## MCP server setup

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

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/qeS7VB4eyids9P8Et/builds/X9vhzUlnFdeSaLhdG/openapi.json
