add - bili88
This commit is contained in:
@@ -20,7 +20,6 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
|
|
||||||
public class XBiubiu extends Spider {
|
public class XBiubiu extends Spider {
|
||||||
private PushAgent pushAgent= null;
|
private PushAgent pushAgent= null;
|
||||||
@@ -102,20 +101,11 @@ public class XBiubiu extends Spider {
|
|||||||
private JSONObject category(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
private JSONObject category(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
||||||
try {
|
try {
|
||||||
fetchRule();
|
fetchRule();
|
||||||
if (tid.equals("空"))
|
|
||||||
tid = "";
|
|
||||||
String qishiye = rule.optString("qishiye", "nil");
|
|
||||||
if (qishiye.equals("空"))
|
|
||||||
pg = "";
|
|
||||||
else if (!qishiye.equals("nil")) {
|
|
||||||
pg = String.valueOf(Integer.parseInt(pg) - 1 + Integer.parseInt(qishiye));
|
|
||||||
}
|
|
||||||
String baseUrl = getRuleVal("url");
|
String baseUrl = getRuleVal("url");
|
||||||
String webUrl = baseUrl + tid + pg + getRuleVal("houzhui");
|
String webUrl = baseUrl + tid + pg + getRuleVal("houzhui");
|
||||||
String html = fetch(webUrl);
|
String html = fetch(webUrl);
|
||||||
html = removeUnicode(html);
|
|
||||||
String parseContent = html;
|
String parseContent = html;
|
||||||
boolean shifouercijiequ = getRuleVal("shifouercijiequ").equals("1");
|
boolean shifouercijiequ = getRuleVal("shifouercijiequ","1").equals("1");
|
||||||
if (shifouercijiequ) {
|
if (shifouercijiequ) {
|
||||||
String jiequqian = getRuleVal("jiequqian");
|
String jiequqian = getRuleVal("jiequqian");
|
||||||
String jiequhou = getRuleVal("jiequhou");
|
String jiequhou = getRuleVal("jiequhou");
|
||||||
@@ -126,30 +116,32 @@ public class XBiubiu extends Spider {
|
|||||||
JSONArray videos = new JSONArray();
|
JSONArray videos = new JSONArray();
|
||||||
ArrayList<String> jiequContents = subContent(parseContent, jiequshuzuqian, jiequshuzuhou);
|
ArrayList<String> jiequContents = subContent(parseContent, jiequshuzuqian, jiequshuzuhou);
|
||||||
for (int i = 0; i < jiequContents.size(); i++) {
|
for (int i = 0; i < jiequContents.size(); i++) {
|
||||||
try {
|
//try {
|
||||||
String jiequContent = jiequContents.get(i);
|
String jiequContent = jiequContents.get(i);
|
||||||
String title = removeHtml(subContent(jiequContent, getRuleVal("biaotiqian"), getRuleVal("biaotihou")).get(0));
|
String title = subContent(jiequContent, getRuleVal("biaotiqian"), getRuleVal("biaotihou")).get(0);
|
||||||
String pic = "";
|
String pic = subContent(jiequContent, getRuleVal("tupianqian"), getRuleVal("tupianhou")).get(0);
|
||||||
String tupianqian = getRuleVal("tupianqian").toLowerCase();
|
pic = Misc.fixUrl(webUrl, pic);
|
||||||
if (tupianqian.startsWith("http://") || tupianqian.startsWith("https://")) {
|
String link = subContent(jiequContent, getRuleVal("lianjieqian"), getRuleVal("lianjiehou")).get(0);
|
||||||
pic = getRuleVal("tupianqian");
|
//String remarks = subContent(jiequContent, getRuleVal("gengxinqian"), getRuleVal("gengxinhou")).get(0);
|
||||||
} else {
|
//String remarks = subContent(jiequContent, getRuleVal("gengxinqian"), getRuleVal("gengxinhou")).get(0).replaceAll("\\s+", "").replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
|
||||||
pic = subContent(jiequContent, getRuleVal("tupianqian"), getRuleVal("tupianhou")).get(0);
|
String mark = "";
|
||||||
|
if (!getRuleVal("gengxinqian").isEmpty() && !getRuleVal("gengxinhou").isEmpty()) {
|
||||||
|
try {
|
||||||
|
mark = subContent(jiequContent, getRuleVal("gengxinqian"), getRuleVal("gengxinhou")).get(0).replaceAll("\\s+", "").replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
|
||||||
|
} catch (Exception e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
}
|
}
|
||||||
pic = Misc.fixUrl(webUrl, pic);
|
|
||||||
String link = subContent(jiequContent, getRuleVal("lianjieqian"), getRuleVal("lianjiehou")).get(0);
|
|
||||||
link = getRuleVal("ljqianzhui").isEmpty() ? (link + getRuleVal("ljhouzhui")) : ("x:" + getRuleVal("ljqianzhui")) + link + getRuleVal("ljhouzhui");
|
|
||||||
String remark = !getRuleVal("fubiaotiqian").isEmpty() && !getRuleVal("fubiaotihou").isEmpty() ?
|
|
||||||
removeHtml(subContent(jiequContent, getRuleVal("fubiaotiqian"), getRuleVal("fubiaotihou")).get(0)) : "";
|
|
||||||
JSONObject v = new JSONObject();
|
|
||||||
v.put("vod_id", baseUrl+link + "$$$" + pic + "$$$" + title);
|
|
||||||
v.put("vod_name", title);
|
|
||||||
v.put("vod_pic", pic);
|
|
||||||
v.put("vod_remarks", remark);
|
|
||||||
videos.put(v);
|
|
||||||
} catch (Throwable th) {
|
|
||||||
th.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
JSONObject v = new JSONObject();
|
||||||
|
v.put("vod_id", baseUrl+link + "$$$" + pic + "$$$" + title);// v.put("vod_id", title + "$$$" + pic + "$$$" + link);
|
||||||
|
v.put("vod_name", title);
|
||||||
|
v.put("vod_pic", pic);
|
||||||
|
v.put("vod_remarks", mark);
|
||||||
|
videos.put(v);
|
||||||
|
//} catch (Throwable th) {
|
||||||
|
//th.printStackTrace();
|
||||||
|
//break;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("page", pg);
|
result.put("page", pg);
|
||||||
@@ -163,21 +155,7 @@ public class XBiubiu extends Spider {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
private static String removeUnicode(String str) {
|
|
||||||
Pattern pattern = Pattern.compile("(\\\\u(\\w{4}))");
|
|
||||||
Matcher matcher = pattern.matcher(str);
|
|
||||||
while (matcher.find()) {
|
|
||||||
String full = matcher.group(1);
|
|
||||||
String ucode = matcher.group(2);
|
|
||||||
char c = (char) Integer.parseInt(ucode, 16);
|
|
||||||
str = str.replace(full, c + "");
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
String removeHtml(String text) {
|
|
||||||
return Jsoup.parse(text).text();
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
||||||
JSONObject obj = category(tid, pg, filter, extend);
|
JSONObject obj = category(tid, pg, filter, extend);
|
||||||
@@ -451,28 +429,16 @@ public class XBiubiu extends Spider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<String> subContent(String content, String startFlag, String endFlag) {
|
private ArrayList<String> subContent(String content, String startFlag, String endFlag) {
|
||||||
return Misc.subContent(content,startFlag,endFlag);
|
ArrayList<String> result = new ArrayList<>();
|
||||||
}
|
try {
|
||||||
|
Pattern pattern = Pattern.compile(startFlag + "(.*?)" + endFlag);
|
||||||
//修复软件不支持的格式无法嗅探的问题
|
Matcher matcher = pattern.matcher(content);
|
||||||
@Override
|
while (matcher.find()) {
|
||||||
public boolean manualVideoCheck() {
|
result.add(matcher.group(1));
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String[] videoFormatList = new String[]{".m3u8", ".mp4", ".mpeg", ".flv", ".m4a",".mp3",".wma",".wmv"};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isVideoFormat(String url) {
|
|
||||||
url = url.toLowerCase();
|
|
||||||
if (url.contains("=http") || url.contains("=https%3a%2f") || url.contains("=http%3a%2f")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (String format : videoFormatList) {
|
|
||||||
if (url.contains(format)) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
} catch (Throwable th) {
|
||||||
|
th.printStackTrace();
|
||||||
}
|
}
|
||||||
return false;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user