soccer.js
1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var request = require('request');
var options = {
method: 'GET',
url: 'https://v3.football.api-sports.io/players',
qs: {id: '276', season: '2019'},
headers: {
'x-rapidapi-host': 'v3.football.api-sports.io',
'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
module.exports = function(){
this.GetPlayerInfo = function(playerID, season){
var request = require('request');
var options = {
method: 'GET',
url: 'https://v3.football.api-sports.io/players',
qs: {id: playerID, season: season},
headers: {
'x-rapidapi-host': 'v3.football.api-sports.io',
'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
return response.body;
});
}
}