HNify
Hacker News REST API using Flask on Heroku using memcached.
Install / Use
/learn @karan/HNifyREADME
HNify

Unofficial REST API for Hacker News. Built using HackerNewsAPI.
Now uses memcached for increased performace!
Start
$ brew install memcached # install memcached
$ pip install -r requirements.txt # install dependencies
$ memcached -vv # start memcached server
$ python app.py # start the api
Deploy to Heroku
$ pip install -r requirements.txt # install dependencies
$ heroku create
$ heroku addons:add memcachedcloud
$ heroku addons:add newrelic
$ (git add, git commit)
$ git push heroku master
If you get an error on the memcached line, see the following help article.
Usage
Base URL: http://hnify.herokuapp.com
Output: JSON
Get stories from top page
GET /get/top
Parameters:
| Name | Type | Description |
| ---- | ---- | ----------- |
| limit | integer | Return only at most these many stories, at least 30 |
Get stories from newest page
GET /get/newest
Parameters:
| Name | Type | Description |
| ---- | ---- | ----------- |
| limit | integer | Return only at most these many stories, at least 30 |
Get stories from best page
GET /get/best
Parameters:
| Name | Type | Description |
| ---- | ---- | ----------- |
| limit | integer | Return only at most these many stories, at least 30 |
Currently trending topics on HN
GET /get/trends
Get comments from story id
GET /get/comments/<story_id>/
Example
karan:$ curl -i http://hnify.herokuapp.com/get/newest
HTTP/1.1 200 OK
Content-Type: application/json
Date: Tue, 29 Oct 2013 06:23:39 GMT
Server: gunicorn/18.0
Content-Length: 16562
Connection: keep-alive
{
"stories": [
{
"comments_link": "http://news.ycombinator.com/item?id=6632337",
"domain": "independent.co.uk",
"is_self": false,
"link": "http://www.independent.co.uk/news/science/lifi-breakthrough-internet-connections-using-light-bulbs-are-250-times-faster-than-broadband-8909320.html",
"num_comments": 0,
"points": 1,
"published_time": "1 minute ago",
"rank": 1,
"story_id": 6632337,
"submitter": "yapcguy",
"submitter_profile": "http://news.ycombinator.com/user?id=yapcguy",
"title": "Li-Fi: Internet connections using light bulbs are 250 x faster than broadband"
},
{
"comments_link": "http://news.ycombinator.com/item?id=6632335",
"domain": "github.com",
"is_self": false,
"link": "https://github.com/postmodern/chruby",
"num_comments": 0,
"points": 2,
"published_time": "1 minute ago",
"rank": 2,
"story_id": 6632335,
"submitter": "michaelrkn",
"submitter_profile": "http://news.ycombinator.com/user?id=michaelrkn",
"title": "Chruby: a lightweight, elegant RVM alternative"
},
<-- snip -->
]
}
Donations
If HNify has helped you in any way, and you'd like to help the developer, please consider donating.
- BTC: 19dLDL4ax7xRmMiGDAbkizh6WA6Yei2zP5
- Gittip: https://www.gittip.com/karan/
- Flattr: https://flattr.com/profile/thekarangoel
Contribute
If you want to add any new features, or improve existing ones, feel free to send a pull request!
Related Skills
node-connect
348.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
348.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
348.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
