Hacker News Stories & Comments Scraper avatar

Hacker News Stories & Comments Scraper

Pricing

Pay per event

Go to Apify Store
Hacker News Stories & Comments Scraper

Hacker News Stories & Comments Scraper

Extract trending tech discussions, nested comment hierarchies, and post scores from Hacker News directly into structured JSON for custom RAG pipelines.

Pricing

Pay per event

Rating

0.0

(0)

Developer

太郎 山田

太郎 山田

Maintained by Community

Actor stats

0

Bookmarked

3

Total users

1

Monthly active users

8 days ago

Last modified

Share

📰 Hacker News Scraper

Feed your artificial intelligence pipelines and custom RAG applications with high-quality, vetted tech discussions by extracting data directly from Hacker News. This robust Hacker News scraper is purpose-built for AI researchers, data scientists, and developer teams who require highly structured conversational text to train sentiment analysis models and build search aggregators. By bypassing fragile web page HTML parsing and querying the official Firebase API directly, the scraper ensures your extraction tasks run flawlessly and return perfectly formatted JSON results every time.

Automate your data collection workflow by scheduling the scraper to run on a daily or weekly basis. You can effortlessly scrape the top 100 trending posts alongside their complete, nested comment hierarchies. Filter the extracted results by setting a minimum score threshold, guaranteeing you only collect meaningful text that has gained genuine traction within the developer community. This targeted extraction is ideal for teams building AI agents designed to summarize emerging GitHub repositories, track new developer tools, or analyze sentiment around newly released AI research papers.

The scraped data is delivered in a highly structured format, granting you deep programmatic access to multi-level nested comment trees, detailed author profiles, precise post scores, and external URLs. Stop manually scraping unstructured websites or struggling with brittle CSS selectors. With this extractor, you can reliably capture the internet's most valuable tech insights and seamlessly integrate them into your overarching data strategy.

Store Quickstart

Start with the Quickstart template (top stories, 20 items). For tech trend monitoring, use Top Trends with minScore=100 and domain analysis.

Key Features

  • 🔥 Official Firebase API — hacker-news.firebaseio.com — 10+ year stable
  • 📂 6 story modes — top, new, best, ask, show, job
  • Score filtering — Minimum score threshold for quality filtering
  • 💬 Comment threads — Optional nested comment extraction
  • 🏷️ Top domains analysis — Which domains dominate the front page
  • 🔑 No API key needed — Public Firebase API

Use Cases

WhoWhy
Tech journalistsDaily Hacker News trend reports
Startup foundersWatch which tools/frameworks gain HN traction
VCs/InvestorsSignal for emerging tech and founder announcements
Developer tool companiesMonitor HN sentiment on products and competitors
AI/ML researchersDiscover papers and repos trending in tech community

Input

FieldTypeDefaultDescription
modestringtoptop, new, best, ask, show, job
maxItemsinteger30Max stories (1-500)
minScoreinteger0Minimum score filter
includeCommentsbooleanfalseInclude comment threads

Input Example

{
"mode": "top",
"maxItems": 30,
"minScore": 100,
"includeComments": false
}

Input Examples

Example: Top stories snapshot

{
"feed": "topstories",
"maxStories": 30,
"commentDepth": 1
}

Example: Keyword search across history

{
"query": "Rust",
"maxResults": 100,
"sortBy": "byPopularity"
}

Example: Story + full comment tree

{
"storyIds": [
42096277
],
"commentDepth": 5
}

Output

FieldTypeDescription
idintegerHN story ID
titlestringStory title
urlstringExternal URL (if any)
authorstringHN username
scoreintegerUpvote score
numCommentsintegerComment count
createdAtstringISO timestamp
hnUrlstringHacker News thread URL
commentsobject[]Top comments (if includeComments enabled)

Output Example

{
"id": 12345678,
"title": "Claude 4.5 released with new features",
"url": "https://anthropic.com/news/claude-4-5",
"score": 523,
"by": "user123",
"time": 1712345678,
"descendants": 142,
"type": "story"
}

API Usage

Run this actor programmatically using the Apify API. Replace YOUR_API_TOKEN with your token from Apify Console → Settings → Integrations.

cURL

curl -X POST "https://api.apify.com/v2/acts/taroyamada~hacker-news-intelligence/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "mode": "top", "maxItems": 30, "minScore": 100, "includeComments": false }'

Python

from apify_client import ApifyClient
client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("taroyamada/hacker-news-intelligence").call(run_input={
"mode": "top",
"maxItems": 30,
"minScore": 100,
"includeComments": false
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item)

JavaScript / Node.js

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('taroyamada/hacker-news-intelligence').call({
"mode": "top",
"maxItems": 30,
"minScore": 100,
"includeComments": false
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

Tips & Limitations

  • Use mode: "top" for the front page, "new" for breaking submissions.
  • Set minScore: 50 to filter out noise and focus on signal.
  • Schedule daily to track trending dev/startup topics.
  • Combine with Article Content Extractor to fetch full content of linked stories.

FAQ

What does score mean?

Net upvotes (upvotes minus downvotes). 100+ is front-page quality. 500+ is viral.

How often does the HN front page update?

Rapidly — rankings shift every few minutes. Scrape hourly for trend tracking.

Can I get old/archived stories?

Yes, the 'new' mode iterates chronologically; 'best' returns high-score stories over time.

What's the comment limit?

All comments under a story are available via the API. Comment-heavy posts slow down extraction.

What's the difference vs the official HN API?

This actor handles pagination, deduplication, comment threading, and outputs to Apify dataset — no SDK needed.

Can I search HN by keyword?

Use the Algolia HN search API for keyword search. This actor focuses on top/new/best feeds.

News & Content cluster — explore related Apify tools:

Cost

Pay Per Event:

  • actor-start: $0.01 (flat fee per run)
  • dataset-item: $0.003 per output item

Example: 1,000 items = $0.01 + (1,000 × $0.003) = $3.01

No subscription required — you only pay for what you use.

⭐ Was this helpful?

If this actor saved you time, please leave a ★ rating on Apify Store. It takes 10 seconds, helps other developers discover it, and keeps updates free.

Bug report or feature request? Open an issue on the Issues tab of this actor.