appfunctions.js
4.72 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
var data = require('./getid.js');
// 입력: 팀ID, 리그ID, 시즌 입력, 반환: 경기일정
function GetGameSchedule(teamID, leagueID, season, callbackFunc){
var request = require("request");
var options = {
method: 'GET',
url: 'https://v3.football.api-sports.io/fixtures',
qs: {team: teamID, league: leagueID, season: season},
headers: {
'x-rapidapi-host': 'v3.football.api-sports.io',
'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
callbackFunc(body);
});
}
// 입력: 리그ID, 시즌(*필수) 반환: 팀 순위
function GetLeagueStanding(leagueID, season, callbackFunc){
var request = require("request");
var options = {
method: 'GET',
url: 'https://v3.football.api-sports.io/standings',
qs: {league : leagueID, season: season},
headers: {
'x-rapidapi-host': 'v3.football.api-sports.io',
'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
callbackFunc(body);
});
}
exports.LeagueStanding = function(leagueID, callbackFunc){
GetLeagueStanding(leagueID, 2021, callbackFunc);
}
// 입력: 리그ID(*필수), 시즌(*필수), 반환: (선수) 득점 순위
function GetTopScorer(leagueID, season, callbackFunc){
var request = require("request");
var options = {
method: 'GET',
url: 'https://v3.football.api-sports.io/players/topscorers',
qs: {league : leagueID, season: season},
headers: {
'x-rapidapi-host': 'v3.football.api-sports.io',
'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
callbackFunc(body);
});
}
exports.TopScorer = function(leagueID, callbackFunc){
GetTopScorer(leagueID, 2021, callbackFunc);
}
// 입력: 리그ID(*필수), 시즌(*필수), 반환: 도움 순위
function GetTopAssist(leagueID, season, callbackFunc){
var request = require("request");
var options = {
method: 'GET',
url: 'https://v3.football.api-sports.io/players/topassists',
qs: {league : leagueID, season: season},
headers: {
'x-rapidapi-host': 'v3.football.api-sports.io',
'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
callbackFunc(body)
});
}
exports.TopAssist = function(leagueID, callbackFunc){
GetTopAssist(leagueID, 2021, callbackFunc);
}
// 입력: 팀ID, 시즌(*필수), 반환: 경기 일정
function GetGameSchedule_teamname(season, teamID, callbackFunc){
var request = require("request");
var options = {
method: 'GET',
url: 'https://v3.football.api-sports.io/fixtures',
qs: {season: season, team: teamID},
headers: {
'x-rapidapi-host': 'v3.football.api-sports.io',
'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
callbackFunc(body);
});
}
exports.GameSchehdule = function(teamID, callbackFunc){
GetGameSchedule(2021, teamID, callbackFunc);
}
// 입력: 팀ID,시즌(*필수), 반환: 소속 선수
function GetTeamMembers(season, teamID, callbackFunc){
var request = require("request");
var options = {
method: 'GET',
url: 'https://v3.football.api-sports.io/players',
qs: {season: season, team: teamID},
headers: {
'x-rapidapi-host': 'v3.football.api-sports.io',
'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
callbackFunc(body);
})
}
exports.TeamMembers = function(teamID, callbackFunc){
GetTeamMembers(2021, teamID, callbackFunc);
}
// 입력: 팀ID, 시즌*(필수), 반환: 팀 순위
function GetTeamStanding(season, teamID){
var request = require("request");
var options = {
method: 'GET',
url: 'https://v3.football.api-sports.io/standings',
qs: {season: season, team: teamID},
headers: {
'x-rapidapi-host': 'v3.football.api-sports.io',
'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
}