add - bili55

This commit is contained in:
yangqiang3504
2022-09-02 10:00:16 +08:00
parent 9e4a912892
commit d2b969675f
5 changed files with 300 additions and 449 deletions
@@ -22,15 +22,13 @@ import java.util.regex.Pattern;
import okhttp3.Call;
public class XBiubiu extends Spider {
private PushAgent pushAgent= null;
@Override
public void init(Context context) {
super.init(context);
}
public void init(Context context, String extend) {
pushAgent= new PushAgent();
pushAgent.init(context, "");
super.init(context, extend);
this.ext = extend;
}
@@ -101,11 +99,10 @@ public class XBiubiu extends Spider {
private JSONObject category(String tid, String pg, boolean filter, HashMap<String, String> extend) {
try {
fetchRule();
String baseUrl = getRuleVal("url");
String webUrl = baseUrl + tid + pg + getRuleVal("houzhui");
String webUrl = getRuleVal("url") + tid + pg + getRuleVal("houzhui");
String html = fetch(webUrl);
String parseContent = html;
boolean shifouercijiequ = getRuleVal("shifouercijiequ","1").equals("1");
boolean shifouercijiequ = getRuleVal("shifouercijiequ").equals("1");
if (shifouercijiequ) {
String jiequqian = getRuleVal("jiequqian");
String jiequhou = getRuleVal("jiequhou");
@@ -133,7 +130,7 @@ public class XBiubiu extends Spider {
}
}
JSONObject v = new JSONObject();
v.put("vod_id", baseUrl+link + "$$$" + pic + "$$$" + title);// v.put("vod_id", title + "$$$" + pic + "$$$" + link);
v.put("vod_id", title + "$$$" + pic + "$$$" + link);
v.put("vod_name", title);
v.put("vod_pic", pic);
v.put("vod_remarks", mark);
@@ -144,9 +141,12 @@ public class XBiubiu extends Spider {
//}
}
JSONObject result = new JSONObject();
result.put("page", pg);
result.put("pagecount", Integer.MAX_VALUE);
result.put("limit", 90);
int limit = 20;
int page = Integer.parseInt(pg);
result.put("page", page);
int pageCount = videos.length() == limit ? page + 1 : page;
result.put("pagecount", pageCount);
result.put("limit", limit);
result.put("total", Integer.MAX_VALUE);
result.put("list", videos);
return result;
@@ -166,128 +166,123 @@ public class XBiubiu extends Spider {
public String detailContent(List<String> ids) {
try {
fetchRule();
String[] idInfo = ids.get(0).split("\\$\\$\\$");
String webUrl = getRuleVal("url") + idInfo[2];
String html = fetch(webUrl);
String parseContent = html;
boolean bfshifouercijiequ = getRuleVal("bfshifouercijiequ").equals("1");
if (bfshifouercijiequ) {
String jiequqian = getRuleVal("bfjiequqian");
String jiequhou = getRuleVal("bfjiequhou");
parseContent = subContent(html, jiequqian, jiequhou).get(0);
}
ArrayList<String> playList = new ArrayList<>();
String jiequshuzuqian = getRuleVal("bfjiequshuzuqian");
boolean bfjiequshuzuqian = jiequshuzuqian.equals("");
if(!bfjiequshuzuqian){
String[] idInfo = ids.get(0).split("\\$\\$\\$");
String webUrl = idInfo[0];
String html = fetch(webUrl);
String parseContent = html;
boolean bfshifouercijiequ = getRuleVal("bfshifouercijiequ").equals("1");
if (bfshifouercijiequ) {
String jiequqian = getRuleVal("bfjiequqian");
String jiequhou = getRuleVal("bfjiequhou");
parseContent = subContent(html, jiequqian, jiequhou).get(0);
}
ArrayList<String> playList = new ArrayList<>();
String jiequshuzuhou = getRuleVal("bfjiequshuzuhou");
boolean bfyshifouercijiequ = getRuleVal("bfyshifouercijiequ").equals("1");
ArrayList<String> jiequContents = subContent(parseContent, jiequshuzuqian, jiequshuzuhou);
for (int i = 0; i < jiequContents.size(); i++) {
try {
String jiequContent = jiequContents.get(i);
String parseJqContent = bfyshifouercijiequ ? subContent(jiequContent, getRuleVal("bfyjiequqian"), getRuleVal("bfyjiequhou")).get(0) : jiequContent;
ArrayList<String> lastParseContents = subContent(parseJqContent, getRuleVal("bfyjiequshuzuqian"), getRuleVal("bfyjiequshuzuhou"));
List<String> vodItems = new ArrayList<>();
for (int j = 0; j < lastParseContents.size(); j++) {
String title = subContent(lastParseContents.get(j), getRuleVal("bfbiaotiqian"), getRuleVal("bfbiaotihou")).get(0);
String link = subContent(lastParseContents.get(j), getRuleVal("bflianjieqian"), getRuleVal("bflianjiehou")).get(0);
vodItems.add(title + "$" + link);
}
playList.add(0, android.text.TextUtils.join("#", vodItems));
} catch (Throwable th) {
th.printStackTrace();
break;
String jiequshuzuhou = getRuleVal("bfjiequshuzuhou");
boolean bfyshifouercijiequ = getRuleVal("bfyshifouercijiequ").equals("1");
ArrayList<String> jiequContents = subContent(parseContent, jiequshuzuqian, jiequshuzuhou);
for (int i = 0; i < jiequContents.size(); i++) {
try {
String jiequContent = jiequContents.get(i);
String parseJqContent = bfyshifouercijiequ ? subContent(jiequContent, getRuleVal("bfyjiequqian"), getRuleVal("bfyjiequhou")).get(0) : jiequContent;
ArrayList<String> lastParseContents = subContent(parseJqContent, getRuleVal("bfyjiequshuzuqian"), getRuleVal("bfyjiequshuzuhou"));
List<String> vodItems = new ArrayList<>();
for (int j = 0; j < lastParseContents.size(); j++) {
String title = subContent(lastParseContents.get(j), getRuleVal("bfbiaotiqian"), getRuleVal("bfbiaotihou")).get(0);
String link = subContent(lastParseContents.get(j), getRuleVal("bflianjieqian"), getRuleVal("bflianjiehou")).get(0);
vodItems.add(title + "$" + link);
}
playList.add(0, TextUtils.join("#", vodItems));
} catch (Throwable th) {
th.printStackTrace();
break;
}
}
String cover = idInfo[1], title = idInfo[2], area = "";
String director = "";
String actor = "";
String desc = "";
String remark = "";
String year = "";
String category = "";
String cover = idInfo[1], title = idInfo[0], area = "";
String director = "";
String actor = "";
String desc = "";
String remark = "";
String year = "";
String category = "";
if (!getRuleVal("leixinqian").isEmpty() && !getRuleVal("leixinhou").isEmpty()) {
try {
category = subContent(html, getRuleVal("leixinqian"), getRuleVal("leixinhou")).get(0).replaceAll("\\s+", "").replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!getRuleVal("leixinqian").isEmpty() && !getRuleVal("leixinhou").isEmpty()) {
try {
category = subContent(html, getRuleVal("leixinqian"), getRuleVal("leixinhou")).get(0).replaceAll("\\s+", "").replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!getRuleVal("niandaiqian").isEmpty() && !getRuleVal("niandaihou").isEmpty()) {
try {
year = subContent(html, getRuleVal("niandaiqian"), getRuleVal("niandaihou")).get(0).replaceAll("\\s+", "").replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
} catch (Exception e) {
SpiderDebug.log(e);
}
}
if (!getRuleVal("niandaiqian").isEmpty() && !getRuleVal("niandaihou").isEmpty()) {
try {
year = subContent(html, getRuleVal("niandaiqian"), getRuleVal("niandaihou")).get(0).replaceAll("\\s+", "").replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!getRuleVal("zhuangtaiqian").isEmpty() && !getRuleVal("zhuangtaihou").isEmpty()) {
try {
remark = subContent(html, getRuleVal("zhuangtaiqian"), getRuleVal("zhuangtaihou")).get(0);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
if (!getRuleVal("zhuangtaiqian").isEmpty() && !getRuleVal("zhuangtaihou").isEmpty()) {
try {
remark = subContent(html, getRuleVal("zhuangtaiqian"), getRuleVal("zhuangtaihou")).get(0);
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!getRuleVal("zhuyanqian").isEmpty() && !getRuleVal("zhuyanhou").isEmpty()) {
try {
actor = subContent(html, getRuleVal("zhuyanqian"), getRuleVal("zhuyanhou")).get(0).replaceAll("\\s+", "");
} catch (Exception e) {
SpiderDebug.log(e);
}
}
if (!getRuleVal("zhuyanqian").isEmpty() && !getRuleVal("zhuyanhou").isEmpty()) {
try {
actor = subContent(html, getRuleVal("zhuyanqian"), getRuleVal("zhuyanhou")).get(0).replaceAll("\\s+", "");
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!getRuleVal("daoyanqian").isEmpty() && !getRuleVal("daoyanhou").isEmpty()) {
try {
director = subContent(html, getRuleVal("daoyanqian"), getRuleVal("daoyanhou")).get(0).replaceAll("\\s+", "");
} catch (Exception e) {
SpiderDebug.log(e);
}
}
if (!getRuleVal("daoyanqian").isEmpty() && !getRuleVal("daoyanhou").isEmpty()) {
try {
director = subContent(html, getRuleVal("daoyanqian"), getRuleVal("daoyanhou")).get(0).replaceAll("\\s+", "");
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!getRuleVal("juqingqian").isEmpty() && !getRuleVal("juqinghou").isEmpty()) {
try {
desc = subContent(html, getRuleVal("juqingqian"), getRuleVal("juqinghou")).get(0);
if(desc!=null){
desc = desc.replace("\t", "");
desc = desc.replaceAll("\\.*>(.*)", "$1");
}
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!getRuleVal("juqingqian").isEmpty() && !getRuleVal("juqinghou").isEmpty()) {
try {
desc = subContent(html, getRuleVal("juqingqian"), getRuleVal("juqinghou")).get(0);
if(desc!=null){
desc = desc.replace("\t", "");
desc = desc.replaceAll("\\.*>(.*)", "$1");
}
} catch (Exception e) {
SpiderDebug.log(e);
}
}
JSONObject vod = new JSONObject();
vod.put("vod_id", ids.get(0));
vod.put("vod_name", title);
vod.put("vod_pic", cover);
vod.put("type_name", category);
vod.put("vod_year", year);
vod.put("vod_area", area);
vod.put("vod_remarks", remark);
vod.put("vod_actor", actor);
vod.put("vod_director", director);
vod.put("vod_content", desc);
JSONObject vod = new JSONObject();
vod.put("vod_id", ids.get(0));
vod.put("vod_name", title);
vod.put("vod_pic", cover);
vod.put("type_name", category);
vod.put("vod_year", year);
vod.put("vod_area", area);
vod.put("vod_remarks", remark);
vod.put("vod_actor", actor);
vod.put("vod_director", director);
vod.put("vod_content", desc);
ArrayList<String> playFrom = new ArrayList<>();
ArrayList<String> playFrom = new ArrayList<>();
for (int i = 0; i < playList.size(); i++) {
playFrom.add("播放列表" + (i + 1));
}
for (int i = 0; i < playList.size(); i++) {
playFrom.add("播放列表" + (i + 1));
}
String vod_play_from = TextUtils.join("$$$", playFrom);
String vod_play_url = TextUtils.join("$$$", playList);
vod.put("vod_play_from", vod_play_from);
vod.put("vod_play_url", vod_play_url);
String vod_play_from = android.text.TextUtils.join("$$$", playFrom);
String vod_play_url = TextUtils.join("$$$", playList);
vod.put("vod_play_from", vod_play_from);
vod.put("vod_play_url", vod_play_url);
JSONObject result = new JSONObject();
JSONArray list = new JSONArray();
list.put(vod);
result.put("list", list);
return result.toString();
} else return pushAgent.detailContent(ids);
JSONObject result = new JSONObject();
JSONArray list = new JSONArray();
list.put(vod);
result.put("list", list);
return result.toString();
} catch (Exception e) {
SpiderDebug.log(e);
}