cricket-ace
v0.0.1
Published
cricket api that works
Downloads
12
Readme
CricketAPI for node.js
Node package for live scores, commentary, scoreboard and more to come.
Problem
Other packages are either outdates or use cricapi.com which is limited to 100 requests per day.
Installation
npm install cricket-ace
Features
- Get upcoming, live and recently concluded matches
- Commentary for live matches
- Scorecard for live matches
Usage
Import the library.
var cricket = require('cricket-ace');
var c = new cricket()
Get live and recent matches
console.log(c.matches())
You need match id to get scorecard, commentary etc.
Get livescore
console.log(c.livescore(match['id']))
Get scorecard of a match
console.log(c.scorecard(match['id']))
It works with callbacks too: example:
c.scorecard(match['id'], (data) => {
//your code here
});
Outputs
1. For scorecard
{ matchinfo:
{ id: '20286',
srs: 'Super Provincial One Day Tournament, 2018',
mchdesc: 'KANDY vs GALLE',
mnum: '2nd Match',
type: 'ODI',
mchstate: 'Result',
status: 'Kandy won by 28 runs' },
squad:
[ { team: 'Galle', members: [Array] },
{ team: 'Galle', members: [Array] } ],
scorecard:
{ batteam: 'KANDY',
runs: '217',
wickets: '2',
overs: '30',
runrate: '7.23',
inngdesc: undefined,
batcard: [ [Object], [Object], [Object], [Object] ],
bowlteam: 'GALLE',
bowlcard:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ] } }
{ matchinfo:
{ id: '20286',
srs: 'Super Provincial One Day Tournament, 2018',
mchdesc: 'KANDY vs GALLE',
mnum: '2nd Match',
type: 'ODI',
mchstate: 'Result',
status: 'Kandy won by 28 runs' },
squad:
[ { team: 'Galle', members: [Array] },
{ team: 'Galle', members: [Array] } ],
scorecard:
{ batteam: 'GALLE',
runs: '250',
wickets: '10',
overs: '35.4',
runrate: '7.01',
inngdesc: undefined,
batcard:
[ [Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object],
[Object] ],
bowlteam: 'KANDY',
bowlcard: [ [Object], [Object], [Object], [Object], [Object], [Object] ] } }
2. For livescore
{ matchinfo:
{ id: '20286',
srs: 'Super Provincial One Day Tournament, 2018',
mchdesc: 'KANDY vs GALLE',
mnum: '2nd Match',
type: 'ODI',
mchstate: 'Result',
status: 'Kandy won by 28 runs' },
batting:
{ team: 'KANDY',
score: [ [Object] ],
batsman: [ [Object], [Object] ] },
bowling:
{ team: 'GALLE',
score: [ [Object] ],
bowler: [ [Object], [Object] ] } }
TODO
- Search a match directly.
- Get livescores at a particular interval automatically.
- Get working with promise.