Browse Source

Fixed error with parsing json from steam

pull/8/head
jrtechs 6 years ago
parent
commit
a3adf309dc
1 changed files with 1 additions and 8 deletions
  1. +1
    -8
      src/main/java/net/jrtechs/www/SteamAPI/APIConnection.java

+ 1
- 8
src/main/java/net/jrtechs/www/SteamAPI/APIConnection.java View File

@ -124,13 +124,6 @@ public class APIConnection
*/ */
public String getPlayerName(String steamid) public String getPlayerName(String steamid)
{ {
// return ((HashMap<String, String>) new JSONObject(WebScraper
// .getWebsite(this.baseURL + this.playerInfoURL +
// this.apiKey + "&steamids=" + steamid))
// .getJSONObject("response")
// .getJSONArray("players")
// .toList().stream().findAny().get()).get("personaname");
JSONObject response = new JSONObject(WebScraper JSONObject response = new JSONObject(WebScraper
.getWebsite(this.baseURL + this.playerInfoURL + .getWebsite(this.baseURL + this.playerInfoURL +
this.apiKey + "&steamids=" + steamid)); this.apiKey + "&steamids=" + steamid));
@ -143,7 +136,7 @@ public class APIConnection
JSONArray arr = response.getJSONArray("players"); JSONArray arr = response.getJSONArray("players");
if(arr.length() > 0) if(arr.length() > 0)
{ {
return arr.getJSONObject(0).getString("personname");
return arr.getJSONObject(0).getString("personaname");
} }
} }
} }

Loading…
Cancel
Save