Update paper
This commit is contained in:
parent
20cb96e603
commit
828353add4
|
|
@ -42,6 +42,10 @@ public class Result {
|
|||
return Result.get().classes(classes).vod(list).filters(filters).string();
|
||||
}
|
||||
|
||||
public static String string(List<Class> classes, LinkedHashMap<String, List<Filter>> filters) {
|
||||
return Result.get().classes(classes).filters(filters).string();
|
||||
}
|
||||
|
||||
public static String string(List<Class> classes, JSONObject filters) {
|
||||
return Result.get().classes(classes).filters(filters).string();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import com.github.catvod.crawler.Spider;
|
|||
import com.github.catvod.net.OkHttpUtil;
|
||||
import com.github.catvod.utils.Misc;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
|
@ -51,17 +50,17 @@ public class Paper extends Spider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String homeContent(boolean filter) throws JSONException {
|
||||
public String homeContent(boolean filter) {
|
||||
Document doc = Jsoup.parse(OkHttpUtil.string("https://u.gitcafe.net/", getHeaders()));
|
||||
Elements trs = doc.select("table.tableizer-table > tbody > tr");
|
||||
LinkedHashMap<String, List<Filter>> filters = new LinkedHashMap<>();
|
||||
List<Class> classes = new ArrayList<>();
|
||||
for (Element tr : trs) {
|
||||
if (tr.text().contains("音乐")) break;
|
||||
List<Filter.Value> values = new ArrayList<>();
|
||||
for (Element td : tr.select("td")) {
|
||||
if (td.hasClass("tableizer-title")) {
|
||||
String typeId = td.select("a").attr("href").replace("#", "");
|
||||
if (!types.contains(typeId)) continue;
|
||||
classes.add(new Class(typeId, td.text()));
|
||||
filters.put(typeId, Arrays.asList(new Filter("type", "類型", values)));
|
||||
} else {
|
||||
|
|
@ -70,11 +69,16 @@ public class Paper extends Spider {
|
|||
}
|
||||
}
|
||||
}
|
||||
return Result.string(classes, filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String homeVideoContent() throws Exception {
|
||||
List<Vod> list = new ArrayList<>();
|
||||
JSONObject homeData = new JSONObject(OkHttpUtil.string("https://gitcafe.net/alipaper/home.json", getHeaders()));
|
||||
List<Data> items = Data.arrayFrom(homeData.getJSONObject("info").getJSONArray("new").toString());
|
||||
for (Data item : items) if (types.contains(item.getCat())) list.add(item.getVod());
|
||||
return Result.string(classes, list, filters);
|
||||
return Result.string(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
bfaf0bbd8ea1541f0ea1cac088c3b59b
|
||||
2238f733904942609bb90b337dee9713
|
||||
|
|
|
|||
Loading…
Reference in New Issue