Merge branch 'main' of https://github.com/FongMi/CatVodSpider
This commit is contained in:
commit
555e03ddf5
|
|
@ -12,6 +12,7 @@ android {
|
|||
targetSdk 28
|
||||
ndk { abiFilters "armeabi-v7a" }
|
||||
buildConfigField("String", "CLIENT_ID", "\"${clientId}\"")
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ public class API {
|
|||
public Object[] proxySub(Map<String, String> params) throws Exception {
|
||||
String fileId = params.get("file_id");
|
||||
Response res = OkHttp.newCall(getDownloadUrl(fileId), getHeaderAuth());
|
||||
byte[] body = Utils.getUTF8(res.body().bytes());
|
||||
byte[] body = Utils.toUtf8(res.body().bytes());
|
||||
Object[] result = new Object[3];
|
||||
result[0] = 200;
|
||||
result[1] = "application/octet-stream";
|
||||
|
|
|
|||
|
|
@ -49,19 +49,15 @@ public class Utils {
|
|||
return hasCamera && hasPhone && hasBT;
|
||||
}
|
||||
|
||||
public static boolean isGBK(byte[] bytes) {
|
||||
public static boolean isGbk(byte[] bytes) {
|
||||
Charset charset = Charset.forName("GBK");
|
||||
String str = new String(bytes, charset);
|
||||
byte[] newBytes = str.getBytes(charset);
|
||||
return Arrays.equals(bytes, newBytes);
|
||||
}
|
||||
|
||||
public static byte[] getUTF8(byte[] bytes) throws Exception {
|
||||
if (isGBK(bytes)) {
|
||||
return new String(bytes, Charset.forName("GBK")).getBytes("UTF-8");
|
||||
} else {
|
||||
return bytes;
|
||||
}
|
||||
public static byte[] toUtf8(byte[] bytes) throws Exception {
|
||||
return isGbk(bytes) ? new String(bytes, Charset.forName("GBK")).getBytes("UTF-8") : bytes;
|
||||
}
|
||||
|
||||
public static boolean isSub(String ext) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue