Giter Club home page Giter Club logo

nhl-api's Introduction

statsapi-nhl   Build Status  NPM version  Downloads

statsapi-nhl provides a simple, organized way to access the NHL api.

NOTICE: THIS VERSION OF THE REPOSITORY IS VERY OLD AND NOT RECOMMENDED FOR PRODUCTION USE. I AM CURRENTLY REWRITING THE ENTIRE THING IN ASYNC AWAIT. PLEASE WAIT FOR THIS BEFORE DOWNLOADING. IM SORRY FOR ANY INCONVENIENCE I CAUSED. I WROTE THIS IN HIGH SCHOOL.

Installing

This library is distributed on npm. In order to add it as a dependency, run the following command:

$ npm install statsapi-nhl

Usage

Example Retrieves the roster for the 2003-2004 season of the Tampa Bay Lightning and outputs player data for all of the centers:

const nhl = require('statsapi-nhl')
var lightning = nhl.Teams.getID("Tampa Bay Lightning")

nhl.Teams.getRoster(lightning, "20032004").then((res) => {
  var centers = res.filter((curr) => {
    return curr.position.name === "Center";
  })
  console.log(centers);
}).catch((err) => {
  console.log(err)
})

Example output

[ { person:
     { id: 8458192,
       fullName: 'Tim Taylor',
       link: '/api/v1/people/8458192',
       firstName: 'Tim',
       lastName: 'Taylor',
       primaryNumber: '27',
       birthDate: '1969-02-06',
       birthCity: 'Stratford',
       birthStateProvince: 'ON',
       birthCountry: 'CAN',
       nationality: 'CAN',
       height: '6\' 1"',
       weight: 190,
       active: false,
       rookie: false,
       shootsCatches: 'L',
       rosterStatus: 'N',
       primaryPosition: { code: 'C', name: 'Center', type: 'Forward', abbreviation: 'C' } },
    jerseyNumber: '27',
    position: { code: 'C', name: 'Center', type: 'Forward', abbreviation: 'C' } },
  { person:
     { id: 8466399,
       fullName: 'Eric Perrin',
       link: '/api/v1/people/8466399',
       firstName: 'Eric',
       lastName: 'Perrin',
       primaryNumber: '11',
       birthDate: '1975-11-01',
       birthCity: 'Laval',
       ...

Documentation

Team

People

Games

Schedule

Standings

Draft

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

nhl-api's People

Contributors

esilverm avatar

Stargazers

 avatar  avatar

Forkers

jonathanbeer

nhl-api's Issues

Bypass control-cache

Site has control-cache so there is no way to stream in data. New data appears every minute.

Include better live data

Collecting live data is hard with what I currently have. The NHL site uses diffpatches for a constant data stream. I need to figure out how it works and possibly adapt it into here.

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.