# hackernews.item

A Hacker News story, Ask HN, job, poll or comment with the comment thread under it: title, link, points, author, text, and each comment with its author, depth and time.

Hacker News item, one of the Hacker News scrapers.

| | |
| --- | --- |
| Id | `hackernews.item` |
| Version | 1 |
| Billed per | request — 1 unit for a charged run |
| Runs | within one request |

Start it with `POST /v1/scrapers/hackernews.item/runs`. How runs work is in [Running a scraper](https://docs.enrichednow.com/running-a-scraper.md); what a run costs is in [Usage and units](https://docs.enrichednow.com/usage-and-units.md).

## Inputs

The fields of `input`. A field that is not listed here is refused.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `item` | string | yes | The item's id, e.g. 8863, or its address on news.ycombinator.com. A story, an Ask HN, a job, a poll or a comment. Limit: at least 1 characters, at most 300 characters. |
| `max_comments` | integer | no | Return at most this many comments, in the thread's order; 0 returns none. Limit: 0 to 5000. Default: `500`. |
| `max_depth` | integer | no | Return comments no deeper than this: 1 is replies to the item only. Every depth when not given. Limit: 1 to 100. |

- `item` is the id in an item's address (`…/item?id=8863`), or the address itself. Stories, Ask HN and Show HN posts, jobs, polls and single comments all work.
- `comments` is the thread as a flat list, each comment before its replies. `depth` is 1 for a reply to the item; `parent_id` is what a comment replies to. `comment_count` is the size of the whole thread, whatever `max_comments` and `max_depth` cut.
- Comments come in the order they were posted under each parent, not in the order the site ranks them. Deleted comments are left out. A comment's points are not public.
- `text` is plain text: paragraphs on their own lines, code as written, a shortened link written out in full.

## Record fields

Every record of a run has these fields. A value that is not known is `null` — never an empty string and never `0`.

| Field | Type | Notes |
| --- | --- | --- |
| `item_id` | integer | Hacker News's id of the item. |
| `type` | string | What the item is: story, comment, poll, pollopt or job. |
| `hn_url` | string | The item's page on news.ycombinator.com. |
| `title` | string or null | The title; null for a comment. |
| `url` | string or null | The address a story links to; null for a text post and for a comment. |
| `author` | string or null | The username of the account that posted it. |
| `points` | integer or null | The item's score; null for a comment and for a job advert. |
| `text` | string or null | The body as plain text: of a text post, a job advert or a comment; null for a story that is only a link. |
| `created_at` | string (date-time) or null | When it was posted, in UTC. |
| `parent_id` | integer or null | For a comment, the id of what it replies to. |
| `story_id` | integer or null | The id of the story the item belongs to: its own for a story. |
| `comment_count` | integer | How many comments there are under the item in all, at every depth, not counting deleted ones. |
| `comments` | array of object | The comments under the item, each before its replies, as many as max_comments and no deeper than max_depth allow. |
| `comments[].comment_id` | integer | Hacker News's id of the comment. |
| `comments[].parent_id` | integer or null | The id of what it replies to: the item itself, or another comment. |
| `comments[].depth` | integer | How deep in the thread the comment sits: 1 for a reply to the item, 2 for a reply to such a comment. |
| `comments[].author` | string or null | The username of the account that wrote it. |
| `comments[].text` | string or null | The comment as plain text: paragraphs on their own lines, code kept as written. |
| `comments[].created_at` | string (date-time) or null | When it was posted, in UTC. |
| `comments[].replies` | integer | How many direct replies the comment has. Default: `0`. |
| `fetched_at` | string (date-time) | When the item was read, in UTC. |

## Example request

It starts a run with this scraper's example input and waits up to 60 seconds for it. The key is read from `ENRICHEDNOW_API_KEY`.

```bash
curl -X POST "https://api.enrichednow.com/v1/scrapers/hackernews.item/runs?wait=60" \
  -H "Authorization: Bearer $ENRICHEDNOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"item":"8863","max_comments":3}}'
```

## Example response

The run, once it has ended. A run that has not ended within `wait` comes back with `202` and the status `queued` or `running`.

```json
{
  "id": "run_841742f37553189ff9c27ba1",
  "scraper_id": "hackernews.item",
  "scraper_version": 1,
  "status": "ok",
  "reason": null,
  "input": {
    "item": "8863",
    "max_comments": 3
  },
  "record_count": 1,
  "units": 1,
  "units_per_request": 1,
  "units_per_record": null,
  "units_per_page": null,
  "diagnostics": {
    "requests": 1,
    "bytes": 259214,
    "wall_ms": 885,
    "facts": {}
  },
  "created_at": "2026-11-16T22:37:50.170950Z",
  "started_at": "2026-11-16T22:37:50.178331Z",
  "finished_at": "2026-11-16T22:37:51.066313Z"
}
```

Its records, from `GET /v1/runs/{id}/records`. The record is a real one: this scraper's own parser read it from a page recorded from the site.

```json
{
  "records": [
    {
      "item_id": 8863,
      "type": "story",
      "hn_url": "https://news.ycombinator.com/item?id=8863",
      "title": "My YC app: Dropbox - Throw away your USB drive",
      "url": "http://www.getdropbox.com/u/2/screencast.html",
      "author": "dhouston",
      "points": 104,
      "text": null,
      "created_at": "2007-04-04T19:16:40Z",
      "parent_id": null,
      "story_id": 8863,
      "comment_count": 71,
      "comments": [
        {
          "comment_id": 8865,
          "parent_id": 8863,
          "depth": 1,
          "author": "dhouston",
          "text": "oh, and a mac port is coming :)",
          "created_at": "2007-04-04T19:22:55Z",
          "replies": 1
        },
        {
          "comment_id": 9007,
          "parent_id": 8865,
          "depth": 2,
          "author": "vlad",
          "text": "Drew, this is awesome! All of the features you mentioned are exactly what people need.",
          "created_at": "2007-04-05T01:48:11Z",
          "replies": 0
        }
      ],
      "fetched_at": "2026-11-19T18:07:40.797077Z"
    }
  ],
  "next_cursor": null
}
```

What was done to the record for this page, and nothing else — the API returns every value whole. A text that was cut ends with `… [truncated]`.

- Shortened: `comments`: 3 items, the first 2 shown.

A run does not always end `ok`. [Results and statuses](https://docs.enrichednow.com/results-and-statuses.md#reason-codes) lists every status and the reasons every scraper shares; [the reasons of the Hacker News scrapers](https://docs.enrichednow.com/results-and-statuses.md#hacker-news) are in their own section there.
