Giter Site home page Giter Site logo

lobsters's Introduction

Lobste.rs Unofficial API

Example Application

You can find a Volt app hitting this api here.

Usage

It is a simple Rack app. In order to run it, if you fancy Heroku one must simple do the following:

$ bundle install
$ heroku create
$ git push heroku master

Once deployed, we have 3 main routes:

frontpage [GET], params: page : This provides the current frontpage, 25 results. Defaults to page = 1

recent[GET], params: page : This gets the most recent stories from the new section, 25 results. Defaults to page = 1

search [POST], params: terms, page, what (optional: args that can be used are stories and all :

This takes JSON in the form of "{\"terms\":\"python ruby\", \"page\":\"2\"}" and returns the first 25 results.

In the Wild

It is hosted here on Heroku. Note that the / endpoint for random hobos and /hobos for a single hobo are only working locally at the moment.

Sample

Here are a few gists with samples of recent and frontpage, and here is an example of the search POST request:

devbox% curl -X POST  "https://quiet-temple-1623.herokuapp.com/search" -d "{\"terms\":\"python ruby\", \"page\":\"2\"}"
{
    "results": [{
        "title": "Building A Ruby List Comprehension",
        "link": "https://blog.engineyard.com/2014/ruby-list-comprehension",
        "submitter": "/u/fluxusfrequency",
        "submission_dt": "2014-11-07 11:05:29 -0600"
    }, {
        "title": "Generational GC in Python and Ruby",
        "link": "http://patshaughnessy.net/2013/10/30/generational-gc-in-python-and-ruby",
        "submitter": "/u/jcs",
        "submission_dt": "2013-10-30 23:10:41 -0500"
    ... # omitted for brevity
    {
        "title": "Announcing Topaz: A New Ruby",
        "link": "http://docs.topazruby.com/en/latest/blog/announcing-topaz/",
        "submitter": "/u/jcs",
        "submission_dt": "2013-02-06 12:04:09 -0600"
    }]
}%                 

Todos

  • Better response codes + routing/error handling
  • Utilize Mechanize's cookie jar to get the cookie that can filter displayed stories
  • Allow further customization of search
  • View comments
  • Allow user login and profile updating
  • Allow invitations of other users once logged in
  • Mock tests with VCR or webmock (simpler alternative)
  • (and much more)

Contributing

  1. Fork, and make a branch
  2. Code!
  3. Test!
  4. PR!

lobsters's People

Contributors

ybur-yug avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.