박찬수

appfunctions

......@@ -17,12 +17,12 @@ function GetGameSchedule(teamID, leagueID, season, eventObj){
}
// 입력: 리그ID, 반환: 팀 순위
function GetTeamStanding(season){
function GetLeagueStanding(leagueID, season){
var request = require("request");
var options = {
method: 'GET',
url: 'https://v3.football.api-sports.io/standings',
qs: {season: season},
qs: {league : leagueID, season: season},
headers: {
'x-rapidapi-host': 'v3.football.api-sports.io',
'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
......@@ -31,6 +31,14 @@ function GetTeamStanding(season){
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
let jsonBody = JSON.parse(body);
console.log(jsonBody);
console.log(jsonBody.response[0]);
console.log(jsonBody.response[0].league);
for(var i = 0; i < 20; i++){
console.log(jsonBody.response[0].league.standings[0][i].rank + "|" + jsonBody.response[0].league.standings[0][i].team.name);
}
});
}
......@@ -123,3 +131,5 @@ function GetTeamStanding(teamID, season){
console.log(body);
});
}
GetLeagueStanding(39, 2021);
......