Support xiaoya search
This commit is contained in:
parent
1688807361
commit
77e0169647
|
|
@ -136,6 +136,10 @@ public class Drive {
|
|||
return getHost() + (isNew() ? "/api/fs/search" : "/api/public/search");
|
||||
}
|
||||
|
||||
public String searchApi(String param) {
|
||||
return getHost() + "/search?box=" + param + "&url=&type=video";
|
||||
}
|
||||
|
||||
public Drive check() {
|
||||
if (path == null) setPath(Uri.parse(getServer()).getPath());
|
||||
if (version == 0) setVersion(OkHttp.string(settingsApi()).contains("v2.") ? 2 : 3);
|
||||
|
|
|
|||
|
|
@ -72,6 +72,10 @@ public class Item {
|
|||
return TextUtils.isEmpty(thumb) ? "" : thumb;
|
||||
}
|
||||
|
||||
public void setThumb(String thumb) {
|
||||
this.thumb = thumb;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return TextUtils.isEmpty(url) ? "" : url.startsWith("//") ? "http:" + url : url;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ import com.github.catvod.net.OkHttp;
|
|||
import com.github.catvod.utils.Utils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -251,6 +254,29 @@ public class AList extends Spider {
|
|||
|
||||
@Override
|
||||
public List<Vod> call() {
|
||||
List<Vod> alist = alist();
|
||||
return alist.size() > 0 ? alist : xiaoya();
|
||||
}
|
||||
|
||||
private List<Vod> xiaoya() {
|
||||
List<Vod> 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;
|
||||
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));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<Vod> alist() {
|
||||
try {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
String response = post(drive, drive.searchApi(), drive.params(keyword));
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
a04665ee58c5c24676bd43b11a01e918
|
||||
ae892558d47c58a60932c7552fbc4bc7
|
||||
|
|
|
|||
Loading…
Reference in New Issue