# Hacker News Stories & Comments Scraper ($1/1K) (`tamnt67/hacker-news-scraper`) Actor

Hacker News stories and comments scraper: title, URL, domain, points, comment count, author, date and text, also for Show HN, Ask HN, jobs and the front page. Takes keywords with filters for points, comments, dates, author or domain. Use it to track mentions of a product on HN.

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

## Pricing

from $0.70 / 1,000 items

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 Stories & Comments Scraper

Search Hacker News stories, comments, Show HN, Ask HN, job posts, polls or the current front page with no login and no API key, for $1 per 1,000 items on the Free plan, down to $0.70 on higher plans.

Filter by keyword, minimum points, minimum comments, date range, author or the domain of the linked site. Data comes from the public Hacker News search API (Algolia), so runs are fast and cheap.

### What you can do with it

- **Track mentions.** Search your product, company, competitors or a technology and see every story and comment that mentions it.
- **Collect launch feedback.** Pull Show HN posts for a keyword and read what the community said about similar launches.
- **Research a topic.** Export Ask HN discussions or high-scoring stories (`minPoints`) for a research project or a newsletter.
- **Follow a domain.** Enter a site such as `github.com` or your own blog in **Domain** and see which of its articles reached Hacker News, with points and comment counts.
- **Monitor with a schedule.** Run the same queries every day, newest first, and send new items to Slack, Google Sheets or a webhook.
- **Feed an AI agent or a database.** Get clean JSON with plain text instead of HTML, ready for analysis or embeddings.

### Output fields

Each story or comment is one record in the dataset. Example values below come from a real run with the query "web scraping".

Stories (also Show HN, Ask HN, jobs, polls and front page items):

| Field | Example |
|-------|---------|
| `id` / `hnUrl` | 50472805 / https://news.ycombinator.com/item?id=50472805 |
| `type` | story (also show_hn, ask_hn, job, poll) |
| `title` | Puppeteer vs. Selenium for Web Scraping, Tested on the Same Chrome |
| `url` / `domain` | https://scrapfly.io/blog/posts/puppeteer-vs-selenium / scrapfly.io |
| `points` / `numComments` | 2 / 3 |
| `author` / `createdAt` | Hacker News user name / 2026-11-12T19:25:49Z |
| `storyText` | text of Ask HN and Show HN posts as plain text, null for link stories |
| `isFrontPage` / `tags` | false / \["story"] (another item in the same run: \["story", "ask_hn"]) |
| `query` / `scrapedAt` | web scraping / 2026-11-13T05:38:04.542Z |

Comments (`type` = comment) have these fields: `id`, `type`, `hnUrl`, `author`, `createdAt`, `points`, `text`, `storyId`, `storyTitle`, `storyUrl`, `parentId`, `tags`, `query` and `scrapedAt`.

Download results as JSON, CSV, Excel or XML, or read them through the Apify API.

### Example output

