Showing
1 changed file
with
33 additions
and
13 deletions
1 | -var request = require('request'); | 1 | +// var request = require('request'); |
2 | - var options = { | 2 | +// var options = { |
3 | - method: 'GET', | 3 | +// method: 'GET', |
4 | - url: 'https://v3.football.api-sports.io/players', | 4 | +// url: 'https://v3.football.api-sports.io/players', |
5 | - qs: {id: 276, season: 2019}, | 5 | +// qs: {id: 276, season: 2019}, |
6 | - headers: { | 6 | +// headers: { |
7 | - 'x-rapidapi-host': 'v3.football.api-sports.io', | 7 | +// 'x-rapidapi-host': 'v3.football.api-sports.io', |
8 | - 'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191' | 8 | +// 'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191' |
9 | - } | 9 | +// } |
10 | - }; | 10 | +// }; |
11 | - request(options, function (error, response) { | 11 | +// request(options, function (error, response) { |
12 | - if (error) throw new Error(error); | 12 | +// if (error) throw new Error(error); |
13 | - }); | 13 | +// }); |
14 | +var request = require("request"); | ||
15 | + | ||
16 | +var options = { | ||
17 | + method: 'GET', | ||
18 | + url: 'https://v3.football.api-sports.io/standings', | ||
19 | + qs: {league: '39', season: '2021'}, | ||
20 | + headers: { | ||
21 | + 'x-rapidapi-host': 'v3.football.api-sports.io', | ||
22 | + 'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191' | ||
23 | + } | ||
24 | +}; | ||
25 | + | ||
26 | +request(options, function (error, response, body) { | ||
27 | + if (error) throw new Error(error); | ||
28 | + | ||
29 | + console.log(body); | ||
30 | + body = JSON.parse(body); | ||
31 | + console.log(body); | ||
32 | +}); | ||
33 | + | ||
14 | 34 | ||
15 | 35 | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment