diff --git a/src/main/java/com/bbn/hadder/utils/Request.java b/src/main/java/com/bbn/hadder/utils/Request.java index 10982dd..f0b658e 100644 --- a/src/main/java/com/bbn/hadder/utils/Request.java +++ b/src/main/java/com/bbn/hadder/utils/Request.java @@ -2,6 +2,7 @@ package com.bbn.hadder.utils; import okhttp3.OkHttpClient; import okhttp3.Response; +import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; @@ -20,9 +21,13 @@ public class Request { try { Response response = caller.newCall(request).execute(); JSONObject json = new JSONObject(response.body().string()); - JSONObject data = json.getJSONObject("data"); - JSONObject response1 = data.getJSONObject("response"); - return response1.toString().replace("{\"url\":\"", "").replace("\"}", ""); + try { + JSONObject data = json.getJSONObject("data"); + JSONObject response1 = data.getJSONObject("response"); + return response1.toString().replace("{\"url\":\"", "").replace("\"}", ""); + } catch (Exception ignore) { + return json.getString("url"); + } } catch (IOException ex) { ex.printStackTrace(); }