# Hacker News Scraper — $0.20/1k · Stories, Comments & Search (`tidydata/hacker-news-scraper`) Actor

Scrape Hacker News (HackerNews, Y Combinator): front page, new, best, Ask HN, Show HN and jobs; keyword or domain search; full comment threads; user profiles. Monitor brand mentions with 'only new'. Official HN APIs, no login. $0.20 per 1,000 results.

- **URL**: https://apify.com/tidydata/hacker-news-scraper.md
- **Developed by:** [tidydata](https://apify.com/tidydata) (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

from $0.16 / 1,000 story or comments

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 Scraper — Stories, Comments, Search & Front Page

Scrape **Hacker News** (news.ycombinator.com): the **front page, new, best, Ask HN, Show HN and jobs** lists in their live order, **keyword search** across the whole HN history, **every story that links to a domain**, **full comment threads** with depth, and **user profiles** with their latest submissions. Schedule it with **"only new"** to get an alert-ready list of fresh mentions of your product, company or competitors.

**$0.20 per 1,000 results** (stories or comments). User profile rows and errors are free. No login, no API key.

- ✅ **Live lists**: Top (front page), New, Best, Ask HN, Show HN, Jobs — with the **rank** of each story
- ✅ **Search** stories, comments or both, by keyword, in the **title only**, or in the **link URL** (find every HN submission of `yourdomain.com`)
- ✅ **Newest first with no 1,000-result cap**: goes back through the whole HN archive, or by **relevance**
- ✅ **Comment threads**: every comment with **author, text, date, parent and depth** (1 = direct reply), in thread order
- ✅ **Users**: karma, account creation date, about text, number of submissions, plus their latest stories or comments
- ✅ **Filters**: last N days, minimum points, minimum comments, Ask/Show HN, jobs, polls, stories that reached the front page
- ✅ **"Only new since last run"**: remembers what earlier runs returned — perfect for scheduled **brand monitoring**
- ✅ Clean text (HN's HTML converted to readable paragraphs, links kept as full URLs), ISO dates, numbers as numbers
- ✅ Uses only the **official Hacker News API** (Firebase) and the **official HN Search API by Algolia** — fast and stable

### Who uses it

- **Founders & marketers** — track every mention of your product, company or competitors and every share of your website.
- **Developer relations** — collect feedback threads and Show HN launches in your space.
- **Investors & analysts** — follow trends, launches and "Who is hiring" posts over time.
- **AI builders & researchers** — high-quality tech discussions for datasets, summaries and sentiment analysis.
- **Recruiters** — job posts from the HN Jobs list.

### How to use it

1. Pick **front-page lists**, and/or write **search queries** (`apify`, `web scraping`, `github.com/yourorg`).
2. To find every submission of a website, set **Search in → Link URL only** and use the domain as the query.
3. Add **story links** to download complete comment threads, or **usernames** to get profiles and their posts.
4. Optional: **include comments** of each story, **last N days**, **min points**, and **only new since the last run**.
5. Run, then export to **CSV, Excel, JSON** or send results to Slack, email, Google Sheets, Make, Zapier or n8n.

#### Input example

```json
{
  "searchQueries": ["apify.com"],
  "searchIn": "url",
  "searchType": "story",
  "sortBy": "date",
  "newerThanDays": 30,
  "includeComments": true,
  "onlyNew": true
}
```

### Output example

```json
{
  "type": "story",
  "id": 50170593,
  "title": "SimCity, but with Permits",
  "url": "https://permit.petercai.com/",
  "domain": "permit.petercai.com",
  "author": "pcai",
  "points": 140,
  "comments": 67,
  "createdAt": "2026-10-20T18:29:09Z",
  "hnUrl": "https://news.ycombinator.com/item?id=50170593",
  "storyType": "story",
  "rank": 1,
  "source": "list:top"
}
```

Comment rows have `"type": "comment"` with `storyId`, `storyTitle`, `parentId`, `author`, `text`, `createdAt`, `depth`, `replies` and `hnUrl`. User rows have `"type": "user"` with `username`, `karma`, `createdAt`, `about` and `submissions`.

### Pricing

**$0.0002 per result ($0.20 per 1,000 stories or comments).** User profiles, "not found" and input errors are free. Higher Apify plans get an automatic discount, and you can set a **maximum cost per run**.

### Tips

- **Monitoring**: schedule a daily run with `onlyNew` on and connect it to Slack or email — you'll only get what's new.
- **Clean up and combine** several runs with [Merge, Filter, Deduplicate & Transform Datasets](https://apify.com/tidydata/merge-dedupe-datasets).
- **Read the linked articles** in full with [Article Text Extractor](https://apify.com/tidydata/article-text-extractor).

### FAQ

**Are points and comment counts live?**
Front-page lists and story links read the live official API, so points and comment counts are current. Search results come from the Algolia index, which can lag a few minutes behind for very fresh stories.

**Can I get more than 1,000 search results?**
Yes — with **Sort: newest first** the Actor pages back through time with no limit. Relevance sorting is limited to 1,000 results per query by the search API.

**Why don't comments have points?**
Hacker News doesn't publish comment scores to anyone except their author.

**Are deleted or flagged items included?**
No. Deleted and dead items are skipped.

**Is it legal?**
The Actor uses the public APIs that Hacker News provides for this purpose. Respect the authors' rights and privacy laws when you reuse the content.

Something doesn't work or you need a field? Open an issue in the **Issues** tab — we answer fast.

# Actor input Schema

## `lists` (type: `array`):

Live lists from the official Hacker News API, in their current order (rank).

## `searchQueries` (type: `array`):

Keywords, product names or domains (e.g. 'apify', 'github.com/yourorg'). Uses the official HN Search API by Algolia.

## `searchIn` (type: `string`):

Choose 'Link URL only' to find every HN submission of your website or a competitor's.

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

Applies to search queries and usernames.

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

Newest first can go back through the whole HN history.

## `storyUrls` (type: `array`):

HN links (https://news.ycombinator.com/item?id=…) or IDs. Returns the story and its full comment thread with depth.

## `users` (type: `array`):

HN usernames (case-sensitive). Returns a free profile row (karma, created, about) and their latest submissions.

## `maxItems` (type: `integer`):

Comments added with 'Include comments' don't count toward this limit.

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

Adds the full comment thread of every story found in lists and searches.

## `maxCommentsPerStory` (type: `integer`):

In thread order.

## `newerThanDays` (type: `integer`):

0 = no date limit.

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

Only stories with at least this score.

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

Only stories with at least this many comments.

## `onlyNew` (type: `boolean`):

Monitoring: returns only what appeared since the previous run with the same settings (new search results, or stories that entered the first N positions of a list). Schedule it to get alerts for new mentions.

## Actor input object example

```json
{
  "lists": [
    "top"
  ],
  "searchQueries": [
    "web scraping"
  ],
  "searchIn": "all",
  "searchType": "story",
  "sortBy": "date",
  "storyUrls": [],
  "users": [],
  "maxItems": 50,
  "includeComments": false,
  "maxCommentsPerStory": 200,
  "newerThanDays": 0,
  "minPoints": 0,
  "minComments": 0,
  "onlyNew": false
}
```

# Actor output Schema

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

One row per story, comment or user.

# 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 = {
    "lists": [
        "top"
    ],
    "searchQueries": [
        "web scraping"
    ],
    "storyUrls": [],
    "users": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidydata/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 = {
    "lists": ["top"],
    "searchQueries": ["web scraping"],
    "storyUrls": [],
    "users": [],
}

# Run the Actor and wait for it to finish
run = client.actor("tidydata/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 '{
  "lists": [
    "top"
  ],
  "searchQueries": [
    "web scraping"
  ],
  "storyUrls": [],
  "users": []
}' |
apify call tidydata/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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