0.0.1 • Published 6 years ago

cricket-ace v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

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

  1. Get upcoming, live and recently concluded matches
  2. Commentary for live matches
  3. 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

  1. Search a match directly.
  2. Get livescores at a particular interval automatically.
  3. Get working with promise.