Hacker News Scraper avatar

Hacker News Scraper

Pricing

from $2.38 / 1,000 results

Go to Apify Store
Hacker News Scraper

Hacker News Scraper

Collect public Hacker News stories, comments, monthly hiring posts, item trees, and user profiles. Records include author, title, text, points, comment count, dates, URLs, and related item IDs. Search by keyword and filters, or split date windows to work around Algolia’s result limit.

Pricing

from $2.38 / 1,000 results

Rating

0.0

(0)

Developer

Axiom Works

Axiom Works

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a month ago

Last modified

Categories

Features

Limited permissions

Share

Returns: one row per Hacker News item with id, type, title, author, points, numComments, createdAt, hnUrl. Input: {"mode": "search", "searchQueries": ["web scraping"], "contentType": "story", "sortBy": "relevance", "minPoints": 50, "maxItems": 20} Best for: tracking mentions of a product or topic, collecting Who is hiring leads, exporting discussion threads and user profiles.

{
"id": "22180559",
"type": "story",
"title": "Congrats! Web scraping is legal! (US precedent)",
"author": "ehurynovich",
"points": 1057,
"numComments": 388,
"createdAt": "2020-01-29T14:06:37.000Z",
"hnUrl": "https://news.ycombinator.com/item?id=22180559"
}

What does Hacker News Scraper do?

Hacker News Scraper turns results from the public Algolia Hacker News API into consistent dataset records. Use search mode to find stories and comments that mention a topic. Use the hiring mode to read top-level posts in the monthly “Who is hiring?” thread. Use item mode to fetch a specific story and its nested comment tree. Use user mode to look up public profiles by username. Each mode returns stable identifiers and the API URL from which the record was obtained.

Search can favor recent results or Algolia relevance. The Actor requests at most two Algolia pages per second and handles pagination. When a search has more results than Algolia exposes in one result window, it divides the date interval and searches smaller intervals. It deduplicates item identifiers across queries and pages. The maxItems input stops collection as soon as that many unique records have been written. A query with no matches finishes with a warning and an empty dataset.

The Actor uses the public API as its data source. The API can lag Hacker News and fields may be absent from a given item. A link post may have a URL and no body text; an Ask HN post may have body text and no external URL. Hiring posts are free-form comments, so the company and location fields are parsed from their first line and can be incomplete. These distinctions are visible in the nullable dataset fields.

What data can you get?

The output has the same core shape across modes. Empty values are null, so a consumer can read one dataset even when it contains several content types. The fields below describe actual keys emitted by the Actor.

FieldMeaning
idStable Hacker News item ID, or username in user mode.
sourceUrlAlgolia endpoint URL that returned the record.
typeStory, comment, job, poll, or user classification.
titleStory title when one exists; for Who is hiring posts, the first line of the post.
urlExternal URL associated with a story.
authorPublic username of the item author.
pointsScore provided by Algolia.
numCommentsDiscussion count when provided.
textPlain text from a story body or comment.
createdAtCreation time in ISO format.
hnUrlPublic news.ycombinator.com page of the item or user.
storyTitleTitle of the parent story, filled for comments returned by search; otherwise null.
storyUrlExternal link of the parent story, filled for comments returned by search when the story has one.
karmaUser karma, filled in user mode only.
aboutUser profile text as plain text, filled in user mode when present.
storyIdRelated story ID, when available.
parentIdImmediate parent item ID for comments.
companyFirst header segment of a hiring post.
locationLocation-like header segment of a hiring post.
remoteWhether a hiring post contains the word “remote”.
domainHostname of an external story URL.
jobCategoryOptional AI classification of a hiring role.
sentimentOptional AI classification of a story or comment relative to a search topic.

The company, location, and remote fields are simple interpretations of the post text. Review the original text before using those fields to contact a company or make a business decision. The jobCategory and sentiment values are available only when enrichment is enabled and succeeds. Enrichment sends relevant item text to TypeSafe AI, a third-party AI processor. No enrichment value is fabricated when the processor is unavailable.

How to use

Choose a mode and provide its target. For a keyword search, use searchQueries and select a contentType. For a hiring run, choose whoIsHiring and optionally set hiringMonth and keywordFilter. For an item tree, pass numeric IDs or Hacker News item URLs in itemIds. For public profile lookups, pass usernames. Set maxItems to bound the dataset. Start a run and read the default dataset after it finishes.

