Support android 4.2
This commit is contained in:
parent
43f0e1a76c
commit
966cf98d0c
|
|
@ -8,7 +8,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.github.catvod.demo"
|
applicationId "com.github.catvod.demo"
|
||||||
minSdk 21
|
minSdk 17
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,9 +32,9 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
|
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
|
||||||
implementation 'com.google.code.gson:gson:2.9.1'
|
implementation 'com.google.code.gson:gson:2.9.1'
|
||||||
implementation 'cn.wanghaomiao:JsoupXpath:2.5.1'
|
implementation 'cn.wanghaomiao:JsoupXpath:2.5.1'
|
||||||
implementation 'com.google.zxing:core:3.5.0'
|
implementation 'com.google.zxing:core:3.3.0'
|
||||||
implementation 'org.jsoup:jsoup:1.15.3'
|
implementation 'org.jsoup:jsoup:1.15.3'
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,6 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
@ -134,7 +133,6 @@ public class Result {
|
||||||
return toString();
|
return toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new Gson().toJson(this);
|
return new Gson().toJson(this);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import com.github.catvod.crawler.SpiderDebug;
|
||||||
import com.github.catvod.net.OkHttpUtil;
|
import com.github.catvod.net.OkHttpUtil;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
@ -13,10 +13,10 @@ public class Proxy extends Spider {
|
||||||
|
|
||||||
private static int port = -1;
|
private static int port = -1;
|
||||||
|
|
||||||
public static Object[] proxy(Map<String, String> params) {
|
public static Object[] proxy(Map<String, String> params) throws UnsupportedEncodingException {
|
||||||
switch (Objects.requireNonNull(params.get("do"))) {
|
switch (Objects.requireNonNull(params.get("do"))) {
|
||||||
case "ck":
|
case "ck":
|
||||||
return new Object[]{200, "text/plain; charset=utf-8", new ByteArrayInputStream("ok".getBytes(StandardCharsets.UTF_8))};
|
return new Object[]{200, "text/plain; charset=utf-8", new ByteArrayInputStream("ok".getBytes("UTF-8"))};
|
||||||
case "ali":
|
case "ali":
|
||||||
return Ali.vod(params);
|
return Ali.vod(params);
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,7 @@ import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
@ -130,10 +127,10 @@ public class Misc {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String MD5(String src) {
|
public static String MD5(String src) {
|
||||||
return MD5(src, StandardCharsets.UTF_8);
|
return MD5(src, "UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String MD5(String src, Charset charset) {
|
public static String MD5(String src, String charset) {
|
||||||
try {
|
try {
|
||||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
byte[] messageDigest = md.digest(src.getBytes(charset));
|
byte[] messageDigest = md.digest(src.getBytes(charset));
|
||||||
|
|
@ -141,7 +138,7 @@ public class Misc {
|
||||||
StringBuilder sb = new StringBuilder(no.toString(16));
|
StringBuilder sb = new StringBuilder(no.toString(16));
|
||||||
while (sb.length() < 32) sb.insert(0, "0");
|
while (sb.length() < 32) sb.insert(0, "0");
|
||||||
return sb.toString().toLowerCase();
|
return sb.toString().toLowerCase();
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (Exception e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
940f5635d30de6ef9025c334afaf706b
|
efc8d7ab428b7bb8459f6d5614388ee2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue