# Hacker News Scraper - Stories, Comments, Search & Users (`gosoul9/hacker-news-scraper`) Actor

Scrape Hacker News: full-text search since 2006, front page, Ask HN, Show HN, jobs, stories with all comments, user profiles. Points, comments, dates, URLs. No login. $0.15 per 1,000 results.

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

## Pricing

from $0.15 / 1,000 result 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 - Stories, Comments, Search & Users

#### What does Hacker News Scraper do?

Hacker News Scraper extracts data from **Hacker News (news.ycombinator.com)** and exports it to Excel, CSV, JSON or your own tools. It works in four ways, alone or together:

- 🔎 **Search all of Hacker News since 2006** by keyword: stories, and comments too if you want them.
- 📰 **Live feeds** with the current rank: front page (Top), New, Best, **Ask HN**, **Show HN**, **Jobs**.
- 💬 **Any story with its full comment thread**, in reading order with the reply depth.
- 👤 **User profiles** (karma, about, account date) plus their latest stories or comments.

It uses the official public Hacker News APIs. You don't need an account, cookies or proxies, so runs are fast, cheap and don't get blocked.

![Hacker News Scraper example output: front page stories with rank, points, comments, date and site](https://api.apify.com/v2/key-value-stores/JJdNTW6mHqsclEqNv/records/hacker-news-scraper-output)

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

<table>
<tr><td>📰 Story title</td><td>🔗 Article URL and site</td><td>⬆️ Points (upvotes)</td></tr>
<tr><td>💬 Comment count</td><td>👤 Author</td><td>📅 Date (ISO)</td></tr>
<tr><td>🏆 Front-page rank</td><td>📝 Text of Ask HN / Show HN posts</td><td>🧵 Full comment threads</td></tr>
<tr><td>↪️ Reply depth and parent</td><td>⭐ User karma</td><td>🏷️ Type: story, Ask HN, Show HN, job, poll, comment</td></tr>
</table>

#### How to scrape Hacker News in 4 steps

1. Fill in at least one field: **keywords**, **feeds**, **story URLs** or **usernames**.
2. Set **Max results** and optional filters: *Minimum points*, *Only items published after*, *Search in* (stories, comments or both).
3. Tick **Also get comments of each story** if you want the discussions too.
4. Click **Start**, then download your data in Excel, CSV, JSON or HTML, or send it to Google Sheets, Slack or your app.

#### ⬇️ Input example

```json
{
  "searchQueries": ["postgres", "your-brand"],
  "feeds": ["top", "show"],
  "storyUrls": ["https://news.ycombinator.com/item?id=8863"],
  "usernames": ["pg"],
  "maxItems": 100,
  "searchType": "story",
  "sort": "date",
  "minPoints": 10,
  "publishedAfter": "30 days",
  "includeComments": false
}
```

#### ⬆️ Output example

A story:

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

A comment:

```json
{
  "type": "comment",
  "id": 8865,
  "author": "dhouston",
  "text": "oh, and a mac port is coming :)",
  "createdAt": "2007-04-04T19:22:55Z",
  "storyId": 8863,
  "storyTitle": "My YC app: Dropbox - Throw away your USB drive",
  "parentId": 8863,
  "depth": 1,
  "hnUrl": "https://news.ycombinator.com/item?id=8865"
}
```

Each result also has a `source` field (`search: postgres`, `feed: top`, `user: pg`...) so you always know why it was collected. Feed results have a `rank`, and profiles have `karma`, `about` and `submissions`.

#### What can you do with Hacker News data?

- **Brand and competitor monitoring**: search your product or competitors with *Date* sort and *published after: 24 hours*, run it every day and get alerts in Slack or by email.
- **Launch tracking**: follow your Show HN post, its rank, points and every comment.
- **Market and product research**: read what developers say about a tool, a language or a category in thousands of comments.
- **Lead generation and hiring**: collect "Who is hiring" threads and job posts, or find active people in a niche.
- **Content ideas and trends**: see which topics and sites reach the front page with the most points.
- **AI and data science**: build datasets of discussions for sentiment analysis, RAG or LLM training.

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

**$0.15 per 1,000 results** (a story, a comment or a profile = 1 result). Examples:

- The front page (30 stories) every day for a month: about **$0.14**.
- 10,000 comments about a topic: **$1.50**.
- Errors (unknown user, wrong URL) are free.

The Apify Free plan includes monthly credits, enough for tens of thousands of results.

#### Integrations

- **Google Sheets, Slack, email**, Make, Zapier, n8n: send new results where your team works.
- **Schedules**: run every hour or every day for monitoring.
- **API, Python and JavaScript SDKs, webhooks**.
- **AI agents**: use it from Claude, ChatGPT or Cursor through the Apify MCP server.

#### ❓ FAQ

#### Do I need a Hacker News account or API key?

No. The Actor uses the official public Hacker News APIs (Firebase and Algolia search). No login and no proxy are needed.

#### How far back can I search?

All the way back to the first Hacker News posts in 2006. Use *Only items published after* to limit the period.

#### Can I get more than 1,000 search results?

Yes. With *Sort: Date*, the Actor moves through time automatically, so you can collect tens of thousands of stories or comments for a keyword.

#### How do I monitor my brand or my competitors?

Add your keywords, choose *Sort: Date*, *Search in: Stories and comments*, *Only items published after: 24 hours*, then create an Apify schedule that runs every day. Connect Slack or email to get the new mentions.

#### How do I get all the comments of a story?

Paste the story URL (`https://news.ycombinator.com/item?id=...`) into *Stories to scrape with all comments*. You get the story and up to *Max comments per story* comments with their depth and parent, in reading order.

#### Can I scrape "Who is hiring?" threads?

Yes. Paste the URL of the monthly "Ask HN: Who is hiring?" thread into *Stories to scrape with all comments*: each job post is one comment with its full text.

#### Why are points empty for comments?

Hacker News does not publish the score of comments, only of stories.

#### Are the front-page ranks live?

Yes. Feeds are read at the moment of the run, so `rank` is the position at that time. Run it on a schedule to track a story's rank over time.

#### Can I scrape deleted or flagged items?

No. Deleted and dead items are skipped, and they are not charged.

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

The Actor only collects public data through official public APIs. You are responsible for how you use it: respect privacy laws such as GDPR when you handle usernames and comments.

#### Other Actors you may like

- [Substack Scraper](https://apify.com/gosoul9/substack-scraper): posts, likes and comments of any newsletter.
- [Bluesky Scraper](https://apify.com/gosoul9/bluesky-scraper-posts-profiles): posts and profiles from Bluesky.
- [Google News Scraper](https://apify.com/gosoul9/google-news-scraper-cheap): news articles for any keyword.
- [Startup Jobs Scraper](https://apify.com/gosoul9/startup-jobs-scraper): job offers from startup career pages.
- [Website Technology Detector](https://apify.com/gosoul9/website-technology-detector): find the tech stack of any website.

#### Support

A field is missing or something does not work? Open an issue in the **Issues** tab and it will be fixed quickly.

# Actor input Schema

## `searchQueries` (type: `array`):

Full-text search across all Hacker News history since 2006, e.g. 'postgres', 'your product name', 'AI agents'. Finds stories (titles, URLs, text) and, if you choose, comments.

## `feeds` (type: `array`):

Live front-page lists, with their current rank: Top (front page), New, Best, Ask HN, Show HN, Jobs.

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

Hacker News item URLs (https://news.ycombinator.com/item?id=...) or ids. Returns the story and its full comment thread.

## `usernames` (type: `array`):

Hacker News usernames, e.g. 'pg' or 'dang'. Returns the profile (karma, about, created) and the user's latest stories or comments.

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

How many stories or comments to collect for each keyword, feed and user.

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

For keywords and users: stories only, comments only, or both.

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

Relevance (best matches, popular first) or Date (newest first: best for monitoring).

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

Keep only stories with at least this many upvotes. 0 = no filter.

## `publishedAfter` (type: `string`):

A date like 2026-01-31, or a period like '24 hours', '7 days', '1 year'. With Date sort + a schedule = brand monitoring.

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

For search and feed results, also return the comments of every story (each comment counts as one result).

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

Limit of comments collected per story.

## Actor input object example

```json
{
  "searchQueries": [
    "apify"
  ],
  "maxItems": 100,
  "searchType": "story",
  "sort": "relevance",
  "minPoints": 0,
  "includeComments": false,
  "maxCommentsPerStory": 100
}
```

# Actor output Schema

## `results` (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 = {
    "searchQueries": [
        "apify"
    ]
};

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

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

```

## MCP server setup

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