npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gameday-helper

v0.1.1

Published

Wrapper for MLB Gameday API

Downloads

14

Readme

gameday-helper

NPM

A node.js wrapper around the MLB Gameday API.

This is meant only for personal use. As it is not affiliated with MLB, please do not use it for commercial purposes and keep it in line with this MLB copyright statement:

The accounts, descriptions, data and presentation in the referring page (the "Materials") are proprietary content of MLB Advanced Media, L.P ("MLBAM"). Only individual, non-commercial, non-bulk use of the Materials is permitted and any other use of the Materials is prohibited without prior written authorization from MLBAM. Authorized users of the Materials are prohibited from using the Materials in any commercial manner other than as expressly authorized by MLBAM.

This library provides easy access to MLB provided JSON data for individual games or all games on a given date.

All methods return promises and use Bluebird under the hood.

##Using the module

Simply require the node module.

var gamedayHelper = require( 'gameday-helper' );

##Data for all games on a given date

To return an array of all Game Ids for a given date do the following:

gamedayHelper.listGameIds( new Date('2014-7-20') )
.then( function( list ){
  // Array of gid's
})
.catch( function( error ) {
  console.log( error );
});

As with all methods in the library, if no dates are supplied, it will default to the current date.

To return data from the MLB master scoreboard:

gamedayHelper.masterScoreboard( new Date('2014-7-20') )
.then( function( data ){
  // Array of objects with data related to a single game
})
.catch( function( error ) {
  console.log( error );
});

Swap 'masterScoreboard' with 'miniScoreboard' for data from MLB mini scoreboard.

##Data for a single game

All single game methods require the game ID or 'gid' for the requested game. The gid can be found using the listGameIds method, or from the game objects in both scoreboard methods.

The date is not required as it is a part of the gid itself.

There are 5 methods related to single games:

  • boxscore - Returns the boxscore for the given gid.
  • events - Returns data for every event in the game ( very large ).
  • feed - Returns game feed data. Lots of MLB media stuff, but some interesting hot/cold zone stuff as well.
  • linescore - Returns the linescore data for the given gid
  • plays - Returns the plays data for the current half inning of the given gid.

Use example:

gamedayHelper.boxscore( 'gid_2014_09_04_detmlb_clemlb_1' )
.then( function( data ){
  // Object as returned from MLB
})
.catch( function( error ) {
  console.log( error );
});