Hacker News
App · News · 5 actions
Read Hacker News: pull the Top, New, Best, Ask HN, Show HN, and Jobs story feeds, search stories and comments, fetch any item or a whole comment thread, and look up a user's profile.
Actions
| Action | What it does |
|---|---|
| Get item | Fetch a single Hacker News item (a story, comment, job, or poll) by its numeric id. |
| Get stories | Fetch a Hacker News story feed (Top, New, Best, Ask HN, Show HN, or Jobs) as full story records. |
| Get story with comments | Fetch a Hacker News story and every comment under it in one go, in reading order, each with how deeply it is nested. |
| Get user | Fetch a Hacker News user's public profile by username: their karma, account age, about text, and submitted-item ids. |
| Search Hacker News | Search Hacker News stories and comments by keyword, through Hacker News Search. |
Get item
Fetch a single Hacker News item (a story, comment, job, or poll) by its numeric id. A full news.ycombinator.com item URL is also accepted.
Inputs
- Item ID
item_idtextRequired - The numeric id of the item. Accepts a bare id or a full news.ycombinator.com/item?id=… URL.
Outputs
itemobject
Example output
{
"item": {
"by": "dhouston",
"dead": false,
"deleted": false,
"descendants": 71,
"hn_url": "https://news.ycombinator.com/item?id=8863",
"id": 8863,
"kids": [
8952,
9224,
8917
],
"parent": null,
"parts": [],
"poll": null,
"score": 104,
"text": null,
"time": 1175714200,
"time_iso": "2007-04-04T19:16:40+00:00",
"title": "My YC app: Dropbox - Throw away your USB drive",
"type": "story",
"url": "http://www.getdropbox.com/u/2/screencast.html"
}
}Get stories
Fetch a Hacker News story feed (Top, New, Best, Ask HN, Show HN, or Jobs) as full story records. Returns the stories in the feed's own ranking order.
Inputs
- Feed
story_typetext - Which story feed to pull. Defaults to Top stories.One of:
top(Top stories),new(New stories),best(Best stories),ask(Ask HN),show(Show HN),job(Jobs). - Number of stories
limitnumber - How many stories to return (1–100). Defaults to 10. Each story is fetched individually, so larger values take longer.From 1 to 100.
Outputs
result_countnumberresultsliststory_typetext
Example output
{
"result_count": 1,
"results": [
{
"by": "dhouston",
"dead": false,
"deleted": false,
"descendants": 71,
"hn_url": "https://news.ycombinator.com/item?id=8863",
"id": 8863,
"kids": [
8952,
9224,
8917
],
"parent": null,
"parts": [],
"poll": null,
"score": 104,
"text": null,
"time": 1175714200,
"time_iso": "2007-04-04T19:16:40+00:00",
"title": "My YC app: Dropbox - Throw away your USB drive",
"type": "story",
"url": "http://www.getdropbox.com/u/2/screencast.html"
}
],
"story_type": "top"
}Get story with comments
Fetch a Hacker News story and every comment under it in one go, in reading order, each with how deeply it is nested.
Inputs
- Story ID
item_idtextRequired - The story's numeric id, or its full news.ycombinator.com/item?id=… address.
Outputs
comment_countnumbercommentsliststoryobject
Example output
{
"comment_count": 1,
"comments": [
{
"author": "dhouston",
"created_at": "2007-04-04T19:22:55.000Z",
"depth": 1,
"hn_url": "https://news.ycombinator.com/item?id=8865",
"id": 8865,
"parent_id": 8863,
"text": "oh, and a mac port is coming :)"
}
],
"story": {
"author": "dhouston",
"created_at": "2007-04-04T19:16:40.000Z",
"hn_url": "https://news.ycombinator.com/item?id=8863",
"id": 8863,
"points": 104,
"text": null,
"title": "My YC app: Dropbox - Throw away your USB drive",
"type": "story",
"url": "http://www.getdropbox.com/u/2/screencast.html"
}
}Get user
Fetch a Hacker News user's public profile by username: their karma, account age, about text, and submitted-item ids. Usernames are case-sensitive.
Inputs
- Username
usernametextRequired - The case-sensitive username. Accepts a bare handle or a full news.ycombinator.com/user?id=… URL.
Outputs
userobject
Example output
{
"user": {
"about": "Bug fixer.",
"created": 1160418092,
"created_iso": "2006-10-09T18:21:32+00:00",
"hn_url": "https://news.ycombinator.com/user?id=pg",
"id": "pg",
"karma": 157316,
"submitted": [
39667625,
37278578,
37278345
],
"submitted_count": 3
}
}Search Hacker News
Search Hacker News stories and comments by keyword, through Hacker News Search. Narrow it to one kind of post or one author, and sort by relevance or newest first.
Inputs
- Search for
querytext - The words to look for. Leave blank to list the latest posts of the kind or author chosen below.
- Kind
post_typetext - Only this kind of post. Leave blank for all.One of:
story(Stories),comment(Comments),poll(Polls),show_hn(Show HN),ask_hn(Ask HN),front_page(On the front page now). - Author
authortext - Only posts by this username.
- Sort by
ordertext - Most relevant first (the default) or newest first.One of:
relevance(Most relevant),newest. Default:relevance. - Number of results
limitnumber - How many results to return (1–100). Defaults to 10.From 1 to 100.
Outputs
result_countnumberresultslisttotal_matchesnumber
Example output
{
"result_count": 1,
"results": [
{
"author": "dhouston",
"created_at": "2007-04-04T19:16:40.000Z",
"hn_url": "https://news.ycombinator.com/item?id=8863",
"id": 8863,
"kind": "story",
"num_comments": 71,
"parent_id": null,
"points": 104,
"story_id": 8863,
"text": null,
"title": "My YC app: Dropbox - Throw away your USB drive",
"url": "http://www.getdropbox.com/u/2/screencast.html"
}
],
"total_matches": 1
}