Polls the HackerNews Firebase API for new stories. No authentication required.
from streams.hackernews import HackerNewsStream
stream = HackerNewsStream(limit=25)
await stream.start()
async for event in stream:
story = event.payload
print(f"{story.title} (+{story.score}) by {story.author}")
print(f" {story.url or story.permalink}")Base URL: https://hacker-news.firebaseio.com/v0
GET /newstories.json— list of up to 500 newest story IDsGET /item/{id}.json— individual item details
| Field | Type | Description |
|---|---|---|
id |
str |
Story ID |
title |
str |
Story title |
author |
str |
Username of submitter |
url |
str | None |
Link URL; None for Ask HN / Show HN text posts |
text |
str | None |
HTML body for text posts; None for link posts |
score |
int |
Current points |
comments |
int |
Number of comments (descendants) |
created_at |
datetime |
Submission time (UTC) |
permalink |
str |
https://news.ycombinator.com/item?id={id} |
No environment variables required. The stream polls every 30 seconds and fetches up to limit new stories per cycle.
# Optional: override config
from streams.config import HackerNewsConfig
stream = HackerNewsStream(limit=10, config=HackerNewsConfig(base_url="..."))