Fix JSON parse exception

This commit is contained in:
0xboobface 2018-10-30 15:57:44 +01:00
parent 007ed19d97
commit 0c9fc5cba6
1 changed files with 3 additions and 0 deletions

View File

@ -60,6 +60,9 @@ public class Cam4Model extends AbstractModel {
Response response = site.getHttpClient().execute(req);
if(response.isSuccessful()) {
JSONArray json = new JSONArray(response.body().string());
if(json.length() == 0) {
throw new IOException("Couldn't fetch model details");
}
JSONObject details = json.getJSONObject(0);
onlineState = details.getString("showType");
playlistUrl = details.getString("hlsPreviewUrl");