Skip to content

Commit

Permalink
Fixed Streamscharts retrieval JSON issue
Browse files Browse the repository at this point in the history
Fixed a JSON parsing and handling issue which prevented from the contents of Streamscharts link from being read.
This fixes issue #21.
  • Loading branch information
daylamtayari committed Jan 17, 2021
1 parent 198e422 commit 8d0b0c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/TwitchRecover.CLI/Handlers/ClipHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 162,7 @@ private void recoverClips(){
else{
System.out.print("\nPlease input the stream link from an analytics website (Twitch Tracker or Streamscharts): ");
String[] data= WebsiteRetrieval.getData(CLIHandler.sc.next());
clip.setValues(Long.parseLong(data[1]), Long.parseLong(data[3]));
clip.setValues(Long.parseLong(data[1]), Long.parseLong(data[3].substring(0, data[3].indexOf("."))));
}
System.out.print(
"\nPlease enter y if you have Wfuzz installed and n if not: "
Expand Down
8 changes: 4 additions & 4 deletions src/TwitchRecover.Core/WebsiteRetrieval.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 188,14 @@ private static String[] getSCData(String url) throws IOException {
}

//Retrieve user ID:
String idJSON = getJSON("https://api.twitch.tv/v5/users/?login=" results[2] "&client_id=ohroxg880bxrq1izlrinohrz3k4vy6");
String idJSON = getJSON("https://api.twitch.tv/v5/users/?login=" results[0] "&client_id=ohroxg880bxrq1izlrinohrz3k4vy6");
JSONObject joID = new JSONObject(idJSON);
JSONObject users = joID.getJSONObject("users");
JSONObject user = users.getJSONObject("0");
JSONArray users = joID.getJSONArray("users");
JSONObject user = users.getJSONObject(0);
userID = user.getString("_id");

//Retrieve stream values:
String dataJSON = getJSON("https://alla.streamscharts.com/api/free/streaming/platforms/1/channels/" userID "/streams/" results[2] "/statuses");
String dataJSON = getJSON("https://alla.streamscharts.com/api/free/streaming/platforms/1/channels/" userID "/streams/" results[1] "/statuses");
JSONObject joD = new JSONObject(dataJSON);
JSONArray items = joD.getJSONArray("items");
for(int i = 0; i < items.length(); i ) {
Expand Down

0 comments on commit 8d0b0c7

Please sign in to comment.