hackernews / README.md
adhikasp's picture
README: quick starts, drop open-index mention
561b916 verified
|
Raw History Blame Contribute Delete
4.19 kB
metadata
license: odc-by
language:
  - en
pretty_name: Hacker News items (parquet, monthly)
size_categories:
  - 10M<n<100M
task_categories:
  - text-generation
  - text-classification
  - feature-extraction
tags:
  - hacker-news
  - forum
  - parquet
  - comments
  - live-updated
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/*/*/data.parquet

Hacker News items, monthly parquet

Every Hacker News item (stories, comments, jobs, polls, poll options) from 2007-02 to the present, fetched from the official Firebase API. About 50M items in 7.3 GiB (zstd level 15), one parquet file per month at data/year=YYYY/month=M/data.parquet, each sorted by id. Updated roughly weekly.

Companion dataset with LLM-judge labels per comment: adhikasp/hackernews-annotation (joins on id).

Schema

column type notes
id int64 HN item id, unique
time timestamp naive timestamp in UTC+7 (matches the original dataset this one continues); files are partitioned by it
type string story, comment, job, poll, pollopt
by string author username (null if deleted)
title, url, text string text is HTML as served by the API
score, descendants double stories/polls
parent double comments and poll options
poll double for poll options
parts, kids list poll options, child comment ids
dead, deleted bool null when false

Counts (2026-11-28): comments 44.06M, stories 6.36M, jobs 18k, polls 2.3k, poll options 16k.

Quick start

Pick whichever fits. Each month is one file (max ~97 MB), so filter by path to read less.

DuckDB (no download, reads straight from the Hub)

import duckdb
duckdb.sql("""
  select by, count(*) n from 'hf://datasets/adhikasp/hackernews/data/year=2025/*/data.parquet'
  where type='comment' group by 1 order by n desc limit 10
""").show()

DuckDB CLI

INSTALL httpfs; LOAD httpfs;
SELECT title, score FROM 'hf://datasets/adhikasp/hackernews/data/year=2026/month=11/data.parquet'
WHERE type='story' ORDER BY score DESC LIMIT 10;

Polars (lazy, only fetches what it needs)

import polars as pl
lf = pl.scan_parquet("hf://datasets/adhikasp/hackernews/data/year=2025/*/data.parquet")
lf.filter(pl.col("type") == "story").select("title", "score").sort("score", descending=True).head(10).collect()

pandas

import pandas as pd
df = pd.read_parquet("hf://datasets/adhikasp/hackernews/data/year=2026/month=11/data.parquet")

Hugging Face datasets (streaming, nothing stored)

from datasets import load_dataset
ds = load_dataset("adhikasp/hackernews", split="train", streaming=True)
for row in ds.take(3): print(row["id"], row["type"], row["title"])

Download a slice

hf download adhikasp/hackernews --repo-type dataset --include "data/year=2025/*" --local-dir hn
# or one month with plain curl
curl -LO "https://huggingface.co/datasets/adhikasp/hackernews/resolve/main/data/year=2026/month=11/data.parquet"

Whole dataset (7.3 GiB): hf download adhikasp/hackernews --repo-type dataset --local-dir hn, then duckdb.sql("select count(*) from 'hn/data/*/*/data.parquet'").

Mirror without the Hub: https://hacker-news.adhikasp.id/year=2025/month=1/data.parquet (same files).

Handy queries

-- most-discussed stories of a month
select title, score, descendants from 'hf://datasets/adhikasp/hackernews/data/year=2025/month=1/data.parquet'
where type='story' order by descendants desc limit 10;
-- comments per month in a year
select month, count(*) from 'hf://datasets/adhikasp/hackernews/data/year=2025/*/data.parquet'
where type='comment' group by 1 order by 1;

Notes

  • Items fetched live can still change (scores, new kids, deletions). The current and previous month are refreshed on each update; older months are stable.
  • Gaps in id are items the API returns as null (never existed or purged).
  • Hacker News content belongs to its authors and Y Combinator; this is a mirror of what the public API serves.

Source/fetcher: hn-data-fetcher (PyPI, GitHub adhikasp/hn-data-fetcher).