Remove alist subtitle detect

This commit is contained in:
FongMi 2023-07-12 14:02:30 +08:00
parent 7002472891
commit 3257e2b630
5 changed files with 11 additions and 24 deletions

View File

@ -18,7 +18,6 @@ import com.github.catvod.utils.Utils;
import org.json.JSONObject;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@ -26,11 +25,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import okhttp3.Response;
public class AList extends Spider {
private List<Drive> drives;
@ -260,20 +256,9 @@ public class AList extends Spider {
String[] split = text.split("@@@");
String name = split[0];
String ext = split[1];
String url = Proxy.getUrl() + "?do=alist&url=" + getDetail(split[2]).getUrl();
String url = getDetail(split[2]).getUrl();
sub.add(Sub.create().name(name).ext(ext).url(url));
}
return sub;
}
public static Object[] proxy(Map<String, String> params) throws Exception {
String url = params.get("url");
Response res = OkHttp.newCall(url);
byte[] body = Utils.toUtf8(res.body().bytes());
Object[] result = new Object[3];
result[0] = 200;
result[1] = "application/octet-stream";
result[2] = new ByteArrayInputStream(body);
return result;
}
}

View File

@ -20,8 +20,6 @@ public class Proxy extends Spider {
return Ali.proxy(params);
case "webdav":
return WebDAV.vod(params);
case "alist":
return AList.proxy(params);
default:
return null;
}

View File

@ -51,11 +51,15 @@ public class Utils {
return hasCamera && hasPhone && hasBT;
}
public static byte[] toUtf8(byte[] bytes) throws Exception {
UniversalDetector detector = new UniversalDetector(null);
detector.handleData(bytes, 0, bytes.length);
detector.dataEnd();
return new String(bytes, detector.getDetectedCharset()).getBytes("UTF-8");
public static byte[] toUtf8(byte[] bytes) {
try {
UniversalDetector detector = new UniversalDetector(null);
detector.handleData(bytes, 0, bytes.length);
detector.dataEnd();
return new String(bytes, detector.getDetectedCharset()).getBytes("UTF-8");
} catch (Exception e) {
return bytes;
}
}
public static boolean isSub(String ext) {

Binary file not shown.

View File

@ -1 +1 @@
bdaba6bfae7ce2c142343af8e9731c4d
a28d41c9e6a71040d06dc948cb62a64a