Improve error output and add team id matcher template creator

This commit is contained in:
2020-11-04 21:22:27 +01:00
parent 2f411aae67
commit d42edcf01c
15 changed files with 158 additions and 154 deletions

View File

@@ -121,4 +121,23 @@ public class APIFootballConnector {
return object;
}
public JSONObject getTeamsForLeague(int league) {
String url = "https://v2.api-football.com/teams/league/" + league;
String content = new APIFootballUpdater(0).getRawData(url);
return stringToJSONObject(content);
}
private JSONObject stringToJSONObject(String rawData) {
JSONParser parser = new JSONParser();
JSONObject data = null;
try {
data = (JSONObject) parser.parse(rawData);
} catch (Exception e) {
/* TODO */
e.printStackTrace();
}
return data;
}
}