Clean code

This commit is contained in:
FongMi 2023-06-14 17:19:56 +08:00
parent f068e23967
commit 31acf64a3c
5 changed files with 12 additions and 13 deletions

View File

@ -59,21 +59,20 @@ public class Push extends Ali {
private void setHttpSub(String url, List<Sub> subs) { private void setHttpSub(String url, List<Sub> subs) {
try { try {
String ext = Utils.getExt(url); List<String> vodTypes = Arrays.asList("mp4", "mkv");
if (!ext.equals("mp4") && !ext.equals("mkv")) return; List<String> subTypes = Arrays.asList("srt", "ass");
List<String> types = Arrays.asList(".srt", ".ass"); if (!vodTypes.contains(Utils.getExt(url))) return;
for (String type : types) detectSub(Utils.removeExt(url).concat(type), subs); for (String ext : subTypes) detectSub(url, ext, subs);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
private void detectSub(String url, List<Sub> subs) throws Exception { private void detectSub(String url, String ext, List<Sub> subs) throws Exception {
if (OkHttp.newCall(url).code() == 200) { url = Utils.removeExt(url).concat(".").concat(ext);
String ext = Utils.getExt(url); if (OkHttp.newCall(url).code() != 200) return;
String name = Uri.parse(url).getLastPathSegment(); String name = Uri.parse(url).getLastPathSegment();
subs.add(Sub.create().name(name).ext(ext).url(url)); subs.add(Sub.create().name(name).ext(ext).url(url));
}
} }
private void setFileSub(String url, List<Sub> subs) { private void setFileSub(String url, List<Sub> subs) {

Binary file not shown.

View File

@ -1 +1 @@
d0ac4c362ded4782f74f467bfa3420be d02ea3eb2cda4c0a98f3758125eb667e

View File

@ -1,5 +1,5 @@
{ {
"spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;d0ac4c362ded4782f74f467bfa3420be", "spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;d02ea3eb2cda4c0a98f3758125eb667e",
"wallpaper": "https://gao.chuqiuyu.tk", "wallpaper": "https://gao.chuqiuyu.tk",
"sites": [ "sites": [
{ {

View File

@ -1,5 +1,5 @@
{ {
"spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;d0ac4c362ded4782f74f467bfa3420be", "spider": "https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;d02ea3eb2cda4c0a98f3758125eb667e",
"wallpaper": "http://饭太硬.top/深色壁纸/api.php", "wallpaper": "http://饭太硬.top/深色壁纸/api.php",
"sites": [ "sites": [
{ {