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

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",
"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",
"sites": [
{