Clean code
This commit is contained in:
parent
65a8859471
commit
de7cb5c2d9
|
|
@ -358,9 +358,16 @@ public class AliYun {
|
|||
}
|
||||
}
|
||||
|
||||
public String playerContent(String[] ids, boolean original) {
|
||||
if (original) return Result.get().url(getMultiThreadedDownloadUrl(ids[0], ids[1])).octet().subs(getSubs(ids)).header(getHeader()).string();
|
||||
else return getPreviewContent(ids);
|
||||
public String playerContent(String[] ids, String flag) {
|
||||
if (flag.split("#")[0].equals("原畫")) {
|
||||
return getPreviewContent(ids);
|
||||
} else if (flag.split("#")[0].equals("普畫")) {
|
||||
return Result.get().url(getDownloadUrl(ids[0], ids[1])).octet().subs(getSubs(ids)).header(getHeader()).string();
|
||||
} else if (flag.split("#")[0].equals("極速")) {
|
||||
return Result.get().url(MultiThread.url(getDownloadUrl(ids[0], ids[1]), 4)).octet().subs(getSubs(ids)).header(getHeader()).string();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private String getPreviewContent(String[] ids) {
|
||||
|
|
@ -412,12 +419,6 @@ public class AliYun {
|
|||
return resp.getResponse().getStatus() == 404;
|
||||
}
|
||||
|
||||
public String getMultiThreadedDownloadUrl(String shareId, String fileId) {
|
||||
String url = getDownloadUrl(shareId, fileId);
|
||||
url = MultiThread.proxyUrl(url, 2);
|
||||
return url;
|
||||
}
|
||||
|
||||
public Object[] proxySub(Map<String, String> params) throws Exception {
|
||||
String fileId = params.get("fileId");
|
||||
String shareId = params.get("shareId");
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class Ali extends Spider {
|
|||
|
||||
@Override
|
||||
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||
return AliYun.get().playerContent(id.split("\\+"), flag.split("#")[0].equals("原畫"));
|
||||
return AliYun.get().playerContent(id.split("\\+"), flag);
|
||||
}
|
||||
|
||||
private Vod parseVod(Matcher matcher, String id) {
|
||||
|
|
@ -54,10 +54,11 @@ public class Ali extends Spider {
|
|||
*/
|
||||
public String detailContentVodPlayFrom(List<String> ids) {
|
||||
List<String> playFrom = new ArrayList<>();
|
||||
if (ids.size() < 2) return TextUtils.join("$$$", Arrays.asList("原畫", "普畫"));
|
||||
if (ids.size() < 2) return TextUtils.join("$$$", Arrays.asList("原畫", "普畫", "極速"));
|
||||
for (int i = 1; i <= ids.size(); i++) {
|
||||
playFrom.add(String.format(Locale.getDefault(), "原畫#%02d", i));
|
||||
playFrom.add(String.format(Locale.getDefault(), "普畫#%02d", i));
|
||||
playFrom.add(String.format(Locale.getDefault(), "極速#%02d", i));
|
||||
}
|
||||
return TextUtils.join("$$$", playFrom);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import fi.iki.elonen.NanoHTTPD;
|
|||
|
||||
public class MultiThread {
|
||||
|
||||
public static String proxyUrl(String url, int thread) {
|
||||
public static String url(String url, int thread) {
|
||||
return String.format(Proxy.getUrl() + "?do=multi&url=%s&thread=%d", URLEncoder.encode(url), thread);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue