Merge branch 'main' into mine
# Conflicts: # app/src/main/java/com/github/catvod/utils/Util.java # jar/custom_spider.jar # jar/custom_spider.jar.md5
This commit is contained in:
commit
94965d7bfe
|
|
@ -56,7 +56,6 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3'
|
||||
implementation 'com.github.thegrizzlylabs:sardine-android:0.9'
|
||||
implementation 'wang.harlon.quickjs:wrapper-android:2.0.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
|
||||
|
|
|
|||
|
|
@ -545,11 +545,10 @@ public class AliYun {
|
|||
String fileId = params.get("fileId");
|
||||
String shareId = params.get("shareId");
|
||||
Response res = OkHttp.newCall(getDownloadUrl(shareId, fileId), getHeaderAuth());
|
||||
byte[] body = Util.toUtf8(res.body().bytes());
|
||||
Object[] result = new Object[3];
|
||||
result[0] = 200;
|
||||
result[1] = "application/octet-stream";
|
||||
result[2] = new ByteArrayInputStream(body);
|
||||
result[2] = new ByteArrayInputStream(res.body().bytes());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import org.jsoup.Jsoup;
|
|||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
|
@ -37,8 +36,6 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.Response;
|
||||
|
||||
public class AList extends Spider {
|
||||
|
||||
private List<Drive> drives;
|
||||
|
|
@ -254,24 +251,12 @@ public class AList extends Spider {
|
|||
String[] split = text.split("@@@");
|
||||
String name = split[0];
|
||||
String ext = split[1];
|
||||
String url = Proxy.getUrl() + "?do=alist&type=sub&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 {
|
||||
if (!"sub".equals(params.get("type"))) return null;
|
||||
String url = params.get("url");
|
||||
Response res = OkHttp.newCall(url, getPlayHeader(url));
|
||||
byte[] body = Util.toUtf8(res.body().bytes());
|
||||
Object[] result = new Object[3];
|
||||
result[0] = 200;
|
||||
result[1] = "application/octet-stream";
|
||||
result[2] = new ByteArrayInputStream(body);
|
||||
return result;
|
||||
}
|
||||
|
||||
class Job implements Callable<List<Vod>> {
|
||||
|
||||
private final Drive drive;
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ public class Proxy extends Spider {
|
|||
return new Object[]{200, "text/plain; charset=utf-8", new ByteArrayInputStream("ok".getBytes("UTF-8"))};
|
||||
case "ali":
|
||||
return Ali.proxy(params);
|
||||
case "alist":
|
||||
return AList.proxy(params);
|
||||
case "bili":
|
||||
return Bili.proxy(params);
|
||||
case "webdav":
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@ import android.webkit.WebViewClient;
|
|||
|
||||
import com.github.catvod.spider.Init;
|
||||
|
||||
import kotlin.io.encoding.Base64Kt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.mozilla.universalchardet.UniversalDetector;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.Charset;
|
||||
|
|
@ -68,25 +63,6 @@ public class Util {
|
|||
return RULE.matcher(url).find();
|
||||
}
|
||||
|
||||
public static byte[] toUtf8(byte[] bytes) {
|
||||
try {
|
||||
UniversalDetector detector = new UniversalDetector(null);
|
||||
detector.handleData(bytes, 0, bytes.length);
|
||||
detector.dataEnd();
|
||||
return removeBOM(new String(bytes, detector.getDetectedCharset()).getBytes("UTF-8"));
|
||||
} catch (Exception e) {
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] removeBOM(byte[] bytes) {
|
||||
byte[] bom = {(byte) 0xEF, (byte) 0xBB, (byte) 0xBF};
|
||||
if (bytes.length < 3 || !Arrays.equals(Arrays.copyOf(bytes, 3), bom)) return bytes;
|
||||
byte[] newBytes = new byte[bytes.length - 3];
|
||||
System.arraycopy(bytes, 3, newBytes, 0, newBytes.length);
|
||||
return newBytes;
|
||||
}
|
||||
|
||||
public static boolean isSub(String ext) {
|
||||
return SUB.contains(ext);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue