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.
$ npm install --save livescore-client
$ yarn add livescore-client
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 })
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" }
// }
})
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"
// },
// ...
// ]
// }
// }
})