Code Monkey home page Code Monkey logo

flea-killer's Introduction

flea-killer

Fleaflicker API through web scraping, since no official API exists.

API

For all examples:

var flea = require('flea-killer');

league.get(leagueType, leagueId, season, function(err, league))

leagueType is the Fleaflicker league ('nhl', 'mlb', etc.). leagueId is the Fleaflicker league ID. Returns all information availabile for the league from a single request. season is the year.

Example
flea.league.get('mlb', 13157, 2014, function(err, league){
  if (err) { return console.log('Handle Errors', err); }
  // See below for returned league object
  console.log(league);
});
Returned
{
  id: number,
  name: string,
  commish: string,
  type: string,
  slots: {
    total: number,
    available: number,
    taken: number
  },
  stats: [string]
  // array of teams scraped from the league
  teams: [{
    name: string
    rank: number
    points: number,
    link: string,
    id: number,
    owner: {
      name: string,
      link: string
    },
    stats: {
        // One key for each stat type in a league
        type: {
          points: number,
          value: number
        },
        ...
    },
  }, ... ]
}

team.get(leagueType, leagueId, teamId, season, function(err, team))

leagueType is the Fleaflicker league ('nhl', 'mlb', etc.). leagueId is the Fleaflicker league ID. teamId is the Fleaflicker league ID. Returns all information availabile for the team from a single request. season is the year.

Example
flea.team.get('nhl', 1800, 10370, 2014, function(err, team){
  if (err) { return console.log('Handle Errors', err); }
  // See below for returned draft object
  console.log(draft);
});
Returned
{
  id: number,
  name: string,
  owner: string,
  points: number,
  players: [{
    name: string,
    totalPoints: number,
    avgPoints: number
  }, ...]
}

draft.get(leagueType, leagueId, season, function(err, draft))

leagueType is the Fleaflicker league ('nhl', 'mlb', etc.). leagueId is the Fleaflicker league ID. Returns all information availabile for the league from a single request. season is the year.

Example
flea.draft.get('mlb', 13157, 2014, function(err, draft){
  if (err) { return console.log('Handle Errors', err); }
  // See below for returned draft object
  console.log(draft);
});
Returned
{
  league: {
    id: number,
    name: string
  },
  // array of picks from the draft
  picks: [{
    round: number,
    pick: {
      // Overall draft number
      overall: number,
      // Round specific draft number
      round: number
    },
    team: {
      id: number,
      name: string
    },
    player: {
      id: number,
      name: string
    }
  }, ...]
}

flea-killer's People

Contributors

benmagyar avatar mmarcuccio avatar nvitaterna avatar zachmyers3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flea-killer's Issues

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.