add - 自定义视频路径6

This commit is contained in:
yangqiang3504
2022-08-23 14:48:23 +08:00
parent a73abb4d3b
commit e0dc84322a
3 changed files with 39 additions and 8 deletions
@@ -50,13 +50,14 @@ public class PushAgent extends Spider {
@Override
public void init(Context context, String extend) {
super.init(context, extend);
if (extend.startsWith("http")) {
Token = OkHttpUtil.string(extend, null);
} else {
if (extend != null) {
String[] arr = extend.split(";");
if (arr.length > 1) {
this.Token = arr[0];
}else Token = extend;
/* if (extend.startsWith("http")) {
Token = OkHttpUtil.string(extend, null);
} */
}
}
@@ -353,7 +354,7 @@ public class PushAgent extends Spider {
try {
String url = list.get(0).trim();
String[] idInfo = url.split("\\$\\$\\$");
if (idInfo.length > 1) url = idInfo[0].trim();
if (idInfo.length > 0) url = idInfo[0].trim();
Pattern pattern = Folder;
Matcher matcher = pattern.matcher(url);
if (!matcher.find()) {
@@ -455,9 +456,9 @@ public class PushAgent extends Spider {
try {
String url = list.get(0).trim();
String[] idInfo = url.split("\\$\\$\\$");
if (idInfo.length > 1) url = idInfo[0].trim();
if (idInfo.length > 0) url = idInfo[0].trim();
String pic = null;
if (!idInfo[1].equals("")) {
if (idInfo.length>1&&!idInfo[1].equals("")) {
pic = idInfo[1].trim();
}
Pattern pattern = Folder;
@@ -3,6 +3,7 @@ package com.github.catvod.spider;
import android.content.Context;
import com.github.catvod.crawler.Spider;
import com.github.catvod.crawler.SpiderDebug;
import com.github.catvod.utils.Misc;
import com.github.catvod.utils.okhttp.OkHttpUtil;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -124,7 +125,7 @@ public class PushAgentQQ extends Spider {
v.put("vod_id", url + "$$$" + pic + "$$$" + name);
v.put("vod_name", name);
v.put("vod_pic", pic);
v.put("vod_remarks", "");
v.put("vod_remarks", Misc.getWebName(url));
videos.put(v);
}
@@ -43,15 +43,44 @@ public class Misc {
return false;
}
public static HashMap<String, String> Headers(int type) {
public static HashMap<String, String> Headers(int type,String url) {
HashMap<String, String> headers = new HashMap<>();
if(type==0){
headers.put("User-Agent", UaWinChrome);
}else headers.put("User-Agent", MoAgent);
headers.put("Connection", " Keep-Alive");
if (url != null) {
headers.put("Referer", url);
}
return headers;
}
public static HashMap<String, String> Headers(int type) {
return Headers(type,null);
}
public static String getWebName(String url){
if (url.contains("mgtv.com")) {
return "芒果TV";
}
if (url.contains("qq.com")) {
return "腾讯视频";
}
if (url.contains("iqiyi.com")) {
return "爱奇艺";
}
if (url.contains("bilibili.com")) {
return "哗哩哔哩";
}
if (url.startsWith("magnet")) {
return "磁力";
}
if (url.contains("aliyundrive")) {
return "阿里云";
}
String host = Uri.parse(url).getHost();
return host;
}
private static final Pattern snifferMatch = Pattern.compile("http((?!http).){26,}?\\.(m3u8|mp4)\\?.*|http((?!http).){26,}\\.(m3u8|mp4)|http((?!http).){26,}?/m3u8\\?pt=m3u8.*|http((?!http).)*?default\\.ixigua\\.com/.*|http((?!http).)*?cdn-tos[^\\?]*|http((?!http).)*?/obj/tos[^\\?]*|http.*?/player/m3u8play\\.php\\?url=.*|http.*?/player/.*?[pP]lay\\.php\\?url=.*|http.*?/playlist/m3u8/\\?vid=.*|http.*?\\.php\\?type=m3u8&.*|http.*?/download.aspx\\?.*|http.*?/api/up_api.php\\?.*|https.*?\\.66yk\\.cn.*|http((?!http).)*?netease\\.com/file/.*");