# Hacker News Scraper: Stories, Comments, Search & Who Is Hiring (`best_apis/hacker-news-scraper`) Actor

Scrape Hacker News: front page, new, best, Ask HN, Show HN and job feeds, full-text search with date and points filters, full comment threads, and parsed Who is hiring? jobs (company, role, location, remote, salary). Official APIs, no login. $0.15 per 1,000 items.

- **URL**: https://apify.com/best_apis/hacker-news-scraper.md
- **Developed by:** [A Q](https://apify.com/best_apis) (community)
- **Categories:** News, Jobs, 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 Scraper: Stories, Comments, Search & Who Is Hiring Jobs

Get clean, structured data from [Hacker News](https://news.ycombinator.com) in seconds. One Actor covers everything people usually need from HN:

- **Story feeds**: front page (top), new, best, Ask HN, Show HN and YC job posts, in live ranking order.
- **Full-text search** over 20 years of stories and comments, with date range, minimum points and minimum comments filters. Sort by relevance or newest first (no 1,000-result limit when sorting by date).
- **Complete comment threads** for any story, flattened in thread order with `depth`, `parentId` and `storyId`, so you can rebuild the tree or feed it to an LLM.
- **"Ask HN: Who is hiring?" jobs, parsed**: company, role, location, remote / hybrid / onsite, salary, employment type, tech stack, visa sponsorship and links for every post of any month since 2011.

It uses the official Hacker News APIs (Firebase and Algolia HN Search). No login, no proxies, no browser, so runs are fast and cheap.

### Pricing: from $0.15 per 1,000 items

| | This Actor | Typical HN scrapers on Apify |
|---|---|---|
| Stories and comments | **$0.15 per 1,000** | $0.20 to $5.00 per 1,000 |
| Parsed Who is hiring jobs | **$1.00 per 1,000** | $2.00 to $3.50 per 1,000 |
| Actor start | $0.0005 | $0.00005 to $0.001 |

You pay only for rows you receive. Set **Max items** to cap a run, and Apify's maximum cost per run is respected exactly.

### Use cases

- **Trend and brand monitoring**: schedule a daily search for your product, competitors or a technology, newest first, and send results to Slack, Google Sheets or a webhook.
- **Developer sentiment and research**: pull every comment on a launch or a topic and analyze it with an LLM.
- **Recruiting and job search**: get the monthly Who is hiring? thread as a spreadsheet, filtered to remote Python or Rust roles with salaries.
- **Content and newsletters**: collect the best Show HN or front-page stories of the week.
- **AI agents and RAG**: clean plain text (HTML removed, links kept as full URLs).

### Input examples

Front page right now:

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

Every story mentioning "web scraping" in the last 30 days with 10+ points, plus their comments:

```json
{ "mode": "search", "searchQuery": "web scraping", "sortBy": "date", "postedAfter": "30 days", "minPoints": 10, "includeComments": true, "maxItems": 500 }
```

All comments of a story:

```json
{ "mode": "comments", "storyUrls": ["https://news.ycombinator.com/item?id=8863"], "maxItems": 1000 }
```

Remote Python jobs from the latest Who is hiring? thread:

```json
{ "mode": "whoIsHiring", "hiringMonth": "latest", "jobKeywords": ["python"], "remoteOnly": true, "maxItems": 500 }
```

### Output

Story row:

```json
{
  "type": "story", "id": 8863, "title": "My YC app: Dropbox - Throw away your USB drive", "url": "http://www.getdropbox.com/u/2/screencast.html",
  "domain": "getdropbox.com", "author": "dhouston", "points": 104, "commentsCount": 71, "createdAt": "2007-04-04T19:16:40.000Z",
  "text": null, "hnUrl": "https://news.ycombinator.com/item?id=8863", "feed": "top", "rank": 1
}
```

Comment row: `type`, `id`, `author`, `createdAt`, `text`, `parentId`, `storyId`, `storyTitle`, `depth`, `hnUrl`.

Job row (Who is hiring):

```json
{
  "type": "job", "company": "Sidekick Labs", "role": "Senior SWE, R&D Engineer, Intelligence Engineer", "location": "REMOTE (US Timezones)",
  "remote": true, "workplace": "remote", "salary": "$170k to $230k", "employmentType": ["full-time"], "techStack": [],
  "visaSponsorship": null, "links": ["https://..."], "month": "October 2026", "header": "Sidekick Labs | Senior SWE, ...", "text": "...full post..."
}
```

Job fields are parsed from the free-form first line that HN posters write, so they are best-effort; the original `header` and full `text` are always included.

### FAQ

**Is it legal to scrape Hacker News?** This Actor reads the public, official Hacker News APIs that Y Combinator and Algolia provide for exactly this kind of use, and it does not log in or bypass anything. Respect the usual rules when you reuse people's posts.

**How far back does search go?** To the start of Hacker News in 2007. Relevance search returns the top 1,000 matches per query; choose "Newest first" to page through everything.

**Why do I get fewer rows than Max items?** The feed lists hold up to 500 stories, deleted and dead items are skipped, and filters may match fewer items.

**Can I run it on a schedule?** Yes. Use Apify Schedules with a newest-first search and a "Posted after: 24 hours" filter for a daily digest.

**Can I call it from code or an AI agent?** Yes, through the Apify API, the Python and JavaScript clients, or the Apify MCP server:

```bash
curl -X POST "https://api.apify.com/v2/acts/best_apis~hacker-news-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" -d '{"mode":"search","searchQuery":"llm agents","sortBy":"date","maxItems":50}'
```

Questions or a field you need? Open an issue on the Actor's Issues tab and I'll usually answer within a day.

# Actor input Schema

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

Pick one mode. Each mode uses only the fields in its section below.

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

Story feed mode: which Hacker News list to read, in its live ranking order (up to 500 stories).

## `searchQuery` (type: `string`):

Search mode: keywords to find in titles, URLs, story text and comments. Leave empty with a date filter to get everything in that period.

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

Search mode: what kind of items to return.

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

Search mode: relevance returns at most the 1,000 best matches. Newest first pages back through time and has no limit.

## `postedAfter` (type: `string`):

Search mode: only items newer than this. A date (2026-01-31) or a relative period (24 hours, 7 days, 3 months).

## `postedBefore` (type: `string`):

Search mode: only items older than this. Same formats as Posted after.

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

Search mode: only stories with at least this many points (upvotes).

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

Search mode: only stories with at least this many comments.

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

Comments mode: Hacker News item links (https://news.ycombinator.com/item?id=...) or plain IDs. Returns the story plus every comment in thread order with depth and parent ID.

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

Feed and search modes: after each story, add its comments (thread order). Each comment counts as one item.

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

Feed and search modes, when comments are on: cap per story.

## `hiringMonth` (type: `string`):

Who is hiring mode: "latest" or a month such as 2026-10 or October 2026. Threads go back to 2011.

## `jobKeywords` (type: `array`):

Who is hiring mode: keep posts that mention any of these words (case-insensitive), for example python, rust, data engineer.

## `remoteOnly` (type: `boolean`):

Who is hiring mode: keep only posts whose header says remote.

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

Maximum rows in total (stories, comments and jobs). You pay only for rows you get.

## Actor input object example

```json
{
  "mode": "feed",
  "feed": "top",
  "searchQuery": "web scraping",
  "searchType": "story",
  "sortBy": "relevance",
  "minPoints": 0,
  "minComments": 0,
  "storyUrls": [
    "https://news.ycombinator.com/item?id=8863"
  ],
  "includeComments": false,
  "maxCommentsPerStory": 100,
  "hiringMonth": "latest",
  "jobKeywords": [
    "python",
    "rust"
  ],
  "remoteOnly": false,
  "maxItems": 30
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `jobs` (type: `string`):

No description

## `full` (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 = {
    "mode": "feed",
    "maxItems": 30
};

// Run the Actor and wait for it to finish
const run = await client.actor("best_apis/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 = {
    "mode": "feed",
    "maxItems": 30,
}

# Run the Actor and wait for it to finish
run = client.actor("best_apis/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 '{
  "mode": "feed",
  "maxItems": 30
}' |
apify call best_apis/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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