This commit is contained in:
FongMi 2023-12-18 18:24:56 +08:00
parent e48aae8c99
commit a8a83d401d
4 changed files with 13 additions and 14 deletions

View File

@ -475,8 +475,8 @@ public class AliYun {
}
public Object[] proxyVideo(Map<String, String> params) throws Exception {
String response = params.get("response");
String templateId = params.get("templateId");
String response = params.get("response");
String shareId = params.get("shareId");
String mediaId = params.get("mediaId");
String fileId = params.get("fileId");
@ -501,6 +501,7 @@ public class AliYun {
lock.unlock();
downloadUrl = mediaUrl;
}
if ("url".equals(response)) return new Object[]{200, "text/plain; charset=utf-8", new ByteArrayInputStream(downloadUrl.getBytes("UTF-8"))};
Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
for (String key : params.keySet()) headers.put(key, params.get(key));

View File

@ -8,8 +8,8 @@ import android.text.TextUtils;
import com.github.catvod.net.OkHttp;
import com.github.catvod.spider.Proxy;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.json.JSONObject;
import java.net.URLEncoder;
import java.util.Locale;
@ -23,25 +23,23 @@ public class ProxyVideo {
private static final String GO_SERVER = "http://127.0.0.1:7777/";
public static void go() {
if (OkHttp.string(GO_SERVER).isEmpty()) OkHttp.string("http://127.0.0.1:" + Proxy.getPort() + "/go");
while (OkHttp.string(GO_SERVER).isEmpty()) SystemClock.sleep(20);
boolean close = OkHttp.string(GO_SERVER).isEmpty();
if (close) OkHttp.string("http://127.0.0.1:" + Proxy.getPort() + "/go");
if (close) while (OkHttp.string(GO_SERVER).isEmpty()) SystemClock.sleep(20);
}
public static String goVersion() {
String result = OkHttp.string(GO_SERVER + "version");
if (TextUtils.isEmpty(result)) return "";
public static String goVer() {
try {
JsonObject obj = JsonParser.parseString(result).getAsJsonObject();
return obj.get("version").getAsString();
go();
String result = OkHttp.string(GO_SERVER + "version");
return new JSONObject(result).optString("version");
} catch (Exception e) {
return "";
}
}
public static String url(String url, int thread) {
go();
String version = goVersion();
if (!TextUtils.isEmpty(version) && url.contains("/proxy?")) url += "&response=url";
if (!TextUtils.isEmpty(goVer()) && url.contains("/proxy?")) url += "&response=url";
return String.format(Locale.getDefault(), "%s?url=%s&thread=%d", GO_SERVER, URLEncoder.encode(url), thread);
}

Binary file not shown.

View File

@ -1 +1 @@
0c59c1b070bb5ea028cd239464653435
d793cc92ea62550b731392d15bacb859