# Hacker News Scraper (`vashiiq/hacker-news`) Actor

Hacker News stories and comments: front page, new, best, Ask/Show HN and jobs, keyword search with date and points filters, full comment threads, and new-since-last-run alerts.

- **URL**: https://apify.com/vashiiq/hacker-news.md
- **Developed by:** [anthony leblanc](https://apify.com/vashiiq) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.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/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

Get Hacker News as clean rows: the front page and other feeds, keyword search across all of HN with date and points filters, or full comment threads, with an "only new since last run" mode for alerts.

### What it does

- Feeds: front page, new, best, Ask HN, Show HN and jobs, with rank.
- Search: any keyword across all of HN’s stories or comments, with date range and minimum points.
- Comments: whole threads flattened to one row per comment, with depth and parent.
- Comment and post text converted from HTML to plain text.
- Only new: scheduled runs skip anything the same input already returned.

**Why this one:** One Actor for feeds, keyword search with date and points filters, and whole comment threads as rows, plus "only new since last run" for alerts. The free API alone gives you none of that ready-made.

In our last check, 20 runs over varied inputs succeeded 100% of the time.

### Use cases

- Alerts when your product, company or topic is mentioned
- Tracking launches and trends in tech
- Collecting discussions for research or sentiment analysis

### Input example

```json
{
  "mode": "feed",
  "feed": "top",
  "maxItems": 10
}
```

- mode: feed, search or comments
- feed: top, new, best, ask, show, jobs
- query, searchIn, dateFrom, dateTo, minPoints
- storyIds: for comments mode
- onlyNew: skip items returned before

### Output sample

Real results from a run of this Actor:

```json
[
  {
    "id": 8004539,
    "type": "comment",
    "storyId": 8000528,
    "storyTitle": "Show HN: Sheetlabs – Turn your spreadsheets into APIs",
    "parentId": 8003859,
    "author": "Ecio78",
    "text": "The only problem is that I'm almost sure that DB were making millions not thanks to the excel data per se but thanks to all the logic that was running inside/behind that Excel.\nIn this case, you can't \"APIfy\" it with a tool like this.\n\nN.B. I'm not bashing sheetlabs, just saying that sometimes the most important part is not the numbers in the cell but how you create them",
    "createdAt": "2014-07-08T14:03:13.000Z",
    "hnUrl": "https://news.ycombinator.com/item?id=8004539",
    "sourceUrl": "https://hn.algolia.com/api/v1/search",
    "scrapedAt": "2026-10-27T20:28:25.775Z"
  },
  {
    "id": 50261392,
    "type": "comment",
    "storyId": 50224617,
    "storyTitle": "Ask HN: What Are You Working on (Oct 2026)",
    "parentId": 50224617,
    "author": "cleanrowdata",
    "text": "A job postings index built from employers' own applicant tracking systems instead of job boards. It polls about 17,000 public Greenhouse, Lever, Ashby, Workday, SmartRecruiters and Workable boards (hourly, Workday daily), dedupes them into one schema (parsed salary, seniority, remote/region), and keeps closed jobs with a closed_at date, so you can see how long roles really stay open. The fiddly part has been Workday: 20 jobs per page, and the total count only appears on the first page.\n\nDisclosure, it's mine and it's paid per job returned: https://apify.com/cleanrowdata/fresh-jobs-index. Next up is per-company hiring rollups. Curious which filters people would actually use.",
    "createdAt": "2026-10-27T16:11:17.000Z",
    "hnUrl": "https://news.ycombinator.com/item?id=50261392",
    "sourceUrl": "https://hn.algolia.com/api/v1/search",
    "scrapedAt": "2026-10-27T20:28:25.775Z"
  }
]
```

**Fields:**

- Stories: id, title, url, domain, author, points, comments, createdAt, text, hnUrl, rank
- Comments: id, storyId, storyTitle, parentId, depth, author, text, createdAt, hnUrl

### Pricing

Pay per result: **$2.00 per 1,000 results**. You pay only for results you get; Apify platform costs are included. Set a maximum charge for a run and the Actor stops cleanly when it's reached, keeping everything collected so far.

### Tips

- Schedule search mode hourly with "Only new" on to get a mention alert feed.
- Paste HN links straight into Stories; the ID is picked out for you.

### FAQ

**Do I need an account on Hacker News?** No. It only reads public pages and data.

**Is this the official API?** It uses Hacker News’s official API and the public HN Search by Algolia, and adds search, filters, threads and alerts on top.
**Something broke or a field is missing?** Open an issue on the Issues tab and include your run link. We fix scrapers quickly when sites change.

### Legal

This Actor collects publicly available data only. You're responsible for using it lawfully and in line with Hacker News's terms.

# Actor input Schema

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

Feed: a Hacker News list. Search: keyword and date search. Comments: full threads for given stories.

## `feed` (type: `string`):

Feed mode: which list.

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

Search mode: words to look for. Leave empty to list everything in the date range, newest first.

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

Search mode: stories or comments.

## `dateFrom` (type: `string`):

Search mode: only items posted on or after this date.

## `dateTo` (type: `string`):

Search mode: only items posted on or before this date.

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

Skip stories with fewer points.

## `storyIds` (type: `array`):

Comments mode: story IDs or links like https://news.ycombinator.com/item?id=8863.

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

For scheduled runs: skip items this same input returned before.

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

Stop after this many rows. You are only charged for rows you get.

## `proxyConfiguration` (type: `object`):

Not needed; these APIs are public.

## Actor input object example

```json
{
  "mode": "feed",
  "feed": "top",
  "query": "apify",
  "searchIn": "stories",
  "onlyNew": false,
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Stories or comments, one row each.

# 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 = {
    "query": "apify",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("vashiiq/hacker-news").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 = {
    "query": "apify",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("vashiiq/hacker-news").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 '{
  "query": "apify",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call vashiiq/hacker-news --silent --output-dataset

```

## MCP server setup

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

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/R5tgjrMvRh7sbNgcn/builds/lcGaMorhcspLfbMIH/openapi.json
