Skip to Content
API 參考Hacker News

Hacker News

科技新聞聚合平台 — 故事、項目、用戶與留言。

  • 故事:熱門、最新、精選、問答、展示與職缺故事
  • 項目:依 ID 取得任何項目(故事、留言、職缺、投票)
  • 用戶:用戶資料含 karma 值與投稿記錄
  • 留言:可設定深度的遞迴留言樹

項目

GET /hackernews/items/:itemId — 1 點數

依 ID 取得 Hacker News 項目(故事、留言、職缺、投票)。

參數類型必填預設說明
itemIdintegerHacker News 項目 ID
curl -H "x-api-key: sk_byc_xxx" \ https://api.bycrawl.com/hackernews/items/8863

回應

{ "id": 8863, "type": "story", "by": "dhouston", "time": 1175714200, "timeISO": "2007-04-04T19:16:40.000Z", "title": "My YC app: Dropbox - Throw away your USB drive", "url": "http://www.getdropbox.com/u/2/screencast.html", "text": null, "score": 104, "descendants": 71, "commentIds": [9224, 8917, 8884], "parent": null, "deleted": false, "dead": false, "hnUrl": "https://news.ycombinator.com/item?id=8863" }

用戶

GET /hackernews/users/:username — 1 點數

依用戶名取得 Hacker News 用戶資料。

參數類型必填預設說明
usernamestringHacker News 用戶名(區分大小寫)
curl -H "x-api-key: sk_byc_xxx" \ https://api.bycrawl.com/hackernews/users/pg

回應

{ "id": "pg", "karma": 157316, "about": "Bug fixer.", "created": 1160418092, "createdISO": "2006-10-09T18:21:32.000Z", "submissionCount": 15565, "recentSubmissions": [39667625, 37278578, 37278345] }

故事

GET /hackernews/stories/:storyType — 2 點數

依類型取得 Hacker News 故事。

參數類型必填預設說明
storyTypestring故事類型:topnewbestaskshowjob
countinteger30故事數量(最多 50)
curl -H "x-api-key: sk_byc_xxx" \ "https://api.bycrawl.com/hackernews/stories/top?count=10"

回應

{ "stories": [ { "id": 47372367, "type": "story", "by": "vinhnx", "time": 1773451908, "timeISO": "2026-03-14T01:31:48.000Z", "title": "JPEG Compression", "url": "https://www.sophielwang.com/blog/jpeg", "score": 162, "descendants": 30, "hnUrl": "https://news.ycombinator.com/item?id=47372367" } ], "storyType": "top", "total": 500 }

留言

GET /hackernews/items/:itemId/comments — 2 點數

取得 Hacker News 項目的留言樹。

參數類型必填預設說明
itemIdintegerHacker News 項目 ID
depthinteger3最大留言深度(最多 5)
curl -H "x-api-key: sk_byc_xxx" \ "https://api.bycrawl.com/hackernews/items/8863/comments?depth=2"

回應

{ "item": { "id": 8863, "type": "story", "by": "dhouston", "title": "My YC app: Dropbox - Throw away your USB drive", "score": 104, "descendants": 71, "hnUrl": "https://news.ycombinator.com/item?id=8863" }, "comments": [ { "comment": { "id": 9224, "type": "comment", "by": "BrandonM", "time": 1175786214, "timeISO": "2007-04-05T15:16:54.000Z", "text": "Looks like a great idea...", "parent": 8863, "hnUrl": "https://news.ycombinator.com/item?id=9224" }, "replies": [] } ], "totalComments": 71 }