# Hacker News front page with top comments

**Use case:** 

Get the current Hacker News front page (30 stories) with points, comment counts and links, plus up to 20 top comments per story in thread order.

## Input

```json
{
  "mode": "top",
  "maxItems": 30,
  "searchType": "story",
  "searchSort": "relevance",
  "minPoints": 0,
  "minComments": 0,
  "includeComments": true,
  "maxCommentsPerStory": 20,
  "maxCommentDepth": 2
}
```

## Output

```json
{
  "type": {
    "label": "Type"
  },
  "rank": {
    "label": "Rank"
  },
  "title": {
    "label": "Title"
  },
  "points": {
    "label": "Points"
  },
  "commentsCount": {
    "label": "Comments count"
  },
  "author": {
    "label": "Author"
  },
  "createdAt": {
    "label": "Created at"
  },
  "depth": {
    "label": "Depth"
  },
  "text": {
    "label": "Text"
  },
  "url": {
    "label": "Url"
  },
  "hnUrl": {
    "label": "Hn url"
  },
  "error": {
    "label": "Error"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Hacker News Scraper: Stories, Comments & Search Actor is ready to run with the inputs already set for "Hacker News front page with top comments". [Sign up or log in](https://console.apify.com/create-task-from-example/HhGRJFsaBcxgZ4rRk) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Hacker News front page with top comments" task

The Hacker News Scraper: Stories, Comments & Search Actor will start running based on the input automatically. You can also change all the input fields, like what to scrape, max stories (or search results), and more, to match your specific use case.

### 3. Receive the "Hacker News front page with top comments" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as type, rank, title, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Hacker News front page with top comments" task via API](https://apify.com/fjordlabs/hacker-news.md).

## FAQ

### What types of data does the Hacker News Scraper return?

The Hacker News Scraper task returns the type, rank, title, points, comments count, author, created date, comments' depth, text, and URLs for stories and comments.

### How many stories does this task fetch from Hacker News?

The Hacker News Scraper task fetches up to 30 stories from the current Hacker News front page.

### Is personal data collected?

Only public HN usernames as authors. The Actor doesn't scrape user profiles, karma or about texts, and it reads HN's public APIs rather than news.ycombinator.com pages.

### How many top comments are retrieved per story?

Up to 20 per story, two levels deep in this example. Comments are fetched level by level, so you get the top-level discussion first, in HN's ranking order within each thread.

### Does this task require an API key to use?

The Hacker News Scraper task does not require an API key; it utilizes Hacker News' official APIs directly.

### How much does it cost?

$0.0002 per story and $0.0001 per comment plus Apify's $0.00005 run start: about $0.07 for this front page with comments. Error rows are free. Schedule it daily in Apify Console.

### Is the text extracted from Hacker News cleaned up?

Yes, the Hacker News Scraper task converts HTML into clean plain text for more readable output.

## About this Actor

This example demonstrates how to use [Hacker News Scraper: Stories, Comments & Search](https://apify.com/fjordlabs/hacker-news.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/fjordlabs/hacker-news.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

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 full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/fjordlabs/hacker-news.md

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`).
