Fix bug
This commit is contained in:
parent
dbc4c767ad
commit
2205d18819
|
|
@ -85,7 +85,7 @@ public class Bili extends Spider {
|
|||
|
||||
@Override
|
||||
public void init(Context context, String extend) throws Exception {
|
||||
this.extend = Json.parse(extend).getAsJsonObject();
|
||||
this.extend = Json.safeObject(extend);
|
||||
setCookie();
|
||||
setAudio();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class Wogg extends Ali {
|
|||
|
||||
@Override
|
||||
public void init(Context context, String extend) {
|
||||
ext = Json.parse(extend).getAsJsonObject();
|
||||
ext = Json.safeObject(extend);
|
||||
super.init(context, ext.has("token") ? ext.get("token").getAsString() : "");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.github.catvod.utils;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class Json {
|
||||
|
|
@ -12,4 +13,13 @@ public class Json {
|
|||
return new JsonParser().parse(json);
|
||||
}
|
||||
}
|
||||
|
||||
public static JsonObject safeObject(String json) {
|
||||
try {
|
||||
JsonObject obj = parse(json).getAsJsonObject();
|
||||
return obj == null ? new JsonObject() : obj;
|
||||
} catch (Throwable e) {
|
||||
return new JsonObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
73e1be1009c6a267fc30ea51b446e304
|
||||
4795d43e5d59d58d6d4a92361f73974e
|
||||
|
|
|
|||
Loading…
Reference in New Issue