# Hacker News Scraper & Brand Mention Monitor (`lokieee0/hacker-news-scraper`) Actor

For founders, marketers & researchers: search all Hacker News stories and comments (past the 1,000-result API limit), scrape the front page, Ask/Show HN, jobs and full comment threads, and monitor keywords or your brand – each scheduled run returns only new mentions.

- **URL**: https://apify.com/lokieee0/hacker-news-scraper.md
- **Developed by:** [maraa k](https://apify.com/lokieee0) (community)
- **Categories:** News, Social media, Marketing
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 item scrapeds

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 & Monitor: stories, comments, search and alerts

Get anything from Hacker News into a clean dataset: **full-text search** across stories and comments, the **live front page** and other lists, **complete comment threads**, and a **monitor mode** that returns only new mentions since the last run.

Used for brand and competitor monitoring, launch tracking ("how did our Show HN do?"), developer sentiment research, trend analysis and feeding LLM/RAG pipelines.

### Modes

| Mode | What you get |
|---|---|
| **search** | Stories and/or comments matching keywords, filtered by date, author, linked domain, points and comment count |
| **list** | Front page (`top`), `new`, `best`, Ask HN, Show HN, jobs, in HN's live order with `rank` |
| **comments** | A story plus **every comment**, flattened with `depth` and `parentId`, so the thread can be rebuilt |

### No 1,000-result limit

Hacker News' search API (Algolia) returns at most 1,000 results per query, and most scrapers stop there. In **newest-first** mode, this actor splits the time range into smaller windows automatically and merges them. On this build, a 120-day search for "rust" returned **2,500+ items, with no duplicates and correct order**.

### Monitor mode

Turn on `monitor`, schedule the actor (for example hourly), and connect Slack or email. Each run returns **only items that are new since the last run**, so you can track every HN mention of your product, your competitors or a keyword without seeing anything twice.

### Output

```json
{
  "id": 8863, "type": "story", "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, "numComments": 71,
  "createdAt": "2007-04-04T19:16:40.000Z", "hnUrl": "https://news.ycombinator.com/item?id=8863"
}
```

Comments include `text` (HTML converted to plain text with paragraph breaks), `storyId`, `storyTitle`, `parentId` and `depth`.

### Examples

- Every comment mentioning your product in the last 30 days: `{ "mode": "search", "query": "yourproduct", "types": ["comment"], "lastDays": 30 }`
- Show HN launches with 100+ points: `{ "mode": "search", "query": "", "types": ["show"], "minPoints": 100 }`
- Everything linking to your site: `{ "mode": "search", "query": "yoursite.com", "domain": "yoursite.com" }`
- Today's front page: `{ "mode": "list", "list": "top", "maxItems": 30 }`

### How to use it

1. Choose a **mode**: `search` (keywords), `list` (front page, Show HN, Ask HN, jobs) or `comments` (full threads).
2. For search, set the query, item types and date range.
3. Turn on **monitor** and schedule the actor if you want only new mentions each run.
4. Click **Start** and export results, or connect Slack or email for alerts.

### How much does it cost?

You pay **$0.50 per 1,000 items** returned, with no subscription and no separate compute charges. Filters that drop rows mean you don't pay for those rows.

| You process | Typical use | Cost |
|---|---|---|
| 1,000 items | a month of mentions for a brand | **$0.50** |
| 10,000 items | a research dataset | **$5** |
| 100,000 items | a large LLM/RAG corpus | **$50** |

Apify's free plan includes monthly credit, which is enough to try this actor on a real list before you pay anything.

### Use it from code or your tools

Run it from **Make, Zapier, n8n, Google Sheets, Slack, webhooks** or any language through the [Apify API](https://docs.apify.com/api/v2).

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("lokieee0/hacker-news-scraper").call(run_input={
    "mode": "search",
    "query": "yourproduct",
    "types": [
        "story",
        "comment"
    ],
    "lastDays": 30
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

**Node.js**

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('lokieee0/hacker-news-scraper').call({"mode": "search", "query": "yourproduct", "types": ["story", "comment"], "lastDays": 30});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

**cURL** (run and get results in one request)

```bash
curl -X POST "https://api.apify.com/v2/acts/lokieee0~hacker-news-scraper/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"mode": "search", "query": "yourproduct", "types": ["story", "comment"], "lastDays": 30}'
```

### FAQ

**How do I get alerts when my brand is mentioned on HN?**
Use search mode with your brand as the query, turn on `monitor`, schedule it hourly and add a Slack or email integration. Each run returns only new items.

**How does it get past the 1,000-result limit?**
In newest-first mode, it splits the date range into smaller windows and merges them without duplicates.

**Is there an official HN API?**
Yes, and this actor uses the public HN and Algolia APIs, so there's no scraping of HTML and no blocking.

**Can I schedule it or connect it to other apps?**
Yes. Use Apify **Schedules** for recurring runs, and **Integrations** to send results to Google Sheets, Slack, email, Zapier, Make, n8n or a webhook.

**Something didn't work or a field is missing?**
Open an issue on the **Issues** tab. Reports are usually fixed within a few days, and feature requests are welcome.

### More tools from the same developer

- [SPF, DKIM & DMARC checker with a 0–100 score and exact DNS fixes](https://apify.com/lokieee0/email-auth-auditor)
- [Find businesses with outdated websites, with a ready-to-send pitch](https://apify.com/lokieee0/website-redesign-auditor)
- [Jobs from Greenhouse, Lever, Ashby & 4 more ATS in one format](https://apify.com/lokieee0/ats-jobs-scraper)
- [Bulk SSL expiry & security headers scanner with A–F grades](https://apify.com/lokieee0/ssl-security-scanner)
- [Emails, phones & social profiles from any list of websites](https://apify.com/lokieee0/website-contact-extractor)
- [Detect 130+ technologies (CMS, Shopify, analytics, hosting) on any site](https://apify.com/lokieee0/tech-stack-detector)
- [Npm, PyPI & crates.io vulnerability and supply-chain risk audit](https://apify.com/lokieee0/package-intel)
- [Bulk GitHub repo stats with a 0–100 health score](https://apify.com/lokieee0/github-repo-intel)
- [Crawl a website for broken links, meta tag, redirect & sitemap issues](https://apify.com/lokieee0/seo-site-auditor)

# Actor input Schema

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

search = full-text search; list = live front page / new / best / Ask / Show / jobs; comments = full comment threads of given stories.

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

Keywords, product or company name. Leave empty to filter only by author or domain.

## `types` (type: `array`):

What to search: story, comment, ask, show, job, poll, front_page.

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

Date order gets every match through time slicing. Relevance order is capped at 1,000 results by Hacker News' search API.

## `lastDays` (type: `integer`):

Only items from the last N days (overrides the since date).

## `sinceDate` (type: `string`):

YYYY-MM-DD

## `untilDate` (type: `string`):

YYYY-MM-DD

## `author` (type: `string`):

Only items by this user.

## `domain` (type: `string`):

Only stories linking to this site, e.g. github.com (subdomains included).

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

Stories only.

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

Stories only.

## `list` (type: `string`):

Uses the official HN API, in HN's own ranking order (rank 1 = top of the front page).

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

e.g. 8863 or https://news.ycombinator.com/item?id=8863. Returns the story plus every comment, flattened with depth and parentId.

## `maxDepth` (type: `integer`):

Reply depth to include in comments mode.

## `monitor` (type: `boolean`):

Remember what was returned and, on the next run, return only items that are new since then. Schedule it hourly and connect Slack or email for brand and keyword alerts.

## `monitorKey` (type: `string`):

Optional. Give each monitored search its own name to keep several monitors apart.

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

Stop after this many items, which caps the cost of the run.

## Actor input object example

```json
{
  "mode": "search",
  "query": "apify",
  "types": [
    "story"
  ],
  "sort": "date",
  "list": "top",
  "maxDepth": 50,
  "monitor": false,
  "maxItems": 1000
}
```

# Actor output Schema

## `items` (type: `string`):

No description

## `allResults` (type: `string`):

No description

## `search_info` (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 = {
    "query": "apify"
};

// Run the Actor and wait for it to finish
const run = await client.actor("lokieee0/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 = { "query": "apify" }

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

```

## MCP server setup

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