This commit is contained in:
GH Action - Upstream Sync 2023-08-10 01:20:31 +00:00
commit f462ed7282
7 changed files with 19 additions and 52 deletions

View File

@ -48,6 +48,7 @@ public class Data {
public JsonElement getResult() { public JsonElement getResult() {
return result; return result;
} }
public JsonElement getList() { public JsonElement getList() {
return list; return list;
} }

View File

@ -29,6 +29,7 @@ import com.github.catvod.utils.QRCode;
import com.github.catvod.utils.Utils; import com.github.catvod.utils.Utils;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
@ -109,15 +110,9 @@ public class Bili extends Spider {
@Override @Override
public String homeContent(boolean filter) throws Exception { public String homeContent(boolean filter) throws Exception {
if (extend.has("json")) return OkHttp.string(extend.get("json").getAsString());
List<Class> classes = new ArrayList<>(); List<Class> classes = new ArrayList<>();
LinkedHashMap<String, List<Filter>> filters = new LinkedHashMap<>(); LinkedHashMap<String, List<Filter>> filters = new LinkedHashMap<>();
JSONObject jSONObject = new JSONObject();
if (extend.has("json")) {
JSONObject json = new JSONObject(OkHttp.string(extend.get("json").getAsString()));
jSONObject.put("class", json.getJSONArray("classes"));
jSONObject.put("filters", json.getJSONObject("filter"));
return jSONObject.toString();
}
String[] types = extend.get("type").getAsString().split("#"); String[] types = extend.get("type").getAsString().split("#");
for (String type : types) { for (String type : types) {
classes.add(new Class(type)); classes.add(new Class(type));
@ -127,8 +122,7 @@ public class Bili extends Spider {
} }
@Override @Override
public String homeVideoContent() throws Exception { public String homeVideoContent() {
if (extend.has("json")) {
String api = "https://api.bilibili.com/x/web-interface/popular?ps=20"; String api = "https://api.bilibili.com/x/web-interface/popular?ps=20";
String json = OkHttp.string(api, getGuest()); String json = OkHttp.string(api, getGuest());
Resp resp = Resp.objectFrom(json); Resp resp = Resp.objectFrom(json);
@ -136,9 +130,6 @@ public class Bili extends Spider {
for (Resp.Result item : Resp.Result.arrayFrom(resp.getData().getList())) list.add(item.getVod()); for (Resp.Result item : Resp.Result.arrayFrom(resp.getData().getList())) list.add(item.getVod());
return Result.string(list); return Result.string(list);
} }
String[] types = extend.get("type").getAsString().split("#");
return categoryContent(types[0], "1", true, new HashMap<>());
}
@Override @Override
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception { public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
@ -187,7 +178,6 @@ public class Bili extends Spider {
} }
vod_play.put("相关推荐", TextUtils.join("#", playList)); vod_play.put("相关推荐", TextUtils.join("#", playList));
vod.setVodPlayFrom(TextUtils.join("$$$", vod_play.keySet())); vod.setVodPlayFrom(TextUtils.join("$$$", vod_play.keySet()));
vod.setVodPlayUrl(TextUtils.join("$$$", vod_play.values())); vod.setVodPlayUrl(TextUtils.join("$$$", vod_play.values()));
return Result.string(vod); return Result.string(vod);
@ -259,35 +249,11 @@ public class Bili extends Spider {
String id = media.getId() + "_" + media.getCodecId(); String id = media.getId() + "_" + media.getCodecId();
String type = media.getMimeType().split("/")[0]; String type = media.getMimeType().split("/")[0];
String baseUrl = media.getBaseUrl().replace("&", "&amp;"); String baseUrl = media.getBaseUrl().replace("&", "&amp;");
return String.format(Locale.getDefault(), return String.format(Locale.getDefault(), "<AdaptationSet>\n" + "<ContentComponent contentType=\"%s\"/>\n" + "<Representation id=\"%s\" bandwidth=\"%s\" codecs=\"%s\" mimeType=\"%s\" %s startWithSAP=\"%s\">\n" + "<BaseURL>%s</BaseURL>\n" + "<SegmentBase indexRange=\"%s\">\n" + "<Initialization range=\"%s\"/>\n" + "</SegmentBase>\n" + "</Representation>\n" + "</AdaptationSet>", type, id, media.getBandWidth(), media.getCodecs(), media.getMimeType(), params, media.getStartWithSap(), baseUrl, media.getSegmentBase().getIndexRange(), media.getSegmentBase().getInitialization());
"<AdaptationSet>\n" +
"<ContentComponent contentType=\"%s\"/>\n" +
"<Representation id=\"%s\" bandwidth=\"%s\" codecs=\"%s\" mimeType=\"%s\" %s startWithSAP=\"%s\">\n" +
"<BaseURL>%s</BaseURL>\n" +
"<SegmentBase indexRange=\"%s\">\n" +
"<Initialization range=\"%s\"/>\n" +
"</SegmentBase>\n" +
"</Representation>\n" +
"</AdaptationSet>",
type,
id, media.getBandWidth(), media.getCodecs(), media.getMimeType(), params, media.getStartWithSap(),
baseUrl,
media.getSegmentBase().getIndexRange(),
media.getSegmentBase().getInitialization());
} }
private String getMpd(Dash dash, String videoList, String audioList) { private String getMpd(Dash dash, String videoList, String audioList) {
return String.format(Locale.getDefault(), return String.format(Locale.getDefault(), "<MPD xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:mpeg:dash:schema:mpd:2011\" xsi:schemaLocation=\"urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd\" type=\"static\" mediaPresentationDuration=\"PT%sS\" minBufferTime=\"PT%sS\" profiles=\"urn:mpeg:dash:profile:isoff-on-demand:2011\">\n" + "<Period duration=\"PT%sS\" start=\"PT0S\">\n" + "%s\n" + "%s\n" + "</Period>\n" + "</MPD>", dash.getDuration(), dash.getMinBufferTime(), dash.getDuration(), videoList, audioList);
"<MPD xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:mpeg:dash:schema:mpd:2011\" xsi:schemaLocation=\"urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd\" type=\"static\" mediaPresentationDuration=\"PT%sS\" minBufferTime=\"PT%sS\" profiles=\"urn:mpeg:dash:profile:isoff-on-demand:2011\">\n" +
"<Period duration=\"PT%sS\" start=\"PT0S\">\n" +
"%s\n" +
"%s\n" +
"</Period>\n" +
"</MPD>",
dash.getDuration(), dash.getMinBufferTime(),
dash.getDuration(),
videoList,
audioList);
} }
private void checkLogin() { private void checkLogin() {

Binary file not shown.

View File

@ -1 +1 @@
1de1a94d0429f343a35986ef5e9145d6 edae7af0ef2089cfc135c90ce085aacd

View File

@ -1,5 +1,5 @@
{ {
"spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;1de1a94d0429f343a35986ef5e9145d6", "spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;edae7af0ef2089cfc135c90ce085aacd",
"wallpaper": "https://gao.chuqiuyu.tk", "wallpaper": "https://gao.chuqiuyu.tk",
"sites": [ "sites": [
{ {
@ -67,7 +67,7 @@
"searchable": 1, "searchable": 1,
"style": { "style": {
"type": "rect", "type": "rect",
"ratio": 1.486 "ratio": 1.485
} }
}, },
{ {
@ -78,7 +78,7 @@
"searchable": 1, "searchable": 1,
"style": { "style": {
"type": "rect", "type": "rect",
"ratio": 1.309 "ratio": 1.77
} }
}, },
{ {

View File

@ -1,5 +1,5 @@
{ {
"classes": [ "class": [
{ {
"type_name": "帕梅拉", "type_name": "帕梅拉",
"type_id": "帕梅拉" "type_id": "帕梅拉"
@ -37,6 +37,6 @@
"type_id": "动物世界" "type_id": "动物世界"
} }
], ],
"filter": { "filters": {
} }
} }

View File

@ -1,5 +1,5 @@
{ {
"spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;1de1a94d0429f343a35986ef5e9145d6", "spider": "https://fongmi.cachefly.net/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;edae7af0ef2089cfc135c90ce085aacd",
"wallpaper": "http://饭太硬.top/深色壁纸/api.php", "wallpaper": "http://饭太硬.top/深色壁纸/api.php",
"sites": [ "sites": [
{ {