scores


A node module for tracking scores for NCAA Basketball off of ESPN's website (or any other URL you want to parse).
Usage
var Scores = require('scores');
var scores = new Scores({
interval: 30
url: 'http://place-where-scores-are.com'
});
scores.on('game', function(game) {
});
scores.start();
API
new Scores(options)
options.interval (Integer, default: 15)
Interval in minutes for how often to request the urloptions.maxInterval (Integer, default: null)
If a maxInterval is set, the interval
will be backed off by 50% each time if there are no game events until it reaches the maxInterval.options.timezone (String, default: 'America/New_York')
A moment-timezone string for which timezone you want to base dates offoptions.dailyCutoff (Integer, default: 180)
The amount of minutes after midnight that the date should switch. This allows you to keep checking for the games that might go past midnight.options.url (String)
The url to request. {date}
will be replaced with today's date as YYYYMMDD
options.ignoreInitial (Boolean, default: true)
A boolean whether to ignore any already completed games on the initial requestoptions.logger
A bucker compatible instance which will log interesting things
methods
start()
Start the interval to watch for new gamesstop()
Stop watchingparse(html, ignore)
Parse some html
. Will emit game
events. Will ignore
any already completed games.request(ignore)
Request the url. Will pass ignore
and the requested html
to parse()
. Will emit any error
events from the request.
events
scores.on('game', function (data) {})
scores.on('error', function (error, responseCode) {})
scores.on('setTimeout', function (timeInMsUntilNextReq) {})
MIT License