From 05147ad369906981eddc17ae7818457fea8d47ef Mon Sep 17 00:00:00 2001 From: qlql765 <108382776+qlql765@users.noreply.github.com> Date: Tue, 26 Sep 2023 17:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DAlist=E5=B0=8F=E9=9B=85?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E4=B8=8D=E8=83=BD=E6=92=AD=E6=94=BE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/github/catvod/spider/AList.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/github/catvod/spider/AList.java b/app/src/main/java/com/github/catvod/spider/AList.java index 092af240..dac862c1 100644 --- a/app/src/main/java/com/github/catvod/spider/AList.java +++ b/app/src/main/java/com/github/catvod/spider/AList.java @@ -262,16 +262,15 @@ public class AList extends Spider { List list = new ArrayList<>(); Document doc = Jsoup.parse(OkHttp.string(drive.searchApi(keyword))); for (Element a : doc.select("ul > a")) { - String[] splits = a.text().split("#"); - if (!splits[0].contains("/")) continue; - int index = splits[0].lastIndexOf("/"); - boolean folder = splits.length > 1; + String text = a.text(); + String regex = ".*\\.(dff|dsf|mp3|aac|wav|wma|cda|flac|m4a|mid|mka|mp2|mpa|mpc|ape|ofr|ogg|ra|wv|tta|ac3|dts|tak|webm|wmv|mpeg|mov|ram|swf|mp4|avi|rm|rmvb|flv|mpg|mkv|m3u8|ts|3gp|asf)$"; + boolean file = text.matches(regex); Item item = new Item(); - item.setType(folder ? 1 : 0); - item.setThumb(splits.length > 3 ? splits[4] : ""); - item.setPath("/" + splits[0].substring(0, index)); - item.setName(splits[0].substring(index + 1)); - list.add(item.getVod(drive, vodPic)); + int index = text.lastIndexOf("/"); + if (index == -1) continue; + item.setName(text); + item.setType(file ? 0 : 1); + list.add(item.getVod(drive,drive.getVodPic())); } return list; }