Hacker News now has the API

2014-10-07 14:44:08 -0400
The purpose of releasing this API, according to this: http://blog.ycombinator.com/hacker-news-api, is that they are going to publish a new look of the hack news website. And before doing that they want all the scrappers of the current web pages have the time to convert to API-based data collecting

Here are the cURL examples of how the hacker news APIs work


## To get a list of top stories

$ curl 'https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty'
[ 8422599, 8422087, 8422581, 8422408, 8422051, 8421607, 8421656, 8420274, 8422864, 8420902, 8421518, 8421594, 8421866, 8421623, 8421807, 8420309, 8421147, 8421937, 8422094, 8421862, 8421263, 8421013, 8421466, 8419658, 8421238, 8421562, 8421790, 8421684, 8421375, 8419222, 8416393, 8419702, 8417062, 8421445, 8416693, 8421088, 8418836, 8419628, 8420918, 8420417, 8422928, 8421493, 8422278, 8422282, 8419807, 8415912, 8419984, 8422891, 8415647, 8420013, 8417343, 8419801, 8419803, 8422680, 8422592, 8420698, 8418865, 8419734, 8420199, 8421295, 8419210, 8418677, 8416455, 8421782, 8418588, 8421468, 8419867, 8420948, 8422750, 8419794, 8422490, 8420292, 8421302, 8411638, 8422690, 8422058, 8421021, 8415634, 8417178, 8422243, 8420597, 8421469, 8421056, 8422415, 8418020, 8421128, 8422013, 8421477, 8420766, 8422198, 8421850, 8414437, 8414752, 8416747, 8415029, 8419345, 8419386, 8417105, 8417825, 8421855 ]

## To get the detail of an item

$ curl 'https://hacker-news.firebaseio.com/v0/item/8422599.json?print=pretty'
{
"by" : "kevin",
"id" : 8422599,
"kids" : [ 8423025, 8422922, 8422904, 8422663, 8422889, 8423002, 8422941, 8423019, 8422991, 8422932, 8422736, 8422703, 8422684, 8422768, 8422995, 8422905, 8422661, 8422749, 8422933, 8422629, 8422893, 8422807, 8422771, 8422640 ],
"score" : 257,
"time" : 1412703525,
"title" : "Hacker News API",
"type" : "story",
"url" : "http://blog.ycombinator.com/hacker-news-api"
}


## To get a comment(an item in the kids)

$ curl 'https://hacker-news.firebaseio.com/v0/item/8423015.json?print=pretty'
{
"by" : "naiyt",
"id" : 8423015,
"kids" : [ 8423052 ],
"parent" : 8422087,
"text" : "So if you have an existing DigitalOcean account, it makes it seem like you can&#x27;t apply the promo code to it. But I shot off a ticket to DigitalOcean&#x27;s support, and they applied the $100 promo to my account within 5 minutes. So definitely send them a message if you have an existing account that you would like to have the credit applied.<p>Awesome pack, and great service from DigitalOcean as well.<p>Also of interest is that my account is apparently already flagged as a &quot;student account&quot; since I&#x27;ve gotten the 5 free private repos in the past with it. Which means once I hit &quot;Get your pack&quot; it immediately gave me access.",
"time" : 1412706798,
"type" : "comment"
}
«Newer      Older»
Comment:
Name:

Back to home

Subscribe | Register | Login | N