Search mode accepts multiple query strings. Each string is searched separately, and duplicate items are written once. You can search all items of a content type by supplying an empty searchQueries array. Sorting by relevance uses Algolia's relevance endpoint; sorting by date uses its date endpoint. The date boundaries use the item's creation time. Set exactPhrase to quote each query before sending it to Algolia.

The show_hn and ask_hn choices use the corresponding Algolia tags. The front_page choice asks Algolia for its front-page tag. The comment, job, and poll choices ask for their matching tags. Scores and comment counts are API values, not measurements made by the Actor.

A hiring run searches for the latest matching monthly thread by the public whoishiring account, then reads its top-level comments. The keywordFilter is a case-insensitive substring match on each comment's plain text. For example, remote includes posts that mention that word anywhere in the text. Choose a specific YYYY-MM month when you need a particular monthly thread. A month without a matching thread returns no records and logs a warning.

Input

InputPurposeDefault
modeChoose search, whoIsHiring, item, or user.search
searchQueriesKeywords to search, one or more strings.Empty list
itemIdsItem IDs or Hacker News item URLs.Empty list
usernamesPublic usernames to look up.Empty list
hiringMonthlatest or a YYYY-MM month.latest
keywordFilterText required inside a hiring post.Empty string
contentTypeAlgolia content tag or Show/Ask HN title filter.story
sortBydate or relevance.date
minPointsMinimum item score.No minimum
minCommentsMinimum discussion count.No minimum
dateFrom, dateToOptional ISO date boundaries.Open interval
authorOptional author tag for search.Any author
exactPhraseQuote the search query.false
maxItemsMaximum number of unique records, from 1 to 100000.50
enrichClassify hiring roles or keyword sentiment using TypeSafe AI.false
maxJevCallsCap AI calls in one run, up to 500.500
proxyConfigurationOptional Apify Proxy settings for Algolia.Disabled

Example input for story research:

{
"mode": "search",
"searchQueries": ["web scraping"],
"contentType": "story",
"sortBy": "relevance",
"minPoints": 50,
"maxItems": 20
}

Example input for hiring posts:

{
"mode": "whoIsHiring",
"hiringMonth": "latest",
"keywordFilter": "remote",
"maxItems": 50
}

The item limit is shared across targets, including root stories and comments in item mode. An API call with no input uses search mode, an empty keyword list, story content, date sorting and a limit of 50. The Console prefill is different: it searches web scraping by relevance with at least 50 points and returns up to 20 records. If a valid search is empty, broaden the keywords or remove score, author and date filters. For item or user mode, supply the corresponding target list. Unavailable targets are skipped without dataset error rows.

Output

The following story record came from a local run of the prefilled search. Some properties are shown as null because the story is a link post rather than a hiring comment or AI enriched result.

{
"id": "22180559",
"type": "story",
"title": "Congrats! Web scraping is legal! (US precedent)",
"url": "https://parsers.me/us-court-fully-legalized-website-scraping-and-technically-prohibited-it/",
"author": "ehurynovich",
"points": 1057,
"numComments": 388,
"text": null,
"createdAt": "2020-01-29T14:06:37.000Z",
"storyId": 22180559,
"parentId": null,
"company": null,
"location": null,
"hnUrl": "https://news.ycombinator.com/item?id=22180559",
"storyTitle": null,
"storyUrl": null,
"karma": null,
"about": null,
"remote": null,
"companyUrl": null,
"domain": "parsers.me",
"jobCategory": null,
"sentiment": null,
"sourceUrl": "https://hn.algolia.com/api/v1/search?query=web+scraping&tags=story&numericFilters=created_at_i%3E%3D0%2Ccreated_at_i%3C1791955978%2Cpoints%3E%3D50&hitsPerPage=100&page=0"
}

The output always has id and sourceUrl. A comment's text, storyId, and parentId identify what was said and where it sits in a discussion. An item tree can include the root story and nested comments. A user lookup uses the username as its stable identifier, and usernames accepts either names or news.ycombinator.com/user?id= profile URLs. Because the Algolia API can omit fields, use the schema's nullable types in downstream pipelines.

How much does it cost?

