add - 自定义默认图片

This commit is contained in:
yangqiang3504
2022-08-25 12:50:33 +08:00
parent 4e0cab7271
commit cbbf377bbe
3 changed files with 25 additions and 11 deletions
@@ -461,6 +461,7 @@ public class PushAgent extends Spider {
if (idInfo.length>1&&!idInfo[1].equals("")) { if (idInfo.length>1&&!idInfo[1].equals("")) {
pic = idInfo[1].trim(); pic = idInfo[1].trim();
} }
if(pic==null) pic = Misc.getWebName(url, 1);
Pattern pattern = Folder; Pattern pattern = Folder;
Pattern pattern2 = AliPLink; Pattern pattern2 = AliPLink;
Matcher matcher2 = pattern2.matcher(url); Matcher matcher2 = pattern2.matcher(url);
@@ -479,7 +480,7 @@ public class PushAgent extends Spider {
}else if(url.contains("bili"))vpic="http://image.xinjun58.com/sp/pic/bg/bili.jpg"; }else if(url.contains("bili"))vpic="http://image.xinjun58.com/sp/pic/bg/bili.jpg";
vodAtom.put("vod_id", url); vodAtom.put("vod_id", url);
vodAtom.put("vod_name", VodName); vodAtom.put("vod_name", VodName);
vodAtom.put("vod_pic", pic == null ? vpic : pic); vodAtom.put("vod_pic", pic);
vodAtom.put("type_name", typeName); vodAtom.put("type_name", typeName);
vodAtom.put("vod_year", ""); vodAtom.put("vod_year", "");
vodAtom.put("vod_area", ""); vodAtom.put("vod_area", "");
@@ -528,7 +529,7 @@ public class PushAgent extends Spider {
String remarks = doc.select(".intro-wrapper__update-desc").text(); String remarks = doc.select(".intro-wrapper__update-desc").text();
vodAtom.put("vod_id", url); vodAtom.put("vod_id", url);
vodAtom.put("vod_name", VodName); vodAtom.put("vod_name", VodName);
vodAtom.put("vod_pic", pic == null ? "http://image.xinjun58.com/sp/pic/bg/qq.jpg" : pic); vodAtom.put("vod_pic", pic);
vodAtom.put("type_name", "腾讯TV"); vodAtom.put("type_name", "腾讯TV");
vodAtom.put("vod_year", ""); vodAtom.put("vod_year", "");
vodAtom.put("vod_area", ""); vodAtom.put("vod_area", "");
@@ -572,7 +573,7 @@ public class PushAgent extends Spider {
} }
vodAtom.put("vod_id", url); vodAtom.put("vod_id", url);
vodAtom.put("vod_name", VodNames); vodAtom.put("vod_name", VodNames);
vodAtom.put("vod_pic", pic == null ? "http://image.xinjun58.com/sp/pic/bg/mgtv.jpg" : pic); vodAtom.put("vod_pic", pic);
vodAtom.put("type_name", "芒果TV"); vodAtom.put("type_name", "芒果TV");
vodAtom.put("vod_year", ""); vodAtom.put("vod_year", "");
vodAtom.put("vod_area", ""); vodAtom.put("vod_area", "");
@@ -591,7 +592,7 @@ public class PushAgent extends Spider {
vodAtom.put("vod_id", url); vodAtom.put("vod_id", url);
vodAtom.put("vod_name", url); vodAtom.put("vod_name", url);
vodAtom.put("vod_content", url); vodAtom.put("vod_content", url);
vodAtom.put("vod_pic", pic == null ? "" : pic); vodAtom.put("vod_pic", pic);
vodAtom.put("type_name", "直连"); vodAtom.put("type_name", "直连");
vodAtom.put("vod_play_from", "player"); vodAtom.put("vod_play_from", "player");
vodAtom.put("vod_play_url", "立即播放$" + url); vodAtom.put("vod_play_url", "立即播放$" + url);
@@ -617,7 +618,6 @@ public class PushAgent extends Spider {
result.put("list", lists); result.put("list", lists);
return result.toString(); return result.toString();
} else if (url.startsWith("http") && (matcher2.find())) { } else if (url.startsWith("http") && (matcher2.find())) {
pic = pic == null ? "http://image.xinjun58.com/sp/pic/bg/ali.jpg" : pic;
return getAliContent(list,pic); return getAliContent(list,pic);
} else if (url.startsWith("http") && (!matcher.find()) && (!matcher2.find())) { } else if (url.startsWith("http") && (!matcher.find()) && (!matcher2.find())) {
JSONObject vodAtom = new JSONObject(); JSONObject vodAtom = new JSONObject();
@@ -636,7 +636,8 @@ public class PushAgent extends Spider {
prefxs = prefxs.replace(baseUrl, "");// /vod/play/70631 prefxs = prefxs.replace(baseUrl, "");// /vod/play/70631
ArrayList<String> playList = new ArrayList<>(); ArrayList<String> playList = new ArrayList<>();
for (int i = 0; i < 5; i++) { for (int i = 0; i < 9; i++) {
boolean fb = false;
if(!content.contains(prefxs+"-"+i+"-"))continue; if(!content.contains(prefxs+"-"+i+"-"))continue;
Map<String, String> m = new LinkedHashMap<>(); Map<String, String> m = new LinkedHashMap<>();
Matcher mat = Pattern.compile("href=\"("+prefxs+"-"+i+"-\\d+.html).*?/a>").matcher(content); Matcher mat = Pattern.compile("href=\"("+prefxs+"-"+i+"-\\d+.html).*?/a>").matcher(content);
@@ -649,7 +650,7 @@ public class PushAgent extends Spider {
uri=baseUrl + uri; uri=baseUrl + uri;
if(m.containsKey(uri)){ if(m.containsKey(uri)){
b = m.get(uri); b = m.get(uri);
if((!b.contains("")&&!b.contains(""))||Misc.isNumeric(b)){ if(b.contains("一集")||(!b.contains("")&&!b.contains(""))||Misc.isNumeric(b)){
m.remove(uri); m.remove(uri);
m.put(uri, text); m.put(uri, text);
} }
@@ -664,12 +665,14 @@ public class PushAgent extends Spider {
VodName = b; VodName = b;
} else VodName = m.get(url); } else VodName = m.get(url);
} }
fb=true;
} }
vodItems = new ArrayList<>(); vodItems = new ArrayList<>();
for (String key : m.keySet()) { for (String key : m.keySet()) {
vodItems.add(m.get(key) + "$" + key); vodItems.add(m.get(key) + "$" + key);
} }
playList.add(TextUtils.join("#", vodItems)); if(fb) playList.add(0, TextUtils.join("#", vodItems));
else playList.add(TextUtils.join("#", vodItems));
} }
ArrayList<String> playFrom = new ArrayList<>(); ArrayList<String> playFrom = new ArrayList<>();
@@ -724,7 +727,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("vod_pic", pic == null ? "http://image.xinjun58.com/sp/pic/bg/zl.jpg" : pic); vodAtom.put("vod_pic", pic);
vodAtom.put("type_name", "嗅探"); vodAtom.put("type_name", "嗅探");
vodAtom.put("vod_content", url); vodAtom.put("vod_content", url);
@@ -124,6 +124,7 @@ public class PushAgentQQ extends Spider {
url = getRuleVal(jsonObject, "url"); url = getRuleVal(jsonObject, "url");
name = getRuleVal(jsonObject, "name"); name = getRuleVal(jsonObject, "name");
pic = getRuleVal(jsonObject, "pic"); pic = getRuleVal(jsonObject, "pic");
if(pic.equals("")) pic = Misc.getWebName(url, 1);
v = new JSONObject(); v = new JSONObject();
v.put("vod_id", url + "$$$" + pic + "$$$" + name); v.put("vod_id", url + "$$$" + pic + "$$$" + name);
v.put("vod_name", name); v.put("vod_name", name);
@@ -77,25 +77,35 @@ public class Misc {
return Headers(type,null); return Headers(type,null);
} }
public static String getWebName(String url){ public static String getWebName(String url,int type){
if (url.contains("mgtv.com")) { if (url.contains("mgtv.com")) {
return "芒果TV"; if(type==0) return "芒果TV";
if(type==1) return "http://image.xinjun58.com/sp/pic/bg/mgtv.jpg";
} }
if (url.contains("qq.com")) { if (url.contains("qq.com")) {
if(type==1) return "http://image.xinjun58.com/sp/pic/bg/qq.jpg";
return "腾讯视频"; return "腾讯视频";
} }
if (url.contains("iqiyi.com")) { if (url.contains("iqiyi.com")) {
if(type==1) return "http://image.xinjun58.com/sp/pic/bg/iqiyi.jpg";
return "爱奇艺"; return "爱奇艺";
} }
if (url.contains("youku.com")) {
if(type==1) return "http://image.xinjun58.com/sp/pic/bg/youku.jpg";
return "优酷";
}
if (url.contains("bilibili.com")) { if (url.contains("bilibili.com")) {
if(type==1) return "http://image.xinjun58.com/sp/pic/bg/bili.jpg";
return "哗哩哔哩"; return "哗哩哔哩";
} }
if (url.startsWith("magnet")) { if (url.startsWith("magnet")) {
return "磁力"; return "磁力";
} }
if (url.contains("aliyundrive")) { if (url.contains("aliyundrive")) {
if(type==1) return "http://image.xinjun58.com/sp/pic/bg/ali.jpg";
return "阿里云"; return "阿里云";
} }
if(type==1)return "http://image.xinjun58.com/sp/pic/bg/zl.jpg";
String host = Uri.parse(url).getHost(); String host = Uri.parse(url).getHost();
return host; return host;
} }