Skip to the content
EnrichedNowDocs

    Type to search every page.

    Menu

    Scraper APIHacker News

    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.

    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; what a run costs is in Usage and units.

    Inputs

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

    Inputs of hackernews.item
    FieldTypeDescription
    itemrequiredstringThe 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_commentsintegerReturn at most this many comments, in the thread's order; 0 returns none.Limit: 0 to 5000. Default: 500.
    max_depthintegerReturn 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.

    Record fields of hackernews.item
    FieldTypeNotes
    item_idintegerHacker News's id of the item.
    typestringWhat the item is: story, comment, poll, pollopt or job.
    hn_urlstringThe item's page on news.ycombinator.com.
    titlestring or nullThe title; null for a comment.
    urlstring or nullThe address a story links to; null for a text post and for a comment.
    authorstring or nullThe username of the account that posted it.
    pointsinteger or nullThe item's score; null for a comment and for a job advert.
    textstring or nullThe body as plain text: of a text post, a job advert or a comment; null for a story that is only a link.
    created_atstring (date-time) or nullWhen it was posted, in UTC.
    parent_idinteger or nullFor a comment, the id of what it replies to.
    story_idinteger or nullThe id of the story the item belongs to: its own for a story.
    comment_countintegerHow many comments there are under the item in all, at every depth, not counting deleted ones.
    commentsarray of objectThe comments under the item, each before its replies, as many as max_comments and no deeper than max_depth allow.
    comment_id (in comments[])integerHacker News's id of the comment.
    parent_id (in comments[])integer or nullThe id of what it replies to: the item itself, or another comment.
    depth (in comments[])integerHow deep in the thread the comment sits: 1 for a reply to the item, 2 for a reply to such a comment.
    author (in comments[])string or nullThe username of the account that wrote it.
    text (in comments[])string or nullThe comment as plain text: paragraphs on their own lines, code kept as written.
    created_at (in comments[])string (date-time) or nullWhen it was posted, in UTC.
    replies (in comments[])integerHow many direct replies the comment has.Default: 0.
    fetched_atstring (date-time)When the item was read, in UTC.

    Example request

    # Start a run and wait up to 60 seconds for it to finish
    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}}'
    
    # Read its records, with the id the first call answered
    curl "https://api.enrichednow.com/v1/runs/$RUN_ID/records?limit=100" \
      -H "Authorization: Bearer $ENRICHEDNOW_API_KEY"
    from enrichednow import EnrichedNow
    
    client = EnrichedNow()  # reads ENRICHEDNOW_API_KEY
    
    # Start a run, wait for it to end, and get its records
    result = client.scrape("hackernews.item", {"item": "8863", "max_comments": 3})
    print(result.run.id, result.run.status, result.run.record_count)
    
    # Read its records: pages are fetched as you go
    for record in result.records:
        print(record)

    Install it with pip install enrichednow, then save as run.py and run python3 run.py

    import EnrichedNow from "enrichednow";
    
    const client = new EnrichedNow(); // reads ENRICHEDNOW_API_KEY
    
    // Start a run, wait for it to end, and get its records
    const { run, records } = await client.scrape("hackernews.item", { item: "8863", max_comments: 3 });
    console.log(run.id, run.status, run.record_count);
    
    // Read its records: pages are fetched as you go
    for await (const record of records) console.log(record);

    Install it with npm install enrichednow, then save as run.mjs and run node run.mjs

    package main
    
    import (
    	"context"
    	"fmt"
    	"log"
    	"time"
    
    	enrichednow "github.com/enrichednow/enrichednow-go"
    )
    
    func main() {
    	client, err := enrichednow.NewClient() // reads ENRICHEDNOW_API_KEY
    	if err != nil {
    		log.Fatal(err)
    	}
    	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
    	defer cancel()
    
    	// Start a run, wait for it to end, and get its records
    	run, records, err := client.Scrape(ctx, "hackernews.item", map[string]any{"item": "8863", "max_comments": 3})
    	if err != nil {
    		log.Fatal(err)
    	}
    	fmt.Println(run.ID, run.Status, run.RecordCount)
    
    	// Read its records: pages are fetched as you go
    	for records.Next() {
    		fmt.Println(string(records.Current()))
    	}
    	if err := records.Err(); err != nil {
    		log.Fatal(err)
    	}
    }

    Install it with go get github.com/enrichednow/enrichednow-go@latest, then save as run.go and run go run run.go

    import com.enrichednow.EnrichedNowClient;
    import com.enrichednow.ScrapeResult;
    import java.util.Map;
    
    public class Run {
        public static void main(String[] args) {
            EnrichedNowClient client = EnrichedNowClient.fromEnv(); // reads ENRICHEDNOW_API_KEY
    
            // Start a run, wait for it to end, and get its records
            ScrapeResult result = client.scrape("hackernews.item", Map.of("item", "8863", "max_comments", 3));
            System.out.println(result.run().id() + " " + result.run().status() + " " + result.run().recordCount());
    
            // Read its records: pages are fetched as you go
            for (Map<String, Object> record : result.records()) {
                System.out.println(record);
            }
        }
    }

    Add com.enrichednow:enrichednow-java:0.4.0 to your Maven or Gradle build, then save as Run.java

    enrichednow run hackernews.item --input-json '{"item":"8863","max_comments":3}'

    Install it with curl -fsSL https://raw.githubusercontent.com/enrichednow/enrichednow-cli/main/install.sh | sh

    It starts a run with this scraper’s example input, waits for it to finish and reads its records a page at a time. The key is read from ENRICHEDNOW_API_KEY.

    The body on its own:

    JSON
    {
      "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 lists every status and the reasons every scraper shares; the reasons of the Hacker News scrapers are in their own section there.