Search page demo

This commit is contained in:
FongMi 2023-07-31 15:05:18 +08:00
parent a50d74129f
commit b0c599b5bd
3 changed files with 16 additions and 19 deletions

View File

@ -49,25 +49,22 @@ public class PanSou extends Ali {
}
@Override
public String searchContent(String key, boolean quick) {
Map<String, String> types = new HashMap<>();
types.put("7", "資料夾");
types.put("1", "影片");
List<Vod> list = new ArrayList<>();
for (Map.Entry<String, String> entry : types.entrySet()) {
String typeId = entry.getKey();
String typeName = entry.getValue();
String url = siteUrl + "/search?k=" + URLEncoder.encode(key) + "&t=" + typeId;
public String searchContent(String key, boolean quick) throws Exception {
return searchContent(key, "1");
}
@Override
public String searchContent(String key, boolean quick, String pg) throws Exception {
return searchContent(key, pg);
}
private String searchContent(String key, String pg) {
String url = siteUrl + "/search?k=" + URLEncoder.encode(key) + "&page=" + pg + "&s=0&t=-1";
Elements items = Jsoup.parse(OkHttp.string(url)).select("van-row > a");
List<Vod> list = new ArrayList<>();
for (Element item : items) {
String title = item.selectFirst("template").text().trim();
if (!title.contains(key)) continue;
Vod vod = new Vod();
vod.setVodId(item.attr("href"));
vod.setVodName("[" + typeName + "] " + title);
vod.setVodPic("https://inews.gtimg.com/newsapp_bt/0/13263837859/1000");
list.add(vod);
}
if (title.contains(key)) list.add(new Vod(item.attr("href"), title, "https://inews.gtimg.com/newsapp_bt/0/13263837859/1000"));
}
return Result.string(list);
}

Binary file not shown.

View File

@ -1 +1 @@
c180867252ce20f2d59e5a7e6d4fd92a
20778c40c4dcb8675aa6a67e3faca620