gameday-fetch

retrieve mlb gameday data

npm install gameday-fetch
1 downloads in the last week
5 downloads in the last month

gameday-fetch

A no fuss library for retrieving MLB Gameday data. Please use responsibly and according to their provisions.

This library has no affiliation with MLB Advanced Media. Copyright information for use of their data is:

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.

Usage

var gameday = require('gameday-fetch');

options(opts)

The defaults can be replaced with your own parameters baseUrl: url to retrieve data from throttle: time (ms) between requests

gameday.options({ baseUrl: "http://myserver/path/", throttle: 2000});

getGameIds(date, callback)

Retrieves all the gids for the given date. callback(err, ids) where ids is an array of gids.

gameday.getGameIds(new Date('2013-06-29'), function (err, gids) {
    if (err) throw err;
    // use gids
});

getGameXML(gid, [callback])

getInningXML(gid, [callback])

Retrieves the XML file for the supplied gid. If supplied callback(err, xml) is called. Otherwise function returns a stream.

gameday.getGameXML(gid, function (err, xml) {
    if (err) throw err;
    console.log(xml);
});

gameday.getInningXml(gid).pipe(process.stdout);

license

MIT

npm loves you