ndelvalle / livescore

⚽️ https://live-score-api.com client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

livescore

Codeship Status for ndelvalle/livescore Coverage Status dependencies Status devDependencies Status Codacy Badge code style: prettier

Javascript client to comunicate with livescore api. It provides information about football leagues, cups, international matches in all major football federations around the world. It also provide feeds for many minor leagues.

Install

$ npm install --save livescore-client
$ yarn add livescore-client

Usage

Signup on the livescore api webpage to get a real key and secret

import Livescore from 'livescore-client'

const key = 'demo_key'
const secret = 'demo_secret'
const livescore = new Livescore({ key, secret })

livescore.verify()

Validates the api key and secret pair

livescore.verify()
  .then((response) => {
    console.log(response)
    // {
    //   "success": true,
    //   "data": { "message": "You API key and API secret are working correctly" }
    // }
  })

livescore.scores([options])

Get the current live scores. The response can be filtered by league or country.

livescore.scores({
  league: 73,
  country: 47
})
  .then((response) => {
    console.log(response)
    // {
    //   "success": true,
    //   "data": {
    //     "match": [
    //       {
    //         "id": "14",
    //         "home_name": "CSD Comunicaciones",
    //         "away_name": "Coban Imperial",
    //         "score": "0 - 0",
    //         "ht_score": "0 - 0",
    //         "ft_score": "",
    //         "et_score": "",
    //         "time": "36",
    //         "league_id": "73",
    //         "status": "IN PLAY",
    //         "added": "2017-11-16 00:40:21",
    //         "last_changed": "2017-11-16 00:40:21",
    //         "home_id": "0",
    //         "away_id": "188",
    //         "events": false,
    //         "league_name": "Liga Nacional:: apertura"
    //       },
    //       ...
    //     ]
    //   }
    // }
  })

License

MIT License

About

⚽️ https://live-score-api.com client

License:MIT License


Languages

Language:JavaScript 100.0%