wtf-nhl
v0.0.4
Published
parse NHL hockey game data from wikipedia
Downloads
9
Readme
wtf-nhl is a wrapper of wtf_wikipedia that supports a bunch of different variants of nhl game log variations, that are used sometimes in the wild.
wtfNHL.fetch('Toronto Maple Leafs', 2018).then(console.log)
// {
// roster:[ { name: 'Mitch Marner',
// games: 40,
// goals: 15,
// assists: 40,
// points: 55,
// plusMinus: 16 },
// ...
// ]
// games: [{ game: 1,
// date: 'October 3',
// opponent: 'Montreal Canadiens',
// location: 'Scotiabank Arena',
// score: { win: 3, loss: 2 },
// overtime: true,
// record: { wins: 1, losses: 0, ties: 0 },
// attendance: null,
// points: 2 },
// ...
// ]
// }
//or if you already have the doc,
var json = wtfNHL.parse(doc)
to do a bunch of years in a row:
wtfNHL.history('St. Louis Blues', 1992, 1997).catch(console.log).then(data => {
data = data.map((obj) => {
//grab just the date and attendance
obj.games = obj.games.map((g) => [g.date, g.attendance])
return obj
})
console.log(JSON.stringify(data, null, 2))
})
See also:
(work-in-progress)
MIT