The Actor is charged per result written to the dataset. A successfully AI enriched result can also have an enrichment event. The Pricing tab on the Actor page shows the current charging details. Set maxItems to control the maximum number of result records in a run. If a query has no matches, the run writes no result records. The Actor does not push error messages or placeholder items to the dataset.

Use with AI agents (MCP)

Apify's MCP server can expose this Actor as a tool for an AI agent. Configure the server URL with the Store path:

https://mcp.apify.com/?tools=axiomworks/hacker-news-scraper

The agent can then supply an input object and read the resulting dataset. Specific prompts work better than broad requests because they make the intended mode and item limit clear. For example, ask the agent to “Find up to 20 Hacker News stories about web scraping with at least 50 points, sorted by relevance.” To inspect a discussion, ask it to “Get the item tree for Hacker News item 22180559, limited to 30 records.” For hiring research, ask it to “Find up to 25 remote posts from the latest Who is hiring thread.”

Agent callers should inspect sourceUrl and createdAt before treating a record as current. The source is the Algolia API, which may not yet include the newest Hacker News activity. A hiring company's first-line label and the location heuristic are useful starting points, but the text field supplies the original content for review.

Integrations and API

You can run the Actor through the Apify client, then read its dataset in the same workflow. Replace the token placeholder with your own Apify API token in your environment or client configuration. The Actor does not require a Hacker News account.

Python:

from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("axiomworks/hacker-news-scraper").call(run_input={
"mode": "search",
"searchQueries": ["web scraping"],
"maxItems": 20,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["id"], item["title"])

JavaScript:

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('axiomworks/hacker-news-scraper').call({
mode: 'search',
searchQueries: ['web scraping'],
maxItems: 20,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach(item => process.stdout.write(`${item.id}: ${item.title}\n`));

cURL:

curl -X POST \
'https://api.apify.com/v2/acts/axiomworks~hacker-news-scraper/run-sync-get-dataset-items' \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"mode":"search","searchQueries":["web scraping"],"maxItems":20}'

Each API call can choose a different mode and set of filters. The output is structured JSON, so it can feed a spreadsheet, a research notebook, or a scheduled monitoring job. Keep maxItems modest when you only need a sample, and add date boundaries when scanning a large historical topic.

FAQ

What happens if one item ID, username or search term is bad? Each target runs on its own. A missing item, an unknown user, a malformed ID or a failed search is logged as a warning and skipped, the remaining targets still run, and the run ends successfully with the results found. No placeholder or error records are written.

Does this require a Hacker News login? No. The Actor reads public data via Algolia's Hacker News API. It does not inspect private account information or content behind a login.

Why is a story missing? Algolia's index can lag the website. A story may also fall outside the date, author, score, type, or text filters. Try a less restrictive search and inspect the selected sort order.

Why is the external URL empty? Text posts, including many Ask HN posts, do not have a separate destination link. Their title and body text can still be present.

Why is a hiring location empty or surprising? Hiring authors format their comments differently. The Actor reads the first header line and chooses a location-like segment. The full comment text is the source to review.

What happens when the API blocks a request? The Actor backs off and retries transient block and server responses. Proxy configuration can be enabled for runs that need it. A persistent failure skips that target and logs a warning; the run succeeds with any other results. If empty, broaden the filters, check the target IDs, or enable a suitable proxy and retry later.

Can I fetch a complete discussion? Item mode reads the item endpoint and walks the returned nested children, stopping at maxItems. The API's returned tree determines which comments are available.

Is AI classification required? No. Enrichment is off by default. When enabled, relevant text is sent to TypeSafe AI, a third-party AI processor, and a category or sentiment appears only on successful classification.

This Actor reads public data exposed by the Algolia Hacker News API. Your use of the output must follow the laws and rules that apply to your project. Public availability does not determine every permitted downstream use. Review your own use case, especially before republishing comments or using hiring data for outreach. This Actor is an independent tool. It is not affiliated with or endorsed by Hacker News, Y Combinator, or Algolia.

Feedback

If a search mode, field mapping, or hiring post interpretation does not work as expected, share the input, an affected item ID, and the observed result through the Actor's Apify page. An example item helps distinguish an API omission from a parsing problem. Include the mode and filters so the behavior can be reproduced. Avoid posting private information in feedback. The Actor's dataset and snapshot records are intended to make source review practical when a value looks wrong.