Update alist format
This commit is contained in:
parent
52996032ca
commit
cc5dc7fdcf
|
|
@ -5,11 +5,12 @@ import android.text.TextUtils;
|
||||||
|
|
||||||
import com.github.catvod.bean.Class;
|
import com.github.catvod.bean.Class;
|
||||||
import com.github.catvod.net.OkHttp;
|
import com.github.catvod.net.OkHttp;
|
||||||
import com.github.catvod.utils.Image;
|
|
||||||
import com.github.catvod.utils.Util;
|
import com.github.catvod.utils.Util;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -17,14 +18,10 @@ import java.util.Map;
|
||||||
|
|
||||||
public class Drive {
|
public class Drive {
|
||||||
|
|
||||||
@SerializedName("drives")
|
|
||||||
private List<Drive> drives;
|
|
||||||
@SerializedName("params")
|
@SerializedName("params")
|
||||||
private List<Param> params;
|
private List<Param> params;
|
||||||
@SerializedName("login")
|
@SerializedName("login")
|
||||||
private Login login;
|
private Login login;
|
||||||
@SerializedName("vodPic")
|
|
||||||
private String vodPic;
|
|
||||||
@SerializedName("name")
|
@SerializedName("name")
|
||||||
private String name;
|
private String name;
|
||||||
@SerializedName("server")
|
@SerializedName("server")
|
||||||
|
|
@ -40,12 +37,9 @@ public class Drive {
|
||||||
@SerializedName("hidden")
|
@SerializedName("hidden")
|
||||||
private Boolean hidden;
|
private Boolean hidden;
|
||||||
|
|
||||||
public static Drive objectFrom(String str) {
|
public static List<Drive> arrayFrom(String str) {
|
||||||
return new Gson().fromJson(str, Drive.class);
|
Type listType = new TypeToken<List<Drive>>() {}.getType();
|
||||||
}
|
return new Gson().fromJson(str, listType);
|
||||||
|
|
||||||
public List<Drive> getDrives() {
|
|
||||||
return drives == null ? new ArrayList<>() : drives;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Param> getParams() {
|
public List<Param> getParams() {
|
||||||
|
|
@ -60,10 +54,6 @@ public class Drive {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVodPic() {
|
|
||||||
return TextUtils.isEmpty(vodPic) ? Image.FOLDER : vodPic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return TextUtils.isEmpty(name) ? "" : name;
|
return TextUtils.isEmpty(name) ? "" : name;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.github.catvod.bean.alist;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.github.catvod.bean.Vod;
|
import com.github.catvod.bean.Vod;
|
||||||
|
import com.github.catvod.utils.Image;
|
||||||
import com.github.catvod.utils.Util;
|
import com.github.catvod.utils.Util;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
@ -117,19 +118,19 @@ public class Item {
|
||||||
return id + getPath() + "/" + getName();
|
return id + getPath() + "/" + getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPic(String pic) {
|
public String getPic() {
|
||||||
return getThumb().isEmpty() && isFolder() ? pic : getThumb();
|
return getThumb().isEmpty() && isFolder() ? Image.FOLDER : getThumb();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemark() {
|
public String getRemark() {
|
||||||
return Util.getSize(getSize());
|
return Util.getSize(getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vod getVod(String id, String pic) {
|
public Vod getVod(String id) {
|
||||||
return new Vod(getVodId(id), getName(), getPic(pic), getRemark(), isFolder());
|
return new Vod(getVodId(id), getName(), getPic(), getRemark(), isFolder());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vod getVod(Drive drive, String pic) {
|
public Vod getVod(Drive drive) {
|
||||||
return new Vod(getVodId(drive.getName()), getName(), getPic(pic), drive.getName(), isFolder());
|
return new Vod(getVodId(drive.getName()), getName(), getPic(), drive.getName(), isFolder());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ import java.util.concurrent.TimeUnit;
|
||||||
public class AList extends Spider {
|
public class AList extends Spider {
|
||||||
|
|
||||||
private List<Drive> drives;
|
private List<Drive> drives;
|
||||||
private String vodPic;
|
|
||||||
private String ext;
|
private String ext;
|
||||||
|
|
||||||
private List<Filter> getFilter() {
|
private List<Filter> getFilter() {
|
||||||
|
|
@ -52,9 +51,7 @@ public class AList extends Spider {
|
||||||
private void fetchRule() {
|
private void fetchRule() {
|
||||||
if (drives != null && !drives.isEmpty()) return;
|
if (drives != null && !drives.isEmpty()) return;
|
||||||
if (ext.startsWith("http")) ext = OkHttp.string(ext);
|
if (ext.startsWith("http")) ext = OkHttp.string(ext);
|
||||||
Drive drive = Drive.objectFrom(ext);
|
drives = Drive.arrayFrom(ext);
|
||||||
drives = drive.getDrives();
|
|
||||||
vodPic = drive.getVodPic();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drive getDrive(String name) {
|
private Drive getDrive(String name) {
|
||||||
|
|
@ -109,8 +106,8 @@ public class AList extends Spider {
|
||||||
Sorter.sort(type, order, files);
|
Sorter.sort(type, order, files);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Item item : folders) list.add(item.getVod(tid, vodPic));
|
for (Item item : folders) list.add(item.getVod(tid));
|
||||||
for (Item item : files) list.add(item.getVod(tid, vodPic));
|
for (Item item : files) list.add(item.getVod(tid));
|
||||||
return Result.get().vod(list).page().string();
|
return Result.get().vod(list).page().string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,7 +123,6 @@ public class AList extends Spider {
|
||||||
vod.setVodPlayFrom(key);
|
vod.setVodPlayFrom(key);
|
||||||
vod.setVodId(id);
|
vod.setVodId(id);
|
||||||
vod.setVodName(name);
|
vod.setVodName(name);
|
||||||
vod.setVodPic(vodPic);
|
|
||||||
List<String> playUrls = new ArrayList<>();
|
List<String> playUrls = new ArrayList<>();
|
||||||
List<Item> parents = getList(path, false);
|
List<Item> parents = getList(path, false);
|
||||||
for (Item item : parents) if (item.isMedia(drive.isNew())) playUrls.add(item.getName() + "$" + encodeVodId(item.getVodId(path) + findSubs(path, parents)));
|
for (Item item : parents) if (item.isMedia(drive.isNew())) playUrls.add(item.getName() + "$" + encodeVodId(item.getVodId(path) + findSubs(path, parents)));
|
||||||
|
|
@ -279,7 +275,7 @@ public class AList extends Spider {
|
||||||
@Override
|
@Override
|
||||||
public List<Vod> call() {
|
public List<Vod> call() {
|
||||||
List<Vod> alist = alist();
|
List<Vod> alist = alist();
|
||||||
return alist.size() > 0 ? alist : xiaoya();
|
return !alist.isEmpty() ? alist : xiaoya();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Vod> xiaoya() {
|
private List<Vod> xiaoya() {
|
||||||
|
|
@ -295,7 +291,7 @@ public class AList extends Spider {
|
||||||
item.setThumb(splits.length > 3 ? splits[4] : "");
|
item.setThumb(splits.length > 3 ? splits[4] : "");
|
||||||
item.setPath("/" + splits[0].substring(0, index));
|
item.setPath("/" + splits[0].substring(0, index));
|
||||||
item.setName(splits[0].substring(index + 1));
|
item.setName(splits[0].substring(index + 1));
|
||||||
list.add(item.getVod(drive, vodPic));
|
list.add(item.getVod(drive));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
@ -305,7 +301,7 @@ public class AList extends Spider {
|
||||||
List<Vod> list = new ArrayList<>();
|
List<Vod> list = new ArrayList<>();
|
||||||
String response = post(drive, drive.searchApi(), drive.params(keyword));
|
String response = post(drive, drive.searchApi(), drive.params(keyword));
|
||||||
List<Item> items = Item.arrayFrom(getSearchJson(drive.isNew(), response));
|
List<Item> items = Item.arrayFrom(getSearchJson(drive.isNew(), response));
|
||||||
for (Item item : items) if (!item.ignore(drive.isNew())) list.add(item.getVod(drive, vodPic));
|
for (Item item : items) if (!item.ignore(drive.isNew())) list.add(item.getVod(drive));
|
||||||
return list;
|
return list;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
|
||||||
|
|
@ -1,45 +1,42 @@
|
||||||
{
|
[
|
||||||
"vodPic": "https://x.imgs.ovh/x/2023/09/05/64f680bb030b4.png",
|
{
|
||||||
"drives": [
|
"name": "小雅",
|
||||||
{
|
"server": "http://alist.xiaoya.pro"
|
||||||
"name": "小雅",
|
},
|
||||||
"server": "http://alist.xiaoya.pro"
|
{
|
||||||
|
"name": "觸光",
|
||||||
|
"server": "https://pan.ichuguang.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "一只魚",
|
||||||
|
"server": "https://vtok.pp.ua/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "七米藍",
|
||||||
|
"server": "https://al.chirmyram.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "神族九帝",
|
||||||
|
"server": "https://alist.shenzjd.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "梓澪",
|
||||||
|
"server": "https://zi0.cc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "範本",
|
||||||
|
"server": "https://one.fongmi.com",
|
||||||
|
"search": true,
|
||||||
|
"hidden": false,
|
||||||
|
"login": {
|
||||||
|
"username": "fongmi",
|
||||||
|
"password": "fongmi"
|
||||||
},
|
},
|
||||||
{
|
"params": [
|
||||||
"name": "觸光",
|
{
|
||||||
"server": "https://pan.ichuguang.com"
|
"path": "/安齋拉拉",
|
||||||
},
|
"pass": "18181818"
|
||||||
{
|
}
|
||||||
"name": "一只魚",
|
]
|
||||||
"server": "https://vtok.pp.ua/"
|
}
|
||||||
},
|
]
|
||||||
{
|
|
||||||
"name": "七米藍",
|
|
||||||
"server": "https://al.chirmyram.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "神族九帝",
|
|
||||||
"server": "https://alist.shenzjd.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "梓澪",
|
|
||||||
"server": "https://zi0.cc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "範本",
|
|
||||||
"server": "https://one.fongmi.com",
|
|
||||||
"search": true,
|
|
||||||
"hidden": false,
|
|
||||||
"login": {
|
|
||||||
"username": "fongmi",
|
|
||||||
"password": "fongmi"
|
|
||||||
},
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"path": "/安齋拉拉",
|
|
||||||
"pass": "18181818"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue