最后更新
更新日志/front5 credits per call首页
按 HN 排名顺序返回 Hacker News 首页上的帖子,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。data.next 为下一页的参数,最后一页时为 null。
Authorization: Bearer <key> on every request.Parameters
page number, 1 to 17 (30 stories per page).
Response fields
feede.g."front"pagee.g.1counte.g.30stories
ranke.g.1ide.g.50663595titlee.g."The group chat where your AI talks behind your back"urle.g."https://construct22.com/"sitee.g."construct22.com"pointse.g.238authore.g."utiiiD"comment_counte.g.104agee.g."3 hours ago"posted_ate.g."2026-11-27T06:44:34Z"typee.g."story"hn_urle.g."https://news.ycombinator.com/item?id=50663595"next
pe.g."2"pagination
counte.g.30has_moree.g.falsenext_cursorfetched_ate.g."2026-11-27T10:11:48.780Z"agee.g.0curl "https://api.maviapi.com/v1/sites/hackernews/front?p=1" \-H "Authorization: Bearer $MAVI_KEY"
{
"feed": "front",
"page": 1,
"count": 30,
"stories": [
{
"rank": 1,
"id": 50663595,
"title": "The group chat where your AI talks behind your back",
"url": "https://construct22.com/",
"site": "construct22.com",
"points": 238,
"author": "utiiiD",
"comment_count": 104,
"age": "3 hours ago",
"posted_at": "2026-11-27T06:44:34Z",
"type": "story",
"hn_url": "https://news.ycombinator.com/item?id=50663595"
}
],
"next": {
"p": "2"
},
"pagination": {
"count": 30,
"has_more": false,
"next_cursor": null
},
"fetched_at": "2026-11-27T10:11:48.780Z",
"age": 0
}Get all the data, no code
Collect every page of GET /front into a dataset, for one request or for a whole list of them, then download it as CSV or JSON. A page costs the same as one call of the endpoint; the download is free.
Use Hacker News API from Claude, ChatGPT and your coding tools
Add this URL as a custom connector and sign in to maviapi. Nothing to install.
https://mcp.maviapi.com/mcpOr run it locally, with each endpoint of Hacker News API as its own tool:
claude mcp add maviapi -e MAVIAPI_TOOLS=hackernews -- npx -y '@maviapi/mcp'Import Hacker News API into Postman and other tools
How to importPaste a link into Postman, Insomnia, an agent framework or a no-code tool to get every endpoint with its parameters and response fields. The link always serves the current endpoints, so importing it again picks up new ones.
- OpenAPI 3.1
https://api.maviapi.com/v1/apis/hackernews/openapi.json - Postman
https://api.maviapi.com/v1/apis/hackernews/postman.json
The Postman collection sends the shared demo key until you put your own key in its maviapi_key variable.
使用 Hacker News API 进行开发
选择一个端点开始
- 首页
GET /front按 HN 排名顺序返回 Hacker News 首页上的帖子,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。data.next 为下一页的参数,最后一页时为 null。
GET /front 的参数和响应字段
请求参数 名称 类型 / 位置 必填 说明 p integer / query 否 page number, 1 to 17 (30 stories per page). 响应字段 字段 类型 说明 feed string page integer count integer stories object[] stories[].rank integer stories[].id integer stories[].title string stories[].url string stories[].site string stories[].points integer stories[].author string stories[].comment_count integer stories[].age string stories[].posted_at string stories[].type string stories[].hn_url string next object next.p string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor null fetched_at string age integer - Ask HN
GET /ask按 HN 排名顺序返回 Ask HN 帖子,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。data.next 为下一页的参数,最后一页时为 null。
GET /ask 的参数和响应字段
请求参数 名称 类型 / 位置 必填 说明 p integer / query 否 page number, 1 to 17 (30 stories per page). 响应字段 字段 类型 说明 feed string page integer count integer stories object[] stories[].rank integer stories[].id integer stories[].title string stories[].url string stories[].site null stories[].points integer stories[].author string stories[].comment_count integer stories[].age string stories[].posted_at string stories[].type string stories[].hn_url string next object next.p string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor null fetched_at string age integer - 条目
GET /item/{id}按 id 获取单个 Hacker News 条目(帖子、Ask/Show HN、招聘、投票或单条评论):type、title、url、site、text、points、author、comment_count、age、posted_at(UTC),评论另含 parent_id / story_id / story_title,投票另含 poll_options,并以嵌套树形式返回完整评论串(顶层按 HN 顺序排列,每条评论包含 id、author、age、posted_at、depth、parent_id、纯文本、原始 html、删除标记和 replies)。thread_source 为 "algolia" 表示完整评论树;条目过新尚未被索引时为 "firebase",表示有限范围的实时遍历结果。
GET /item/{id} 的参数和响应字段
请求参数 名称 类型 / 位置 必填 说明 id integer / path 是 Hacker News item id. 响应字段 字段 类型 说明 id integer type string title string url string site string text null points integer author string comment_count integer age string posted_at string parent_id null story_id null story_title null poll_options null hn_url string comments_total integer comments object[] comments[].id integer comments[].author string comments[].age string comments[].posted_at string comments[].depth integer comments[].parent_id integer comments[].text string comments[].html string comments[].deleted boolean comments[].replies object[] comments[].replies[].id integer comments[].replies[].author string comments[].replies[].age string comments[].replies[].posted_at string comments[].replies[].depth integer comments[].replies[].parent_id integer comments[].replies[].text string comments[].replies[].html string comments[].replies[].deleted boolean comments[].replies[].replies object[] comments[].replies[].replies[].id integer comments[].replies[].replies[].author string comments[].replies[].replies[].age string comments[].replies[].replies[].posted_at string comments[].replies[].replies[].depth integer comments[].replies[].replies[].parent_id integer comments[].replies[].replies[].text string comments[].replies[].replies[].html string comments[].replies[].replies[].deleted boolean comments[].replies[].replies[].replies object[] comments[].replies[].replies[].replies[].id integer comments[].replies[].replies[].replies[].author string comments[].replies[].replies[].replies[].age string comments[].replies[].replies[].replies[].posted_at string comments[].replies[].replies[].replies[].depth integer comments[].replies[].replies[].replies[].parent_id integer comments[].replies[].replies[].replies[].text string comments[].replies[].replies[].replies[].html string comments[].replies[].replies[].replies[].deleted boolean comments[].replies[].replies[].replies[].replies object[] comments[].replies[].replies[].replies[].replies[].id integer comments[].replies[].replies[].replies[].replies[].author string comments[].replies[].replies[].replies[].replies[].age string comments[].replies[].replies[].replies[].replies[].posted_at string comments[].replies[].replies[].replies[].replies[].depth integer comments[].replies[].replies[].replies[].replies[].parent_id integer comments[].replies[].replies[].replies[].replies[].text string comments[].replies[].replies[].replies[].replies[].html string comments[].replies[].replies[].replies[].replies[].deleted boolean comments[].replies[].replies[].replies[].replies[].replies object[] comments[].replies[].replies[].replies[].replies[].replies[].id integer comments[].replies[].replies[].replies[].replies[].replies[].author string comments[].replies[].replies[].replies[].replies[].replies[].age string comments[].replies[].replies[].replies[].replies[].replies[].posted_at string comments[].replies[].replies[].replies[].replies[].replies[].depth integer comments[].replies[].replies[].replies[].replies[].replies[].parent_id integer comments[].replies[].replies[].replies[].replies[].replies[].text string comments[].replies[].replies[].replies[].replies[].replies[].html string comments[].replies[].replies[].replies[].replies[].replies[].deleted boolean comments[].replies[].replies[].replies[].replies[].replies[].replies string[] thread_source string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor null - 信息流
GET /feed按 HN 顺序返回 Hacker News 帖子列表的第一页(30 条帖子),每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type、hn_url 和 comments。传入 comments=true 时,前 `top` 条帖子附带按 HN 顺序排列的顶层评论,每条顶层评论包含其直接回复;其余帖子的 comments 为 null。
GET /feed 的参数和响应字段
请求参数 名称 类型 / 位置 必填 说明 type string / query 否 which story list: front, newest, ask or show. 可选值: front, newest, ask, show. comments boolean / query 否 attach top comments to the first `top` stories. top integer / query 否 how many stories to enrich with comments (1-5). 可选值: 1, 2, 3, 4, 5. comments_per_story integer / query 否 top-level comments, and direct replies under each, per enriched story (1, 3, 5 or 10). 可选值: 1, 3, 5, 10. 响应字段 字段 类型 说明 feed string with_comments boolean enriched integer count integer stories object[] stories[].rank integer stories[].id integer stories[].title string stories[].url string stories[].site string stories[].points integer stories[].author string stories[].comment_count integer stories[].age string stories[].posted_at string stories[].type string stories[].hn_url string stories[].comments null pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor null fetched_at string age integer - 最新
GET /newestHacker News 最新提交的帖子,按时间倒序排列,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。data.next 为下一页的参数,最后一页时为 null。
GET /newest 的参数和响应字段
请求参数 名称 类型 / 位置 必填 说明 p integer / query 否 page number, 1 to 17 (30 stories per page). 响应字段 字段 类型 说明 feed string page integer count integer stories object[] stories[].rank integer stories[].id integer stories[].title string stories[].url string stories[].site string stories[].points integer stories[].author string stories[].comment_count integer stories[].age string stories[].posted_at string stories[].type string stories[].hn_url string next object next.p string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor null fetched_at string age integer - Show HN
GET /show按 HN 排名顺序返回 Show HN 帖子,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。data.next 为下一页的参数,最后一页时为 null。
GET /show 的参数和响应字段
请求参数 名称 类型 / 位置 必填 说明 p integer / query 否 page number, 1 to 17 (30 stories per page). 响应字段 字段 类型 说明 feed string page integer count integer stories object[] stories[].rank integer stories[].id integer stories[].title string stories[].url string stories[].site string stories[].points integer stories[].author string stories[].comment_count integer stories[].age string stories[].posted_at string stories[].type string stories[].hn_url string next object next.p string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor null fetched_at string age integer - 最佳
GET /bestHacker News 最佳帖子(近期得票最高),按排名排列,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。data.next 为下一页的参数,最后一页时为 null。
GET /best 的参数和响应字段
请求参数 名称 类型 / 位置 必填 说明 p integer / query 否 page number, 1 to 7 (30 stories per page). 响应字段 字段 类型 说明 feed string page integer count integer stories object[] stories[].rank integer stories[].id integer stories[].title string stories[].url string stories[].site string stories[].points integer stories[].author string stories[].comment_count integer stories[].age string stories[].posted_at string stories[].type string stories[].hn_url string next object next.p string pagination object pagination.count integer pagination.has_more boolean pagination.next_cursor null fetched_at string age integer
将 Hacker News 数据导出为 CSV
下面的每个列表都可以下载为 CSV 文件,每条记录一行。用上方控制台下面的 "Get all the data, no code" 卡片把列表收集到数据集中。数据集会逐页读取列表,之后可下载为 CSV、JSON 或 JSONL。
| 列表 | CSV 列 |
|---|---|
首页GET /front | rank, id, title, url, site, points, author, comment_count, age, posted_at, type, hn_url |
Ask HNGET /ask | rank, id, title, url, site, points, author, comment_count, age, posted_at, type, hn_url |
条目GET /item/{id} | id, author, age, posted_at, depth, parent_id, text, html, deleted, replies |
信息流GET /feed | rank, id, title, url, site, points, author, comment_count, age, posted_at, type, hn_url, comments |
最新GET /newest | rank, id, title, url, site, points, author, comment_count, age, posted_at, type, hn_url |
Show HNGET /show | rank, id, title, url, site, points, author, comment_count, age, posted_at, type, hn_url |
最佳GET /best | rank, id, title, url, site, points, author, comment_count, age, posted_at, type, hn_url |
嵌套的值(列表或对象)以 JSON 写入同一个单元格。 数据集和导出如何工作
Hacker News API 常见问题
能获取什么数据、费用多少、如何调用。
Hacker News 有官方 API 吗?
有,Hacker News 提供自己的 API:Hacker News API(核实日期:2026-11-25)。本页的 Hacker News API 与它无关,是非官方 API:它是 maviapi 针对 news.ycombinator.com 上的公开数据提供的独立托管 API,并非由 Hacker News 开发、认可或支持。
Hacker News API 可以获取哪些数据?
Hacker News API 有 7 个端点。每个端点都返回 JSON,参数和字段见上方的文档:
- GET
/front: 按 HN 排名顺序返回 Hacker News 首页上的帖子,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。 - GET
/ask: 按 HN 排名顺序返回 Ask HN 帖子,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。 - GET
/item/{id}: 按 id 获取单个 Hacker News 条目(帖子、Ask/Show HN、招聘、投票或单条评论):type、title、url、site、text、points、author、comment_count、age、posted_at(UTC),评论另含 parent_id / story_id /… - GET
/feed: 按 HN 顺序返回 Hacker News 帖子列表的第一页(30 条帖子),每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type、hn_url 和 comments。 - GET
/newest: Hacker News 最新提交的帖子,按时间倒序排列,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。 - GET
/show: 按 HN 排名顺序返回 Show HN 帖子,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。 - GET
/best: Hacker News 最佳帖子(近期得票最高),按排名排列,每页 30 条,每条包含 rank、id、title、url、site、points、author、comment_count、age、posted_at(UTC)、type 和 hn_url。
Hacker News API 的价格是多少?
调用用您 maviapi 套餐中的积分支付,只有成功的调用才会计费。此 API 的每个端点每次调用消耗 5 个积分。在 Hobby 套餐下(每月 $49,含 250,000 个积分),1,000 次调用约 $0.98。失败的调用不收费。Free 套餐每月提供 1,000 个积分,无需信用卡。超出部分请查看套餐和积分价格。
如何调用 Hacker News API?
向端点发送 HTTPS 请求,并在 Authorization 请求头中带上您的 API 密钥。例如 GET /front:
curl 'https://api.maviapi.com/v1/sites/hackernews/front' \
-H "Authorization: Bearer $MAVI_KEY"在您的 API 密钥页面创建密钥,或者先在上方的控制台中用免费测试密钥试用任意端点。
以 JSON 获取 Hacker News 数据有哪些方式?
以 JSON 获取 Hacker News 数据的每种方式适合不同的需求:
- Hacker News API: 需要写入权限、账号数据或与 Hacker News 签订协议时更合适。
- 自己写爬虫: 完全由自己掌控,不依赖任何服务商,但解析、被拦截的请求以及 news.ycombinator.com 每次改版后的修复都要自己负责。更适合从很少变化的页面一次性获取数据。
- Apify: 一个 Actor 市场,Actor 由您自己运行,输入、输出和价格由各个 Actor 决定。当已有 Actor 能返回您需要的数据,或者您想托管自己的代码时更合适。参见maviapi 与 Apify 的对比。
- RapidAPI: 一个汇集了众多提供方 API 的平台,用一个 RapidAPI 密钥调用,每个 API 单独定价。当您已经在使用该平台,并且其中某个 API 能满足需求时更合适。来源:RapidAPI docs。
- maviapi: 本页的 Hacker News API:7 个带文档的端点、公开的响应结构,以及一个可用于整个目录的密钥。当这些数据是您产品的一部分,而您不想维护爬虫时更合适。
news.ycombinator.com 改版后会怎样?
更新会破坏我的 Hacker News API 集成吗?
不会。您正在使用的端点,其结构永远不会改变:新的字段、可选参数和端点只会加在旁边,会破坏调用的变更则作为新端点发布。请忽略您不认识的响应字段,新内容请关注更新日志。
相关 API
- Hürriyet API
来自 Hürriyet 的最新土耳其新闻:汇总各栏目(gündem、ekonomi、dünya、spor 等)、按时间从新到旧排列的综合新闻流,包含标题、摘要、图片、栏目、发布时间、作者、URL…
- Tripadvisor API
来自 Tripadvisor 的行程规划数据:支持地点搜索,并可按地点(geo_id)获取景点、餐厅和酒店,包含评分、评论、价格和坐标。先用 /search 解析地名,再通过…
- Google Maps API
来自 maps.google.com 的结构化数据。