Hacker News — top stories
v1PublishedTop 10 Hacker News front-page stories, refreshed hourly — rank, title, url, points, comments.
›Author's sample data
| stories |
|---|
›Publisher
3 subscribersEvery hour9 runs in 14d · published 1d ago
›Versions
managed by authorv1importedapprovedcurrent1d ago
Schedulesdeploy to enable
Run this collector on a cadence — daily, hourly, your call.
API endpointdeploy to unlock
POST to run it on demand and get fresh data in the response.
Activitydeploy to track
9 subscriber runs in the last 14 days.
How this script collects data
import Firecrawl from "@mendable/firecrawl-js";
const apiKey = process.env.FIRECRAWL_API_KEY;
if (!apiKey) { console.error("FIRECRAWL_API_KEY is not set"); process.exit(1); }
const firecrawl = new Firecrawl({ apiKey });
async function main() {
const schema = {
type: "object",
properties: {
stories: {
type: "array",
items: {
type: "object",
properties: {
rank: { type: "number" }, title: { type: "string" }, url: { type: "string" },
points: { type: "number" }, comments: { type: "number" },
},
required: ["rank", "title", "url"],
},
},
},
required: ["stories"],
};
const result = await firecrawl.scrape("https://news.ycombinator.com", {
formats: [{ type: "json", prompt: "Extract the top 10 front-page stories in order.", schema }],
});
const data = (result as { json?: { stories?: unknown[] } }).json ?? { stories: [] };
const out = { stories: (data.stories ?? []).slice(0, 10) };
process.stdout.write(JSON.stringify(out));
}
main().catch((err) => { console.error(err); process.exit(1); });
Build prompt
Top 10 Hacker News front-page stories with rank, title, url, points, and comment count