Clean code

This commit is contained in:
FongMi 2022-11-30 23:34:52 +08:00
parent 14c05cc989
commit 99841e62e0
6 changed files with 8 additions and 8 deletions

View File

@ -48,7 +48,6 @@ public class Drive {
}
public int getVersion() {
checkVersion();
return version;
}
@ -84,8 +83,9 @@ public class Drive {
return getServer() + "/search?box=" + param + "&url=";
}
private void checkVersion() {
if (version == 0) setVersion(OkHttpUtil.string(settingsApi()).contains("v3.") ? 3 : 2);
public Drive check() {
if (getVersion() == 0) setVersion(OkHttpUtil.string(settingsApi()).contains("v3.") ? 3 : 2);
return this;
}
@Override

View File

@ -48,7 +48,7 @@ public class AList extends Spider {
}
private Drive getDrive(String name) {
return drives.get(drives.indexOf(new Drive(name)));
return drives.get(drives.indexOf(new Drive(name))).check();
}
@Override
@ -119,7 +119,7 @@ public class AList extends Spider {
fetchRule();
List<Vod> list = new ArrayList<>();
CountDownLatch cd = new CountDownLatch(drives.size());
for (Drive drive : drives) new Thread(() -> search(cd, list, drive, keyword)).start();
for (Drive drive : drives) new Thread(() -> search(cd, list, drive.check(), keyword)).start();
cd.await();
return Result.string(list);
}

Binary file not shown.

View File

@ -1 +1 @@
4c2c569b1472f4e040ebc6a2de961864
5013870b5cce8147c2a877f4da966cf0

View File

@ -1,5 +1,5 @@
{
"spider": "https://ghproxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;4c2c569b1472f4e040ebc6a2de961864",
"spider": "https://ghproxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;5013870b5cce8147c2a877f4da966cf0",
"wallpaper": "https://gao.chuqiuyu.tk",
"lives": [
{

View File

@ -1,5 +1,5 @@
{
"spider": "https://ghproxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;4c2c569b1472f4e040ebc6a2de961864",
"spider": "https://ghproxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;5013870b5cce8147c2a877f4da966cf0",
"wallpaper": "http://www.kf666888.cn/api/tvbox/img",
"lives": [
{