This is an unofficial API for Y Combinator's HackerNews that was developed for iHackerNews.com (a mobile version of HN). It allows you to programmatically retrieve data and interact with news.ycombinator.com. Data is cached anywhere from 2 to 4 minutes. Requests to news.ycombinator.com are throttled at a resonable rate -- cache hits are not throttled.
Authentication is only required for voting and commenting. You should keep in mind that I’m not affiliated with Y Combinator in any way, I’m not evil, but you don’t know that. I do not store, and never will store, passwords or auth tokens – I only proxy them to ycombinator.
If you find this useful and would like to use it, please do. If you want to say “thanks”, please provide a link to my homepage or @ronnieroller.
I was able to compile the HN database. I'm making it available for download through bittorrent for the community to use. It's in XML format. As of November 7, 2010 there are 1,707,850 items in the database, which covers most of what's on HN. There's a few missing items, mostly deeply nested comments -- this will be fixed in time.
Below is an example of the XML for a post. AskHN has an empty Url field with the text in the Text field. Posts are type=1. Comments are type=2. Comments have an emtpy Url field with the comment stored in the Text field. Timestamps are accurate to the day.
<HackerNews>
<row>
<ID>1</ID>
<Url>http://ycombinator.com</Url>
<Title>Y Combinator</Title>
<Text />
<Username>pg</Username>
<Points>39</Points>
<Type>1</Type>
<Timestamp>2006-10-09T20:33:12.700</Timestamp>
<CommentCount>15</CommentCount>
<ParentID />
</row>
</HackerNews>
Download: The database download has been disabled.
Special thanks to Jonathan Keith, Joseph Turian (HN bravura), and Steve Morin for help in creating this database.
Data can be requested in JSON, JSONP, or XML formats. The default is JSON. To ask for another type, append the format to the querystring. Example:
http://api.ihackernews.com/page
http://api.ihackernews.com/page?format=jsonp&callback=yourFunction
http://api.ihackernews.com/page?format=xml
http://api.ihackernews.com/getid?url={url} Note, {url} needs to be urlencoded.GEThttp://api.ihackernews.com/page or http://api.ihackernews.com/page/{nextId}GEThttp://api.ihackernews.com/by/{username} or http://api.ihackernews.com/by/{username}/{nextId}GEThttp://api.ihackernews.com/new or http://api.ihackernews.com/new/{nextId}GEThttp://api.ihackernews.com/newcommentsGEThttp://api.ihackernews.com/ask or http://api.ihackernews.com/ask/{nextId}GEThttp://api.ihackernews.com/post/{id} {id} is the integer ID of the post.GEThttp://api.ihackernews.com/comments/{id} {id} is the integer ID of the post.GEThttp://api.ihackernews.com/threads/{userID}GEThttp://api.ihackernews.com/profile/{userID}GEThttp://api.ihackernews.com/loginPOST. {username}, {password}http://api.ihackernews.com/votePOST. {username}, {token}, {id} integer id of comment or post, {direction} up or down, up is defaulthttp://api.ihackernews.com/commentPOST. {username}, {token}, {id} integer id of parent comment or post, {comment}