One real story record from a run with the query "web scraping" (the author's user name is replaced with "..."):

```json
{
  "id": 50472805,
  "type": "story",
  "hnUrl": "https://news.ycombinator.com/item?id=50472805",
  "author": "...",
  "createdAt": "2026-11-12T19:25:49Z",
  "points": 2,
  "title": "Puppeteer vs. Selenium for Web Scraping, Tested on the Same Chrome",
  "url": "https://scrapfly.io/blog/posts/puppeteer-vs-selenium",
  "domain": "scrapfly.io",
  "numComments": 3,
  "storyText": null,
  "isFrontPage": false,
  "tags": ["story"],
  "query": "web scraping",
  "scrapedAt": "2026-11-13T05:38:04.542Z"
}
```

### How to use

1. Enter **Search queries**, one per line. You can leave them empty if you set an **Author** or a **Domain**, or choose the current front page.
2. Pick an **Item type** (stories, comments, Show HN, Ask HN, jobs, polls or current front page) and **Sort by** relevance or newest first. Optionally add **Minimum points**, **Minimum comments**, **Date from**, **Date to**, **Author** or **Domain**, and set **Max items per query** (up to 1,000).
3. Click **Start**. Results appear in the dataset as pages are read. Export them or read them through the API.

#### Example input

```json
{
  "queries": ["web scraping", "LLM agents"],
  "itemType": "story",
  "sortBy": "date",
  "minPoints": 20,
  "minComments": 0,
  "dateFrom": "2026-01-01",
  "dateTo": "2026-06-30",
  "maxItemsPerQuery": 200,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

Tips:

- Use **Newest first** for monitoring runs, so the latest items come first.
- Enter dates as `YYYY-MM-DD` (UTC). **Date from** `2026-01-01` starts at the beginning of that day and **Date to** `2026-06-30` includes the whole of June 30. You can also give an exact time such as `2026-06-30T18:00:00Z`. An invalid date stops the run with an error before any request.
- **Minimum comments** applies to stories, Show HN, Ask HN, jobs and polls. With **Item type** Comments it is ignored (a note is written to the log), because comments have no comment count.
- The default datacenter proxy is fine. The search API is public and does not block it.

### Pricing and cost examples

You pay per item saved to the dataset ("Item" event). Platform usage and proxy traffic are included in the per-item price. Each run also has a one-time start charge of $0.00005.

| Apify plan | Price per 1,000 items |
|------------|-----------------------|
| Free (default price) | $1.00 |
| Bronze | $0.90 |
| Silver | $0.80 |
| Gold, Platinum, Diamond | $0.70 |

Cost examples on the Free plan:

- 100 items ≈ $0.10
- 1,000 items ≈ $1.00
- 10,000 items ≈ $10.00 (≈ $7.00 on Gold and higher plans)

The Apify Free plan includes $5 of platform credit every month. If you spend it only on this Actor, that covers about 5,000 items per month.

You are charged only for items saved to the dataset. A search request that still fails after 4 attempts saves nothing for the rest of that query, and a query with no results saves nothing, so neither adds to the bill. Items filtered out by the **Domain** filter and duplicates inside one query are skipped before saving, so they are not charged. If no query, author or domain is given and the item type is not the front page, the run searches the example query "web scraping" and says so in the log. If you send only an author or a domain, only that is searched. To set a hard cap, enter a maximum total charge per run in the run options. The Actor stops as soon as that limit is reached.

### Use it via API, on a schedule, or from an AI agent

**JavaScript** (`npm install apify-client`):

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

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('tamnt67/hacker-news-scraper').call({
    queries: ['web scraping'],
    itemType: 'story',
    sortBy: 'date',
    maxItemsPerQuery: 100,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**Python** (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")

run = client.actor("tamnt67/hacker-news-scraper").call(run_input={
    "queries": ["web scraping"],
    "itemType": "story",
    "sortBy": "date",
    "maxItemsPerQuery": 100,
})

items = client.dataset(run["defaultDatasetId"]).list_items().items
print(items)
```

**cURL** (runs the Actor and returns the items in one call):

```bash
curl -X POST "https://api.apify.com/v2/acts/tamnt67~hacker-news-scraper/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"queries": ["web scraping"], "itemType": "story", "sortBy": "date", "maxItemsPerQuery": 100}'
```

The sync endpoint waits for the run to finish, so use it for small runs and the client libraries for large ones.

**Schedules:** create an Apify Schedule for this Actor or a saved task to run the same queries daily or hourly and build a mention monitor.

**AI agents:** the Apify MCP server at https://mcp.apify.com lets AI assistants such as Claude or Cursor run this Actor and read its results.

### FAQ

#### How much does Hacker News Scraper cost?

Hacker News Scraper costs $1 per 1,000 items on the Free plan and $0.90, $0.80 or $0.70 per 1,000 on higher Apify plans. 100 items cost about $0.10 on the Free plan. The Free plan's $5 monthly credit covers about 5,000 items.

#### How many results do I get per query?

Hacker News Scraper returns up to `maxItemsPerQuery` items for each query, from 1 to 1,000. The default is 100. The Hacker News search API itself returns at most 1,000 results for one query and filter combination.

#### How can I get more results?

Add more queries, or split a long period into several runs of Hacker News Scraper with **Date from** and **Date to**. Each date range is a new filter combination, so each can return up to 1,000 items. Lowering **Minimum points** or **Minimum comments** also widens the results.

#### Can I run it on a schedule or through the API?

Yes. Hacker News Scraper works with Apify Schedules for hourly, daily or weekly runs, and with the Apify API through the JavaScript and Python clients or a single cURL call. See the API section above for working examples.

#### How fresh is the data?

Hacker News Scraper reads the Hacker News search index live at the time of each run. Nothing is cached by the Actor. Points and comment counts come from the search index and can lag the live site by a few minutes. Every record has a `scrapedAt` timestamp.

#### Is it legal to scrape Hacker News?

Hacker News Scraper collects only publicly visible stories and comments through the public Hacker News search API, without logging in. You are responsible for how you use the data, including complying with the Hacker News terms and with data protection laws such as GDPR, since records include user names. This is not legal advice. If you are unsure, ask a lawyer.

### Limitations

- The search API returns at most 1,000 results per query and filter combination, and the Actor stops at 1,000 items per query. Split long periods with **Date from** and **Date to** to get more.
- Points and comment counts are refreshed by the search index and can lag the live site by a few minutes.
- The **Domain** filter matches the linked site of stories (for comments, the site of the parent story). With a query, results are first searched by the query and then kept only if they link to that domain, so a query plus a domain can return fewer items than `maxItemsPerQuery`.
- Deleted and dead items are not returned by the search API.
- **Minimum comments** works on stories, Show HN, Ask HN, jobs and polls. It is ignored for comments, which have no comment count.
- `points` is usually null for comments, and `storyText` is null for link stories.
- Dates are in UTC. **Date to** without a time includes that whole day, up to 23:59:59 UTC.
- Duplicates are removed within each query, not across queries. An item found by two queries is saved and charged once for each.
- The filters (item type, sort, points, comments, dates, author, domain) apply to every query in the same run.
- If a search request still fails after 4 attempts, the Actor logs an error and moves on to the next query.

### Changelog

- 1.0 (2026-11-19): **Date to** without a time now includes the whole day; an invalid date stops the run with a clear error; **Minimum comments** is ignored for comments with a log note instead of silently doing nothing; sending only an author or domain no longer also searches the example query "web scraping".

### Integrations

Works with every Apify integration: API, webhooks, Zapier, Make, Google Sheets, Slack, n8n, LangChain and the Apify MCP server.

### Support

Found a problem or missing field? Report problems in the Issues tab of this Actor.

# Actor input Schema

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

Keywords to search, one per line. Leave empty to list by type and filters only.

## `itemType` (type: `string`):

What to return.

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

Most relevant first, or newest first.

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

Only items with at least this many points. 0 for no limit.

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

Only stories with at least this many comments. 0 for no limit.

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

Optional start date, for example 2026-01-01.

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

Optional end date, for example 2026-06-30.

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

Optional Hacker News user name to limit results to.

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

Optional site of the linked article, for example github.com.

## `maxItemsPerQuery` (type: `integer`):

Stop after this many items for each query (the API allows up to 1,000).

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

Proxy for the API requests. Usually not needed; datacenter proxy is fine.

## Actor input object example

```json
{
  "queries": [
    "web scraping"
  ],
  "itemType": "story",
  "sortBy": "relevance",
  "minPoints": 0,
  "minComments": 0,
  "maxItemsPerQuery": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Dataset with one record per result.

## `itemsCsv` (type: `string`):

The same dataset exported as CSV.

# 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"
    ],
    "minPoints": 0,
    "minComments": 0,
    "maxItemsPerQuery": 100,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("tamnt67/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 = {
    "queries": ["web scraping"],
    "minPoints": 0,
    "minComments": 0,
    "maxItemsPerQuery": 100,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("tamnt67/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 '{
  "queries": [
    "web scraping"
  ],
  "minPoints": 0,
  "minComments": 0,
  "maxItemsPerQuery": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call tamnt67/hacker-news-scraper --silent --output-dataset

```

## MCP server setup

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