Giter Club home page Giter Club logo

hnify's Introduction

HNify

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!

hnify's People

Contributors

bitdeli-chef avatar connyay avatar erikpel avatar nprescott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hnify's Issues

Application Error

API is throwing "Application Error" now. Log shows a timeout error. Fix with background tasks?

2013-10-30T16:07:00.967241+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/get/top host=hnify.herokuapp.com fwd="108.179.181.237" dyno=web.1 connect=2ms service=30001ms status=503 bytes=0

Or maybe not because 503 error is handled within the API. Not sure what's happening. Anyone has any ideas.

No "Access-Control-Allow-Origin" header is present on the requested resource.

Hello, there. I'm testing your API on a localhost:9000 and it isn't working due to the above error. I'm using jQuery's .get method and the the Yeoman Workflow.

The full error is as follows:

XMLHttpRequest cannot load http://hnify.herokuapp.com/get/top. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. 

Get comments method.

Need to add comments list to the result. But then the result will be super, super, super long.

Better approach?

/get/comments/<story_id>

Need to do this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.