uc和quark 优化
This commit is contained in:
parent
f107976989
commit
2d0ad541fc
|
|
@ -227,15 +227,18 @@ public class QuarkApi {
|
||||||
|
|
||||||
String fileId = split[0], fileToken = split[1], shareId = split[2], stoken = split[3];
|
String fileId = split[0], fileToken = split[1], shareId = split[2], stoken = split[3];
|
||||||
String playUrl = "";
|
String playUrl = "";
|
||||||
if (flag.contains("quark原画")) {
|
|
||||||
playUrl = this.getDownload(shareId, stoken, fileId, fileToken, true);
|
|
||||||
} else {
|
|
||||||
playUrl = this.getLiveTranscoding(shareId, stoken, fileId, fileToken, flag);
|
|
||||||
}
|
|
||||||
Map<String, String> header = getHeaders();
|
Map<String, String> header = getHeaders();
|
||||||
header.remove("Host");
|
header.remove("Host");
|
||||||
header.remove("Content-Type");
|
header.remove("Content-Type");
|
||||||
|
if (flag.contains("quark原画")) {
|
||||||
|
playUrl = this.getDownload(shareId, stoken, fileId, fileToken, true);
|
||||||
return Result.get().url(ProxyServer.INSTANCE.buildProxyUrl(playUrl, header)).octet().header(header).string();
|
return Result.get().url(ProxyServer.INSTANCE.buildProxyUrl(playUrl, header)).octet().header(header).string();
|
||||||
|
} else {
|
||||||
|
playUrl = this.getLiveTranscoding(shareId, stoken, fileId, fileToken, flag);
|
||||||
|
return Result.get().url(proxyVideoUrl(playUrl, header)).octet().header(header).string();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String proxyVideoUrl(String url, Map<String, String> header) {
|
private String proxyVideoUrl(String url, Map<String, String> header) {
|
||||||
|
|
|
||||||
|
|
@ -217,23 +217,19 @@ public class UCApi {
|
||||||
SpiderDebug.log("flag:" + flag);
|
SpiderDebug.log("flag:" + flag);
|
||||||
String fileId = split[0], fileToken = split[1], shareId = split[2], stoken = split[3];
|
String fileId = split[0], fileToken = split[1], shareId = split[2], stoken = split[3];
|
||||||
String playUrl = "";
|
String playUrl = "";
|
||||||
if (flag.contains("uc原画")) {
|
|
||||||
playUrl = this.getDownload(shareId, stoken, fileId, fileToken, true);
|
|
||||||
} else {
|
|
||||||
playUrl = this.getLiveTranscoding(shareId, stoken, fileId, fileToken, flag);
|
|
||||||
}
|
|
||||||
SpiderDebug.log("origin playUrl:" + playUrl);
|
SpiderDebug.log("origin playUrl:" + playUrl);
|
||||||
Map<String, String> header = getHeaders();
|
Map<String, String> header = getHeaders();
|
||||||
header.remove("Host");
|
header.remove("Host");
|
||||||
header.remove("Content-Type");
|
header.remove("Content-Type");
|
||||||
|
if (flag.contains("uc原画")) {
|
||||||
//UCTV 可以直接播放,不需要代理
|
playUrl = this.getDownload(shareId, stoken, fileId, fileToken, true);
|
||||||
if (testVideo(playUrl)) {
|
|
||||||
SpiderDebug.log("UCTV 可以直接播放,不需要代理" );
|
|
||||||
|
|
||||||
return Result.get().url(playUrl).string();
|
return Result.get().url(playUrl).string();
|
||||||
|
} else {
|
||||||
|
playUrl = this.getLiveTranscoding(shareId, stoken, fileId, fileToken, flag);
|
||||||
|
return Result.get().url(proxyVideoUrl(playUrl, new HashMap<>())).string();
|
||||||
}
|
}
|
||||||
return Result.get().url(ProxyServer.INSTANCE.buildProxyUrl(playUrl, new HashMap<>())).string();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean testVideo(String url) {
|
private boolean testVideo(String url) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue