# Hacker News Search: stories by keyword with points and comments (`steadydata/hacker-news-search`) Actor

Search Hacker News stories by keyword, up to 100 queries per run: one row per story with rank, title, link, domain, points, comment count, date and type (story, Ask HN, Show HN, job), sorted by relevance or date, with a minimum-points and recency filter. Pay per story.

- **URL**: https://apify.com/steadydata/hacker-news-search.md
- **Developed by:** [Steadydata Team](https://apify.com/steadydata) (community)
- **Categories:** News, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.55 / 1,000 story listeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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: stories by keyword with points and comments

Search Hacker News stories by keyword, up to 100 queries per run: one row per story with rank, title, link, domain, points, comment count, date and type (story, Ask HN, Show HN, job), sorted by relevance or date, with a minimum-points and recency filter. Pay per story.

### Why this scraper

- **Only delivered results are charged.** Inputs that fail come back as clear error
  records at no cost.
- The official Hacker News search API (Algolia), not a scraped page: one request per 100 stories, no browser, no blocking. Measured: 40 stories on "web scraping" plus the 30 front-page stories in one run for a few hundredths of a cent.
- Ready to filter and rank: `minPoints` and `sinceDays` are applied by the API, `sortBy` switches between relevance and newest, `type` separates stories from Ask HN, Show HN and jobs, `domain` is extracted from the link, and Ask HN text comes as plain text instead of HTML. The submitter's username is not delivered.

### Who this is for

Type queries in `queries` (up to 100 per run), or `front_page` for the current front page; choose `sortBy`, `minPoints`, `sinceDays` and `maxResultsPerQuery` (default 50, ceiling 500). Every row carries the query, rank, story id, title, link, domain, points, comment count, posting time, type, the Ask HN text when there is one, and the Hacker News link.

### Who this is not for

Comments are not delivered, only their count. The submitter's username is left out on purpose. `url` and `domain` are empty for Ask HN and other text-only posts, `text` is filled only for those, and `points` is empty for job postings, which Hacker News does not score. Relevance is Algolia's ranking (text match weighted by points and recency); it is not the front-page order, which `front_page` gives.

### Input example

```json
{
    "queries": [
        "web scraping",
        "front_page"
    ],
    "sortBy": "relevance",
    "minPoints": 0,
    "sinceDays": 0,
    "maxResultsPerQuery": 50
}
```

### Output example

- `query`
- `rank`
- `storyId`
- `title`
- `url`
- `domain`
- `points`
- `commentCount`
- `createdAt`
- `type`
- `text`
- `hnUrl`

Error codes: `INVALID_QUERY`, `NO_RESULTS`, `BLOCKED`.

One delivered row looks like this:

```json
{
  "query": "web scraping",
  "rank": 1,
  "storyId": "22180559",
  "title": "Congrats! Web scraping is legal! (US precedent)",
  "url": "https://parsers.me/us-court-fully-legalized-website-scraping-and-technically-prohibited-it/",
  "domain": "parsers.me",
  "points": 1057,
  "commentCount": 388,
  "createdAt": "2020-01-29T14:06:37Z",
  "type": "story",
  "text": null,
  "hnUrl": "https://news.ycombinator.com/item?id=22180559",
  "status": "ok"
}
```

### Related actors from steadydata

- [hacker-news-comments](https://apify.com/steadydata/hacker-news-comments): the full discussion under the stories you found
- [rss-feed-reader](https://apify.com/steadydata/rss-feed-reader): the feeds of the sites the stories link to
- [google-news](https://apify.com/steadydata/google-news): the same topic in mainstream news
- [website-tech-stack](https://apify.com/steadydata/website-tech-stack): the technology behind a linked site

### Pricing

Pay per event: one `story-listed` event per delivered result. No charge for inputs
that fail, no separate platform-usage surcharge.

**Free Apify plan:** this actor delivers up to 25 rows per run for accounts on the Apify free
plan, and then stops with a message. That limit is set by us, not by Apify. It exists so the
actor keeps paying for itself for the people who do pay. Any paid Apify plan runs it at full
size, billed per delivered row, with failed rows never charged.

**Reviews:** if this actor saves you time, a short review on this page is the one thing that
helps most. Ratings are what other buyers look at first, and we have no other way to ask.

### FAQ

**Can I get the newest stories about a topic?** Yes: `sortBy` = date, and `sinceDays` = 7 for the last week.

**How do I get only popular stories?** Set `minPoints`, for example 100; the filter is applied by the API, so the rows you get are all above it.

**Do I pay for queries without results?** No. A query with no stories comes back as one free error row.

**Can I read the linked articles?** Not with this actor; the `url` column is the input for a page or feed reader. The RSS and Atom Feed Reader from the related actors below reads the site's feed.

**Is the front page live?** Yes, `front_page` returns the 30 stories on the front page at run time, in front-page order.

**Is personal data collected?**
`createdAt` is the posting time in UTC as an ISO timestamp; `hnUrl` is the story's discussion page.

**What happens when the source changes?**
Sources change from time to time; that is the nature of this work. The actor is
monitored daily and fixed fast, and while it is broken you are not charged, because
only delivered results cost anything.

# Changelog

This Actor's version history is a separate document: https://apify.com/steadydata/hacker-news-search/changelog.md

# Actor input Schema

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

One per row, up to 100. Use 'front\_page' for the current front page.

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

Relevance (points and recency weighted) or newest first.

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

Skip stories below this score.

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

0 means all time.

## `maxResultsPerQuery` (type: `integer`):

Cost ceiling per query.

## Actor input object example

```json
{
  "queries": [
    "web scraping",
    "front_page"
  ],
  "sortBy": "relevance",
  "minPoints": 0,
  "sinceDays": 0,
  "maxResultsPerQuery": 50
}
```

# 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",
        "front_page"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadydata/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",
        "front_page",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("steadydata/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",
    "front_page"
  ]
}' |
apify call steadydata/hacker-news-search --silent --output-dataset

```

## MCP server setup

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