Show HN: News API (hackednews.herokuapp.com)
The resources are transmitted via JSON responses. This was a bit of fun.
API:
{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}"}],
Source:
https://github.com/blackjable/hackednews
5 comments
[ 4.1 ms ] story [ 23.4 ms ] thread{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
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.