add - bili
This commit is contained in:
@@ -39,16 +39,14 @@ public class PushAgent extends Spider {
|
|||||||
private static final String SiteUrl = "https://api.aliyundrive.com";
|
private static final String SiteUrl = "https://api.aliyundrive.com";
|
||||||
private static final Pattern AliPLink = Pattern.compile("(https://www.aliyundrive.com/s/[^\"]+)");
|
private static final Pattern AliPLink = Pattern.compile("(https://www.aliyundrive.com/s/[^\"]+)");
|
||||||
public static Pattern Folder = Pattern.compile("www.aliyundrive.com/s/([^/]+)(/folder/([^/]+))?");
|
public static Pattern Folder = Pattern.compile("www.aliyundrive.com/s/([^/]+)(/folder/([^/]+))?");
|
||||||
public static String Token="3a49cf29cf20410997247c6eb4509be9";
|
public static String Token="http://catvod.fun:8001/tv/ali.txt";
|
||||||
public static JSONObject siteRule = null;
|
public static JSONObject siteRule = null;
|
||||||
public static String jsonUrl = "http://test.xinjun58.com/sp/d.json";
|
public static String jsonUrl = "http://test.xinjun58.com/sp/d.json";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Context context, String extend) {
|
public void init(Context context, String extend) {
|
||||||
super.init(context, extend);
|
super.init(context, extend);
|
||||||
if (extend != null) {
|
getToken(Token);
|
||||||
getToken(Token);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getToken(String token){
|
public void getToken(String token){
|
||||||
@@ -503,22 +501,44 @@ public class PushAgent extends Spider {
|
|||||||
Matcher matcher2 = pattern2.matcher(url);
|
Matcher matcher2 = pattern2.matcher(url);
|
||||||
Matcher matcher = pattern.matcher(url);
|
Matcher matcher = pattern.matcher(url);
|
||||||
List<String> vodItems = new ArrayList<>();
|
List<String> vodItems = new ArrayList<>();
|
||||||
|
ArrayList<String> aslist = new ArrayList<>();
|
||||||
JSONArray lists = new JSONArray();
|
JSONArray lists = new JSONArray();
|
||||||
String typeName = Misc.getWebName(url, 0);
|
String typeName = Misc.getWebName(url, 0);
|
||||||
JSONObject vodAtom = new JSONObject();
|
JSONObject vodAtom = new JSONObject();
|
||||||
String VodName = "";
|
String VodName = "",director = "",actor = "",desc = "";
|
||||||
vodAtom.put("vod_id", url);
|
vodAtom.put("vod_id", url);
|
||||||
vodAtom.put("vod_pic", pic);
|
vodAtom.put("vod_pic", pic);
|
||||||
vodAtom.put("type_name", typeName);
|
vodAtom.put("type_name", typeName);
|
||||||
vodAtom.put("vod_content", url);
|
vodAtom.put("vod_content", url);
|
||||||
vodAtom.put("vod_area", type + Token);
|
vodAtom.put("vod_area", type + Token);
|
||||||
if (Misc.isVip(url) && !url.contains("qq.com") && !url.contains("mgtv.com")) {
|
if (Misc.isVip(url) && !url.contains("qq.com") && !url.contains("mgtv.com")) {
|
||||||
|
Elements playListA = null;
|
||||||
Document doc = Jsoup.parse(OkHttpUtil.string(url, Misc.Headers(0,url)));
|
Document doc = Jsoup.parse(OkHttpUtil.string(url, Misc.Headers(0,url)));
|
||||||
|
String baseUrl = url.replaceAll("(^https?://.*?)(:\\d+)?/.*$", "$1");//https://www.dyk9.com
|
||||||
|
if (url.contains("bilibili.com/bangumi/play/ep")) {//第一集地址
|
||||||
|
String nids = url.replaceAll(".*/ep(\\d+).*", "$1");
|
||||||
|
int nid = Integer.parseInt(nids);
|
||||||
|
Elements el = doc.select(".ep-list-progress");
|
||||||
|
if(!el.isEmpty()){
|
||||||
|
String ptext = doc.select(".ep-list-progress").text();
|
||||||
|
String t = ptext.replaceAll("\\d+/(\\d+)", "$1");
|
||||||
|
int z = Integer.parseInt(t);
|
||||||
|
for (int i = 0; i < z; i++) {
|
||||||
|
int x = nid+i;
|
||||||
|
String id = baseUrl+"/bangumi/play/ep"+x+"/";
|
||||||
|
String name = i+1+"";
|
||||||
|
vodItems.add(name + "$" + id);
|
||||||
|
}
|
||||||
|
String playList = com.github.catvod.utils.TextUtils.join("#", vodItems);
|
||||||
|
vodAtom.put("vod_play_url", playList);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vodAtom.put("vod_play_url", "立即播放$" + url);
|
||||||
|
}
|
||||||
VodName = doc.select("head > title").text();
|
VodName = doc.select("head > title").text();
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
vodAtom.put("vod_name", VodName);
|
vodAtom.put("vod_name", VodName);
|
||||||
vodAtom.put("vod_play_from", "jx");
|
vodAtom.put("vod_play_from", "jx");
|
||||||
vodAtom.put("vod_play_url", "立即播放$" + url);
|
|
||||||
lists.put(vodAtom);
|
lists.put(vodAtom);
|
||||||
result.put("list", lists);
|
result.put("list", lists);
|
||||||
return result.toString();
|
return result.toString();
|
||||||
@@ -547,7 +567,7 @@ public class PushAgent extends Spider {
|
|||||||
vodItems.add(name + "$" + id);
|
vodItems.add(name + "$" + id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String playList = TextUtils.join("#", vodItems);
|
String playList = com.github.catvod.utils.TextUtils.join("#", vodItems);
|
||||||
vodAtom.put("vod_play_url", playList);
|
vodAtom.put("vod_play_url", playList);
|
||||||
} else {
|
} else {
|
||||||
vodAtom.put("vod_play_url", "立即播放$" + url);
|
vodAtom.put("vod_play_url", "立即播放$" + url);
|
||||||
@@ -581,7 +601,7 @@ public class PushAgent extends Spider {
|
|||||||
vodItems.add(VodName + "$" + VodId);
|
vodItems.add(VodName + "$" + VodId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String playList = TextUtils.join("#", vodItems);
|
String playList = com.github.catvod.utils.TextUtils.join("#", vodItems);
|
||||||
vodAtom.put("vod_play_url", playList);
|
vodAtom.put("vod_play_url", playList);
|
||||||
} else {
|
} else {
|
||||||
vodAtom.put("vod_play_url", "立即播放$" + url);
|
vodAtom.put("vod_play_url", "立即播放$" + url);
|
||||||
@@ -643,6 +663,7 @@ public class PushAgent extends Spider {
|
|||||||
fb=false;
|
fb=false;
|
||||||
url = baseUrl+mh.group(1);
|
url = baseUrl+mh.group(1);
|
||||||
}
|
}
|
||||||
|
setVideoDesc(vodAtom, content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,17 +733,18 @@ public class PushAgent extends Spider {
|
|||||||
for (String key : m.keySet()) {
|
for (String key : m.keySet()) {
|
||||||
vodItems.add(m.get(key) + "$" + key);
|
vodItems.add(m.get(key) + "$" + key);
|
||||||
}
|
}
|
||||||
if(fb) playList.add(0, TextUtils.join("#", vodItems));
|
if(fb) playList.add(0, com.github.catvod.utils.TextUtils.join("#", vodItems));
|
||||||
else playList.add(TextUtils.join("#", vodItems));
|
else playList.add(com.github.catvod.utils.TextUtils.join("#", vodItems));
|
||||||
}
|
}
|
||||||
ArrayList<String> playFrom = new ArrayList<>();
|
ArrayList<String> playFrom = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < playList.size(); i++) {
|
for (int i = 0; i < playList.size(); i++) {
|
||||||
|
String k = playList.get(i);
|
||||||
playFrom.add("嗅探列表" + (i + 1));
|
playFrom.add("嗅探列表" + (i + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
String vod_play_from = TextUtils.join("$$$", playFrom);
|
String vod_play_from = com.github.catvod.utils.TextUtils.join("$$$", playFrom);
|
||||||
String vod_play_url = TextUtils.join("$$$", playList);
|
String vod_play_url = com.github.catvod.utils.TextUtils.join("$$$", playList);
|
||||||
vodAtom.put("vod_play_from", vod_play_from);
|
vodAtom.put("vod_play_from", vod_play_from);
|
||||||
vodAtom.put("vod_play_url", vod_play_url);
|
vodAtom.put("vod_play_url", vod_play_url);
|
||||||
}else{
|
}else{
|
||||||
@@ -734,6 +756,7 @@ public class PushAgent extends Spider {
|
|||||||
vodAtom.put("vod_id", url);
|
vodAtom.put("vod_id", url);
|
||||||
vodAtom.put("vod_name", VodName);
|
vodAtom.put("vod_name", VodName);
|
||||||
vodAtom.put("type_name", "嗅探");
|
vodAtom.put("type_name", "嗅探");
|
||||||
|
setVideoDesc(vodAtom, content);
|
||||||
lists.put(vodAtom);
|
lists.put(vodAtom);
|
||||||
result.put("list", lists);
|
result.put("list", lists);
|
||||||
return result.toString();
|
return result.toString();
|
||||||
@@ -745,6 +768,42 @@ public class PushAgent extends Spider {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static JSONObject setVideoDesc(JSONObject vodAtom, String content) {
|
||||||
|
try {
|
||||||
|
if(vodAtom.has("vod_actor"))return vodAtom;
|
||||||
|
ArrayList<String> aslist = new ArrayList<>();
|
||||||
|
String director = "",actor = "",desc = "";
|
||||||
|
String directorRegx = "导演:</span>",actorRegx = "主演:</span>",descRegx = "简介:</span>";
|
||||||
|
boolean fb = true;
|
||||||
|
if (!Misc.matcher("actorRegx", content).find()) {
|
||||||
|
fb=false;
|
||||||
|
actorRegx = "主演:";
|
||||||
|
directorRegx = "导演:";
|
||||||
|
}
|
||||||
|
aslist = Misc.subContent(content, actorRegx, "</[p|li]>");
|
||||||
|
if(!aslist.isEmpty()) actor = aslist.get(0);
|
||||||
|
aslist = Misc.subContent(content, directorRegx, "</[p|li]>");
|
||||||
|
if(!aslist.isEmpty()) director = aslist.get(0);
|
||||||
|
aslist = Misc.subContent(content, descRegx, "</[p|li]>");
|
||||||
|
if(!aslist.isEmpty()) {
|
||||||
|
desc = aslist.get(0);
|
||||||
|
desc = Misc.trim(desc);
|
||||||
|
desc = desc.replaceAll("<a.*>", "");
|
||||||
|
desc = Misc.delHTMLTag(desc);
|
||||||
|
}
|
||||||
|
if (!fb) {
|
||||||
|
actor = Misc.delHTMLTag(actor);
|
||||||
|
director = Misc.delHTMLTag(director);
|
||||||
|
}
|
||||||
|
vodAtom.put("vod_actor", actor);
|
||||||
|
vodAtom.put("vod_director", director);
|
||||||
|
vodAtom.put("vod_content", desc);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
|
}
|
||||||
|
return vodAtom;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String playerContent(String flag, String id, List<String> vipFlags) {
|
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
@@ -754,7 +813,14 @@ public class PushAgent extends Spider {
|
|||||||
result.put("parse", 1);
|
result.put("parse", 1);
|
||||||
result.put("jx", "1");
|
result.put("jx", "1");
|
||||||
result.put("url", id);
|
result.put("url", id);
|
||||||
if(id.contains("bilibili"))result.put("header", Misc.jHeaders(0,id).toString());
|
if(id.contains("bilibili")){
|
||||||
|
result.put("header", Misc.jHeaders(0,id).toString());
|
||||||
|
String bili = fetchRule(false,0).optString("bili", "");
|
||||||
|
if (!bili.equals("")) {
|
||||||
|
result.put("playUrl", bili + id);
|
||||||
|
}else
|
||||||
|
result.put("playUrl", "");
|
||||||
|
}
|
||||||
else result.put("header", Misc.jHeaders(type,id).toString());
|
else result.put("header", Misc.jHeaders(type,id).toString());
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,14 @@ import java.util.regex.Pattern;
|
|||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
|
|
||||||
public class XBiubiu extends Spider {
|
public class XBiubiu extends Spider {
|
||||||
|
private PushAgent pushAgent= null;
|
||||||
@Override
|
@Override
|
||||||
public void init(Context context) {
|
public void init(Context context) {
|
||||||
super.init(context);
|
super.init(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(Context context, String extend) {
|
public void init(Context context, String extend) {
|
||||||
|
pushAgent= new PushAgent();
|
||||||
super.init(context, extend);
|
super.init(context, extend);
|
||||||
this.ext = extend;
|
this.ext = extend;
|
||||||
}
|
}
|
||||||
@@ -163,124 +164,128 @@ public class XBiubiu extends Spider {
|
|||||||
public String detailContent(List<String> ids) {
|
public String detailContent(List<String> ids) {
|
||||||
try {
|
try {
|
||||||
fetchRule();
|
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");
|
String jiequshuzuqian = getRuleVal("bfjiequshuzuqian");
|
||||||
String jiequshuzuhou = getRuleVal("bfjiequshuzuhou");
|
boolean bfjiequshuzuqian = jiequshuzuqian.equals("");
|
||||||
boolean bfyshifouercijiequ = getRuleVal("bfyshifouercijiequ").equals("1");
|
if(bfjiequshuzuqian){
|
||||||
ArrayList<String> jiequContents = subContent(parseContent, jiequshuzuqian, jiequshuzuhou);
|
String[] idInfo = ids.get(0).split("\\$\\$\\$");
|
||||||
for (int i = 0; i < jiequContents.size(); i++) {
|
String webUrl = getRuleVal("url") + idInfo[0];
|
||||||
try {
|
String html = fetch(webUrl);
|
||||||
String jiequContent = jiequContents.get(i);
|
String parseContent = html;
|
||||||
String parseJqContent = bfyshifouercijiequ ? subContent(jiequContent, getRuleVal("bfyjiequqian"), getRuleVal("bfyjiequhou")).get(0) : jiequContent;
|
boolean bfshifouercijiequ = getRuleVal("bfshifouercijiequ").equals("1");
|
||||||
ArrayList<String> lastParseContents = subContent(parseJqContent, getRuleVal("bfyjiequshuzuqian"), getRuleVal("bfyjiequshuzuhou"));
|
if (bfshifouercijiequ) {
|
||||||
List<String> vodItems = new ArrayList<>();
|
String jiequqian = getRuleVal("bfjiequqian");
|
||||||
for (int j = 0; j < lastParseContents.size(); j++) {
|
String jiequhou = getRuleVal("bfjiequhou");
|
||||||
String title = subContent(lastParseContents.get(j), getRuleVal("bfbiaotiqian"), getRuleVal("bfbiaotihou")).get(0);
|
parseContent = subContent(html, jiequqian, jiequhou).get(0);
|
||||||
String link = subContent(lastParseContents.get(j), getRuleVal("bflianjieqian"), getRuleVal("bflianjiehou")).get(0);
|
}
|
||||||
vodItems.add(title + "$" + link);
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
playList.add(0, TextUtils.join("#", vodItems));
|
|
||||||
} catch (Throwable th) {
|
|
||||||
th.printStackTrace();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
String cover = idInfo[1], title = idInfo[0], area = "";
|
String cover = idInfo[1], title = idInfo[2], area = "";
|
||||||
String director = "";
|
String director = "";
|
||||||
String actor = "";
|
String actor = "";
|
||||||
String desc = "";
|
String desc = "";
|
||||||
String remark = "";
|
String remark = "";
|
||||||
String year = "";
|
String year = "";
|
||||||
String category = "";
|
String category = "";
|
||||||
|
|
||||||
if (!getRuleVal("leixinqian").isEmpty() && !getRuleVal("leixinhou").isEmpty()) {
|
if (!getRuleVal("leixinqian").isEmpty() && !getRuleVal("leixinhou").isEmpty()) {
|
||||||
try {
|
try {
|
||||||
category = subContent(html, getRuleVal("leixinqian"), getRuleVal("leixinhou")).get(0).replaceAll("\\s+", "").replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
|
category = subContent(html, getRuleVal("leixinqian"), getRuleVal("leixinhou")).get(0).replaceAll("\\s+", "").replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SpiderDebug.log(e);
|
SpiderDebug.log(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!getRuleVal("niandaiqian").isEmpty() && !getRuleVal("niandaihou").isEmpty()) {
|
||||||
if (!getRuleVal("niandaiqian").isEmpty() && !getRuleVal("niandaihou").isEmpty()) {
|
try {
|
||||||
try {
|
year = subContent(html, getRuleVal("niandaiqian"), getRuleVal("niandaihou")).get(0).replaceAll("\\s+", "").replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
|
||||||
year = subContent(html, getRuleVal("niandaiqian"), getRuleVal("niandaihou")).get(0).replaceAll("\\s+", "").replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", "").replaceAll("[(/>)<]", "");
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
SpiderDebug.log(e);
|
||||||
SpiderDebug.log(e);
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!getRuleVal("zhuangtaiqian").isEmpty() && !getRuleVal("zhuangtaihou").isEmpty()) {
|
||||||
if (!getRuleVal("zhuangtaiqian").isEmpty() && !getRuleVal("zhuangtaihou").isEmpty()) {
|
try {
|
||||||
try {
|
remark = subContent(html, getRuleVal("zhuangtaiqian"), getRuleVal("zhuangtaihou")).get(0);
|
||||||
remark = subContent(html, getRuleVal("zhuangtaiqian"), getRuleVal("zhuangtaihou")).get(0);
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
SpiderDebug.log(e);
|
||||||
SpiderDebug.log(e);
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!getRuleVal("zhuyanqian").isEmpty() && !getRuleVal("zhuyanhou").isEmpty()) {
|
||||||
if (!getRuleVal("zhuyanqian").isEmpty() && !getRuleVal("zhuyanhou").isEmpty()) {
|
try {
|
||||||
try {
|
actor = subContent(html, getRuleVal("zhuyanqian"), getRuleVal("zhuyanhou")).get(0).replaceAll("\\s+", "");
|
||||||
actor = subContent(html, getRuleVal("zhuyanqian"), getRuleVal("zhuyanhou")).get(0).replaceAll("\\s+", "");
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
SpiderDebug.log(e);
|
||||||
SpiderDebug.log(e);
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!getRuleVal("daoyanqian").isEmpty() && !getRuleVal("daoyanhou").isEmpty()) {
|
||||||
if (!getRuleVal("daoyanqian").isEmpty() && !getRuleVal("daoyanhou").isEmpty()) {
|
try {
|
||||||
try {
|
director = subContent(html, getRuleVal("daoyanqian"), getRuleVal("daoyanhou")).get(0).replaceAll("\\s+", "");
|
||||||
director = subContent(html, getRuleVal("daoyanqian"), getRuleVal("daoyanhou")).get(0).replaceAll("\\s+", "");
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
SpiderDebug.log(e);
|
||||||
SpiderDebug.log(e);
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!getRuleVal("juqingqian").isEmpty() && !getRuleVal("juqinghou").isEmpty()) {
|
||||||
if (!getRuleVal("juqingqian").isEmpty() && !getRuleVal("juqinghou").isEmpty()) {
|
try {
|
||||||
try {
|
desc = subContent(html, getRuleVal("juqingqian"), getRuleVal("juqinghou")).get(0);
|
||||||
desc = subContent(html, getRuleVal("juqingqian"), getRuleVal("juqinghou")).get(0);
|
if(desc!=null){
|
||||||
if(desc!=null){
|
desc = desc.replace("\t", "");
|
||||||
desc = desc.replace("\t", "");
|
desc = desc.replaceAll("\\.*>(.*)", "$1");
|
||||||
desc = desc.replaceAll("\\.*>(.*)", "$1");
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
SpiderDebug.log(e);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject vod = new JSONObject();
|
JSONObject vod = new JSONObject();
|
||||||
vod.put("vod_id", ids.get(0));
|
vod.put("vod_id", ids.get(0));
|
||||||
vod.put("vod_name", title);
|
vod.put("vod_name", title);
|
||||||
vod.put("vod_pic", cover);
|
vod.put("vod_pic", cover);
|
||||||
vod.put("type_name", category);
|
vod.put("type_name", category);
|
||||||
vod.put("vod_year", year);
|
vod.put("vod_year", year);
|
||||||
vod.put("vod_area", area);
|
vod.put("vod_area", area);
|
||||||
vod.put("vod_remarks", remark);
|
vod.put("vod_remarks", remark);
|
||||||
vod.put("vod_actor", actor);
|
vod.put("vod_actor", actor);
|
||||||
vod.put("vod_director", director);
|
vod.put("vod_director", director);
|
||||||
vod.put("vod_content", desc);
|
vod.put("vod_content", desc);
|
||||||
|
|
||||||
ArrayList<String> playFrom = new ArrayList<>();
|
ArrayList<String> playFrom = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < playList.size(); i++) {
|
for (int i = 0; i < playList.size(); i++) {
|
||||||
playFrom.add("播放列表" + (i + 1));
|
playFrom.add("播放列表" + (i + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
String vod_play_from = TextUtils.join("$$$", playFrom);
|
String vod_play_from = android.text.TextUtils.join("$$$", playFrom);
|
||||||
String vod_play_url = TextUtils.join("$$$", playList);
|
String vod_play_url = TextUtils.join("$$$", playList);
|
||||||
vod.put("vod_play_from", vod_play_from);
|
vod.put("vod_play_from", vod_play_from);
|
||||||
vod.put("vod_play_url", vod_play_url);
|
vod.put("vod_play_url", vod_play_url);
|
||||||
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
JSONArray list = new JSONArray();
|
JSONArray list = new JSONArray();
|
||||||
list.put(vod);
|
list.put(vod);
|
||||||
result.put("list", list);
|
result.put("list", list);
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
} else return pushAgent.detailContent(ids);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SpiderDebug.log(e);
|
SpiderDebug.log(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.os.Build;
|
|||||||
import com.github.catvod.crawler.SpiderDebug;
|
import com.github.catvod.crawler.SpiderDebug;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
@@ -223,4 +224,37 @@ public class Misc {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Matcher matcher(String regx, String content) {
|
||||||
|
Pattern pattern = Pattern.compile(regx);
|
||||||
|
return pattern.matcher(content);
|
||||||
|
}
|
||||||
|
public static String trim(String str) {
|
||||||
|
return str == null ? str : str.replaceAll("^[\\s |\\s ]*|[\\s |\\s ]*$", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String delHTMLTag(String htmlStr){
|
||||||
|
String regEx_html="<[^>]+>"; //定义HTML标签的正则表达式
|
||||||
|
Pattern p_html=Pattern.compile(regEx_html,Pattern.CASE_INSENSITIVE);
|
||||||
|
Matcher m_html=p_html.matcher(htmlStr);
|
||||||
|
htmlStr=m_html.replaceAll(""); //过滤html标签
|
||||||
|
htmlStr = htmlStr.replaceAll("&| ", " ");
|
||||||
|
return htmlStr.trim(); //返回文本字符串
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<String> subContent(String content, String startFlag, String endFlag) {
|
||||||
|
ArrayList<String> result = new ArrayList<>();
|
||||||
|
if (content != null && content.length() > 1) {
|
||||||
|
try {
|
||||||
|
Pattern pattern = Pattern.compile(startFlag + "(.*?)" + endFlag);
|
||||||
|
Matcher matcher = pattern.matcher(content);
|
||||||
|
while (matcher.find()) {
|
||||||
|
result.add(matcher.group(1));
|
||||||
|
}
|
||||||
|
} catch (Throwable th) {
|
||||||
|
th.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user