# Hacker News Scraper - Stories, Comments & Trends (`automly/hacker-news-trends-api`) Actor

Scrape Hacker News stories and comments by keyword or get the front page: title, link, author, points, comment count, date and text, filtered by points, comments and date range. Export to CSV, JSON or Excel, schedule runs or use the API.

- **URL**: https://apify.com/automly/hacker-news-trends-api.md
- **Developed by:** [Automly](https://apify.com/automly) (community)
- **Categories:** News, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 result item produceds

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 & Trends

### What is Hacker News Scraper?

**Hacker News Scraper** is a tool that lets you **scrape stories and comments from Hacker News** by keyword, or grab what is on the front page right now: title, link, author, points, comment count, date, post text and the discussion URL. Filter by points, comments, post type and date. Type a keyword, click **Start**, and download the results as Excel, CSV or JSON.

- 🔎 **Search all of Hacker News:** every story and comment, ranked by relevance or newest first
- 📈 **Front page now:** the current front page stories, in front-page order
- 🎯 **Filters:** minimum points, minimum comments, post type and date range
- 🔓 **No login:** no Hacker News account or API key needed
- 💸 **Free to try:** the $5 of free usage every Apify account gets each month covers about 10,000 stories and comments

### What can Hacker News Scraper do?

- **Search Hacker News stories** by keyword
- **Search Hacker News comments** by keyword
- Scrape the **Hacker News front page** right now
- Get the **newest Hacker News posts** about a topic
- Get **top Hacker News stories** with a minimum number of points or comments
- Scrape **Show HN**, **Ask HN**, poll and job posts
- Get Hacker News posts from the **last 24 hours, week, month, year** or any number of days back
- **Monitor Hacker News** for mentions of your product or competitors
- Export to Excel, CSV, JSON, HTML or XML, or send the results to Google Sheets, Slack, Make, Zapier and more

### What data can you extract from Hacker News?

| | | |
|---|---|---|
| 📰 Story title | 🔗 Story link | 👤 Author |
| 👍 Points | 💬 Number of comments | 📅 Date and time |
| 📝 Ask HN and comment text | 🏷️ Post type | 🧵 Parent story ID and title (comments) |
| 🔗 Hacker News discussion URL | 🆔 Item ID | |

### How to scrape Hacker News

1. [Create a free Apify account](https://console.apify.com/sign-up) (no credit card needed).
2. Open **Hacker News Scraper**.
3. Type a **Search query**, for example `AI agents`, or set **Search mode** to **Front page now**.
4. Optionally set a **Date range**, **Minimum points**, **Minimum comments** or **Content type**, set **Maximum results**, and click **Start**.
5. When the run finishes, open the **Output** tab (the **Posts** view shows stories, the **Comments** view shows comment text) or download the results as Excel, CSV, JSON, HTML or XML.

### How much does it cost to scrape Hacker News?

You pay **$0.50 per 1,000 results** (stories or comments). Apify platform usage is included in that price, and there is no start fee, so there is nothing else to pay.

For example, 100 results cost $0.05, and the maximum of 1,000 results in one run costs $0.50. If you set a maximum cost per run, the run stops when it is reached and keeps everything collected so far.

Every Apify account gets **$5 of free usage each month**, enough for about 10,000 stories and comments. See the **Pricing** tab for details.

### ⬇️ Input

| Setting | What it does |
|---|---|
| Search query | Keywords to search for, such as `Rust`, `AI agents` or `YC W26`. Optional for **Newest first** and **Front page now** |
| Search mode | **Relevance** (`search`), **Newest first** (`search_by_date`) or **Front page now** (`front_page`) |
| Content type | Post type: `story`, `comment`, `show_hn`, `ask_hn`, `poll`, `job` (default `story`). Types separated by commas must all match, so `story,show_hn` means Show HN stories. Empty means every type |
| Minimum points | Only posts with at least this many points (0 = no filter) |
| Minimum comments | Only stories with at least this many comments (0 = no filter) |
| Maximum results | Up to 1,000 results per run (default 100) |
| Date range | All time, last 24 hours, past week, past month, past year, or custom |
| Custom days back | Days back, when the date range is custom (default 30) |

Example: popular Rust stories from the past month.

```json
{
  "query": "Rust",
  "search_mode": "search",
  "tags": "story",
  "points_min": 50,
  "date_range": "past_month",
  "max_results": 100
}
```

Example: the newest comments that mention your product.

```json
{
  "query": "Supabase",
  "search_mode": "search_by_date",
  "tags": "comment",
  "date_range": "last_24h",
  "max_results": 200
}
```

### ⬆️ Output

You get one row per story or comment. You can view them as a table in Apify Console or download them as Excel, CSV, JSON, HTML or XML.

A story:

```json
{
  "objectId": "49724881",
  "title": "Nvidia announces native GPU programming in Rust",
  "url": "https://developer.nvidia.com/blog/introducing-cuda-rust-two-...",
  "author": "nonmaskable",
  "points": 970,
  "numComments": 404,
  "createdAt": "2026-09-16T11:15:53Z",
  "storyText": "",
  "contentType": "story",
  "storyId": "",
  "storyTitle": "",
  "hnUrl": "https://news.ycombinator.com/item?id=49724881"
}
```

A comment:

```json
{
  "objectId": "49867252",
  "title": "",
  "url": "",
  "author": "sandworm101",
  "points": 0,
  "numComments": 0,
  "createdAt": "2026-09-27T15:04:40Z",
  "storyText": "Talk about burying the lead. This was a MEC bike light...",
  "contentType": "comment",
  "storyId": "49866515",
  "storyTitle": "Replacing the old battery on rechargeable bike lights",
  "hnUrl": "https://news.ycombinator.com/item?id=49867252"
}
```

The text of Ask HN posts and comments comes as plain text in `storyText`. A comment carries the ID and title of the story it belongs to in `storyId` and `storyTitle`.

### How can I use Hacker News data?

- **Brand and competitor monitoring:** track mentions of a product, company or competitor on Hacker News
- **Trend spotting:** find rising tools, languages and startups before they go mainstream
- **Newsletters and digests:** collect the best-voted posts of the week
- **Market and sentiment research:** collect comments on a topic and see what developers think
- **Launch monitoring:** follow your Show HN and the discussion around it

### How to monitor Hacker News for a keyword

1. Type your keyword and set **Search mode** to **Newest first**.
2. Set **Date range** to the last 24 hours.
3. [Schedule the actor](https://docs.apify.com/platform/schedules) to run every day, and send the results to Slack, email, Google Sheets or a webhook with an [integration](https://apify.com/integrations).

You can also run it from your own code with the [Apify API](https://docs.apify.com/api/v2) or the Python and JavaScript clients:

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("automly/hacker-news-trends-api").call(run_input={
    "search_mode": "front_page",
    "max_results": 30,
})
for post in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(post["points"], post["title"], post["hnUrl"])
```

### Scrape more tech and community data

| Actor | What it gets |
|---|---|
| [Product Hunt Launches Scraper](https://apify.com/automly/product-hunt-launches-scraper) | Product Hunt launches with upvotes, ranks, makers, comments and reviews |
| [Reddit Scraper - Posts, Comments, Users, Subreddits & Search](https://apify.com/automly/reddit-ultimate-scraper) | Reddit posts, comments, subreddits and keyword search results |
| [Reddit Keyword + Comment Thread Monitor](https://apify.com/automly/reddit-keyword-comment-monitor) | New Reddit posts and comments that mention your keywords |
| [GitHub Repository & Issue Scraper](https://apify.com/automly/github-repo-scraper) | Repository details, issues, pull requests and contributors |
| [Google News Scraper API - Full Text, Monitoring & RSS](https://apify.com/automly/google-news-scraper-api) | News articles by keyword with full text and only new articles per run |

### ❓FAQ

#### How much does it cost to scrape Hacker News?

$0.50 per 1,000 stories or comments, with platform usage included and no start fee. See **How much does it cost to scrape Hacker News?** above.

#### Do I need a Hacker News account?

No. Everything comes from public Hacker News data, so you need no account or API key.

#### How many results can I get in one run?

Up to 1,000 stories or comments per run. Use the date range and filters to focus on what you need, or run it again with a different date range.

#### How fresh is the data?

New posts and comments show up in search within minutes. Use **Newest first** for monitoring.

#### What is the difference between the search modes?

**Relevance** ranks by how well posts match your keywords, **Newest first** lists the newest matches first, and **Front page now** returns the stories on the Hacker News front page at the moment of the run.

#### Why are points 0 on comments?

Hacker News does not show comment scores publicly, so comments always have 0 points.

#### Can I get all comments on one story?

Set **Content type** to `comment` and use words from the story title as the query, or open the story's `hnUrl` for the full thread.

#### Can I export to CSV or Excel?

Yes. Download from the **Output** tab, or get the results through the Apify API in JSON, CSV, Excel, XML or RSS.

#### Can I connect Hacker News Scraper to other tools or AI agents?

Yes. Start runs and download results with the Apify API or the Python and JavaScript clients, send results to Make, Zapier, n8n, Google Sheets or Slack with Apify integrations and webhooks, or let AI assistants and agents run it through the Apify MCP server at [mcp.apify.com](https://mcp.apify.com).

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

Hacker News Scraper only collects posts and comments that people chose to publish openly on Hacker News. It does not collect private data such as email addresses. Usernames and comment text can still be personal data, which may be protected by laws such as GDPR, so only scrape for a legitimate reason and ask a lawyer if you are unsure. You can read more in [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

Hacker News Scraper is an independent tool. It is not affiliated with, endorsed by or sponsored by Hacker News or Y Combinator.

#### Something isn't working. What should I do?

Open the **Issues** tab and tell us your input and what you expected.

### ⭐ Your feedback

Have an idea or found a problem? Tell us on the **Issues** tab. If Hacker News Scraper saved you time, a short review on the **Reviews** tab helps other people find it.

# Actor input Schema

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

Keywords to search for, such as 'Rust', 'AI agents' or 'YC W26'. Optional in front\_page and search\_by\_date modes.

## `search_mode` (type: `string`):

'search' ranks by relevance, 'search\_by\_date' shows the newest first, 'front\_page' returns the stories on the Hacker News front page right now.

## `tags` (type: `string`):

Type of post: 'story', 'comment', 'show\_hn', 'ask\_hn', 'poll' or 'job'. Several types separated by commas must all match (for example 'story,show\_hn' gives Show HN stories). Leave empty for every type.

## `points_min` (type: `integer`):

Only return stories with at least this many upvotes. Set to 0 to disable filtering.

## `num_comments_min` (type: `integer`):

Only return stories with at least this many comments. Set to 0 to disable filtering.

## `max_results` (type: `integer`):

Maximum number of results to return (1–1000).

## `date_range` (type: `string`):

Limit results to a specific time window.

## `created_after_days` (type: `integer`):

Used when Date range is 'custom': return posts from the last N days.

## Actor input object example

```json
{
  "query": "AI agents",
  "search_mode": "search",
  "tags": "story",
  "points_min": 0,
  "num_comments_min": 0,
  "max_results": 50,
  "date_range": "past_month",
  "created_after_days": 30
}
```

# Actor output Schema

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

Every item with all fields, including the post or comment text.

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

Stories with points, comment count, author, date and links.

## `comments` (type: `string`):

Comment text with the story it belongs to (for runs with Content type 'comment').

# 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": "AI agents",
    "max_results": 50,
    "date_range": "past_month"
};

// Run the Actor and wait for it to finish
const run = await client.actor("automly/hacker-news-trends-api").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": "AI agents",
    "max_results": 50,
    "date_range": "past_month",
}

# Run the Actor and wait for it to finish
run = client.actor("automly/hacker-news-trends-api").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": "AI agents",
  "max_results": 50,
  "date_range": "past_month"
}' |
apify call automly/hacker-news-trends-api --silent --output-dataset

```

## MCP server setup

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

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/SoqpDrOPmdnuFEuLp/builds/njeMPIeepvcA7EgSR/openapi.json
