Update
This commit is contained in:
parent
e48aae8c99
commit
a8a83d401d
|
|
@ -475,8 +475,8 @@ public class AliYun {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] proxyVideo(Map<String, String> params) throws Exception {
|
public Object[] proxyVideo(Map<String, String> params) throws Exception {
|
||||||
String response = params.get("response");
|
|
||||||
String templateId = params.get("templateId");
|
String templateId = params.get("templateId");
|
||||||
|
String response = params.get("response");
|
||||||
String shareId = params.get("shareId");
|
String shareId = params.get("shareId");
|
||||||
String mediaId = params.get("mediaId");
|
String mediaId = params.get("mediaId");
|
||||||
String fileId = params.get("fileId");
|
String fileId = params.get("fileId");
|
||||||
|
|
@ -501,6 +501,7 @@ public class AliYun {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
downloadUrl = mediaUrl;
|
downloadUrl = mediaUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("url".equals(response)) return new Object[]{200, "text/plain; charset=utf-8", new ByteArrayInputStream(downloadUrl.getBytes("UTF-8"))};
|
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);
|
Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
for (String key : params.keySet()) headers.put(key, params.get(key));
|
for (String key : params.keySet()) headers.put(key, params.get(key));
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ import android.text.TextUtils;
|
||||||
|
|
||||||
import com.github.catvod.net.OkHttp;
|
import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.spider.Proxy;
|
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.net.URLEncoder;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
@ -23,25 +23,23 @@ public class ProxyVideo {
|
||||||
private static final String GO_SERVER = "http://127.0.0.1:7777/";
|
private static final String GO_SERVER = "http://127.0.0.1:7777/";
|
||||||
|
|
||||||
public static void go() {
|
public static void go() {
|
||||||
if (OkHttp.string(GO_SERVER).isEmpty()) OkHttp.string("http://127.0.0.1:" + Proxy.getPort() + "/go");
|
boolean close = OkHttp.string(GO_SERVER).isEmpty();
|
||||||
while (OkHttp.string(GO_SERVER).isEmpty()) SystemClock.sleep(20);
|
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() {
|
public static String goVer() {
|
||||||
String result = OkHttp.string(GO_SERVER + "version");
|
|
||||||
if (TextUtils.isEmpty(result)) return "";
|
|
||||||
try {
|
try {
|
||||||
JsonObject obj = JsonParser.parseString(result).getAsJsonObject();
|
go();
|
||||||
return obj.get("version").getAsString();
|
String result = OkHttp.string(GO_SERVER + "version");
|
||||||
|
return new JSONObject(result).optString("version");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String url(String url, int thread) {
|
public static String url(String url, int thread) {
|
||||||
go();
|
if (!TextUtils.isEmpty(goVer()) && url.contains("/proxy?")) url += "&response=url";
|
||||||
String version = goVersion();
|
|
||||||
if (!TextUtils.isEmpty(version) && url.contains("/proxy?")) url += "&response=url";
|
|
||||||
return String.format(Locale.getDefault(), "%s?url=%s&thread=%d", GO_SERVER, URLEncoder.encode(url), thread);
|
return String.format(Locale.getDefault(), "%s?url=%s&thread=%d", GO_SERVER, URLEncoder.encode(url), thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
0c59c1b070bb5ea028cd239464653435
|
d793cc92ea62550b731392d15bacb859
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue