1.0.2 • Published 10 years ago

opgg-ladder v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

opgg-ladder

Build Status Dependency Status

Get op.gg's ladder rankings.

The response returned by op.gg is plagued with HTML, which no one wants to work with. opgg-ladder extracts all the important information for you and simply returns an Array of the top League of Legends players.

Example

var ladder = require('opgg-ladder');

ladder(function(error, response) {
  if (error) {
    throw error;
  }

  console.log(response);
  // => [
  // =>   {
  // =>     username: 'Turtle the Cat',
  // =>     rank: 1,
  // =>     league: 'Challenger 1',
  // =>     lp: 1264,
  // =>     wins: 211,
  // =>     losses: 140
  // =>   },
  // =>
  // =>   ...
  // =>
  // =>   {
  // =>     username: 'PorpoiseDeluxe',
  // =>     rank: 30,
  // =>     league: 'Challenger 1',
  // =>     lp: 681,
  // =>     wins: 408,
  // =>     losses: 348
  // =>   }
  // => ]
});

Installation

$ npm install opgg-ladder

API

var ladder = require('opgg-ladder');

ladder([start=0], callback)

Queries op.gg for the top 30 players starting at optional index start (defaults to 0). Calls callback(error, players) when response arrives. players is an Array of Objects.