

Show HN: News API - blackjable
http://hackednews.herokuapp.com/
The resources are transmitted via JSON responses. This was a bit of fun.<p>API:<p>{path:&quot;&#x2F;&quot;},
{path:&quot;&#x2F;news&quot;},
{path:&quot;&#x2F;news2&quot;},
{path:&quot;&#x2F;newest&quot;},
{path:&quot;&#x2F;newcomments&quot;},
{path:&quot;&#x2F;ask&quot;},
{path:&quot;&#x2F;x&quot;, uri: (req) -&gt; &quot;&#x2F;x?fnid=#{req.query.fnid}&quot; },
{path:&quot;&#x2F;user&quot;, uri: (req) -&gt; &quot;&#x2F;user?id=#{req.query.id}&quot; },
{path:&quot;&#x2F;item&quot;, uri: (req) -&gt; &quot;&#x2F;item?id=#{req.query.id}&quot;},
{path:&quot;&#x2F;submitted&quot;, uri: (req) -&gt; &quot;&#x2F;submitted?id=#{req.query.id}&quot;},
{path:&quot;&#x2F;threads&quot;, uri: (req) -&gt; &quot;&#x2F;threads?id=#{req.query.id}&quot;}],<p>Source:<p>https:&#x2F;&#x2F;github.com&#x2F;blackjable&#x2F;hackednews
======
xauronx
Looks like a great start. Any plans to do comments?

~~~
blackjable
The API is here:

{path:"/"}

{path:"/news"}

{path:"/news2"}

{path:"/newest"}

{path:"/newcomments"}

{path:"/ask"}

{path:"/x", uri: (req) -> "/x?fnid=#{req.query.fnid}" }

{path:"/user", uri: (req) -> "/user?id=#{req.query.id}" }

{path:"/item", uri: (req) -> "/item?id=#{req.query.id}"}

{path:"/submitted", uri: (req) -> "/submitted?id=# {req.query.id}"}

{path:"/threads", uri: (req) -> "/threads?id=#{req.query.id}"}

not everything is implemented. Its mostly readonly view of the resources.

Code is here:

[https://github.com/blackjable/hackednews](https://github.com/blackjable/hackednews)

~~~
xauronx
Oh very nice. I was doing some server side scraping of HN content a little
while back and it was a pain. I would have much preferred to use an API or
something. Have you gotten banned a bunch of times yet or are you getting
around that somehow?

~~~
blackjable
I'm not hitting it that often and no one is really using the API yet so I
haven't hit any limits.

If I do get banned because of excess use I would stop and put some caching in
place or something. I didnt want tot start with a cache because I wanted
information from the site to be up to date as possible. HN data changes really
quickly, as you know.

~~~
xauronx
Yeah, absolutely. I got into issues when I was trying to parse the comments
for the top 20. If you hit the top 20 and pull down the comments you'll get
banned. I ended up giving up on my iOS app because once any real usage started
the server was instantly banned (even with 5 minute delay between updating). I
ended up realizing that I would have to parse it client side (in obj-c). But
then again, I'm not that smart so maybe I was over complicating it.

