add - B站

This commit is contained in:
yangqiang3504
2022-09-07 16:19:08 +08:00
parent 1d2d2a367e
commit f9d3d682d5
2 changed files with 46 additions and 23 deletions
@@ -478,6 +478,7 @@ public class PushAgent extends Spider {
vodAtom.put("vod_content", url);
vodAtom.put("vod_area", type + refreshToken);
if (Misc.isVip(url) && !url.contains("qq.com") && !url.contains("mgtv.com")) {
vodAtom.put("vod_play_from", "jx");
Elements playListA = null;
Document doc = Jsoup.parse(OkHttpUtil.string(url, Misc.Headers(0,url)));
String baseUrl = url.replaceAll("(^https?://.*?)(:\\d+)?/.*$", "$1");//https://www.dyk9.com
@@ -498,13 +499,14 @@ public class PushAgent extends Spider {
String playList = TextUtils.join("#", vodItems);
vodAtom.put("vod_play_url", playList);
}
vodAtom.put("vod_play_from", "parse");
} else {
vodAtom.put("vod_play_url", "立即播放$" + url);
}
VodName = doc.select("head > title").text();
JSONObject result = new JSONObject();
vodAtom.put("vod_name", VodName);
vodAtom.put("vod_play_from", "jx");
lists.put(vodAtom);
result.put("list", lists);
return result.toString();
@@ -826,11 +828,11 @@ public class PushAgent extends Spider {
return result.toString();
}
}
if(flag.startsWith("嗅探")){
if(flag.startsWith("嗅探")||flag.equals("parse")){
result.put("parse", 1);
result.put("playUrl", "");
result.put("url", id);
result.put("header", Misc.jHeaders(type,id).toString());
if(!flag.equals("parse")) result.put("header", Misc.jHeaders(type,id).toString());
return result.toString();
}
} catch (Exception e) {
@@ -82,30 +82,51 @@ public class PushAgentQQ extends Spider {
private JSONObject category(String tid, String pg, boolean filter, HashMap<String, String> extend,JSONObject jo) {
try {
if (jo == null) jo = PushAgent.fetchRule(true,1);
JSONArray videos = new JSONArray();
JSONArray array = jo.getJSONArray(tid);
JSONObject jsonObject = null, v = null;
String url=null,name=null,pic=null;
for (int i = 0; i < array.length(); i++) {
jsonObject = array.getJSONObject(i);
url = PushAgent.getRuleVal(jsonObject, "url");
name = PushAgent.getRuleVal(jsonObject, "name");
pic = PushAgent.getRuleVal(jsonObject, "pic");
if(pic.equals("")) pic = Misc.getWebName(url, 1);
v = new JSONObject();
v.put("vod_id", url + "$$$" + pic + "$$$" + name);
v.put("vod_name", name);
v.put("vod_pic", pic);
v.put("vod_remarks", Misc.getWebName(url,0));
videos.put(v);
JSONObject jsonObject = null, v = null;
if (tid.equals("bili")) {
String json = OkHttpUtil.string("https://api.bilibili.com/x/web-interface/ranking/v2?rid=0&type=all", null);
JSONObject j = new JSONObject(json);
JSONObject o = j.getJSONObject("data");
JSONArray array = o.getJSONArray("list");
for (int i = 0; i < array.length(); i++) {
jsonObject = array.getJSONObject(i);
url = jsonObject.optString("short_link", "");
name = jsonObject.optString("title", "");
pic = jsonObject.optString("pic", "");
v = new JSONObject();
v.put("vod_id", url + "$$$" + pic + "$$$" + name);
v.put("vod_name", name);
v.put("vod_pic", pic);
v.put("vod_remarks", "");
videos.put(v);
}
}else{
if (jo == null) jo = PushAgent.fetchRule(true,1);
JSONArray array = jo.getJSONArray(tid);
for (int i = 0; i < array.length(); i++) {
jsonObject = array.getJSONObject(i);
url = PushAgent.getRuleVal(jsonObject, "url");
name = PushAgent.getRuleVal(jsonObject, "name");
pic = PushAgent.getRuleVal(jsonObject, "pic");
if(pic.equals("")) pic = Misc.getWebName(url, 1);
v = new JSONObject();
v.put("vod_id", url + "$$$" + pic + "$$$" + name);
v.put("vod_name", name);
v.put("vod_pic", pic);
v.put("vod_remarks", Misc.getWebName(url,0));
videos.put(v);
}
}
JSONObject result = new JSONObject();
result.put("page", pg);
result.put("pagecount", Integer.MAX_VALUE);
result.put("limit", 120);
result.put("total", Integer.MAX_VALUE);
int limit = 20;int total = videos.length();
int page = Integer.parseInt(pg)+1;
result.put("page", page);
int pageCount = (int)Math.ceil((double)total/limit);
result.put("pagecount", pageCount);
result.put("limit", limit);
result.put("total", total);
result.put("list", videos);
return result;
} catch (Exception e) {