add - 自定义视频路径6
This commit is contained in:
@@ -50,13 +50,14 @@ public class PushAgent extends Spider {
|
|||||||
@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.startsWith("http")) {
|
if (extend != null) {
|
||||||
Token = OkHttpUtil.string(extend, null);
|
|
||||||
} else {
|
|
||||||
String[] arr = extend.split(";");
|
String[] arr = extend.split(";");
|
||||||
if (arr.length > 1) {
|
if (arr.length > 1) {
|
||||||
this.Token = arr[0];
|
this.Token = arr[0];
|
||||||
}else Token = extend;
|
}else Token = extend;
|
||||||
|
/* if (extend.startsWith("http")) {
|
||||||
|
Token = OkHttpUtil.string(extend, null);
|
||||||
|
} */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,7 +354,7 @@ public class PushAgent extends Spider {
|
|||||||
try {
|
try {
|
||||||
String url = list.get(0).trim();
|
String url = list.get(0).trim();
|
||||||
String[] idInfo = url.split("\\$\\$\\$");
|
String[] idInfo = url.split("\\$\\$\\$");
|
||||||
if (idInfo.length > 1) url = idInfo[0].trim();
|
if (idInfo.length > 0) url = idInfo[0].trim();
|
||||||
Pattern pattern = Folder;
|
Pattern pattern = Folder;
|
||||||
Matcher matcher = pattern.matcher(url);
|
Matcher matcher = pattern.matcher(url);
|
||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
@@ -455,9 +456,9 @@ public class PushAgent extends Spider {
|
|||||||
try {
|
try {
|
||||||
String url = list.get(0).trim();
|
String url = list.get(0).trim();
|
||||||
String[] idInfo = url.split("\\$\\$\\$");
|
String[] idInfo = url.split("\\$\\$\\$");
|
||||||
if (idInfo.length > 1) url = idInfo[0].trim();
|
if (idInfo.length > 0) url = idInfo[0].trim();
|
||||||
String pic = null;
|
String pic = null;
|
||||||
if (!idInfo[1].equals("")) {
|
if (idInfo.length>1&&!idInfo[1].equals("")) {
|
||||||
pic = idInfo[1].trim();
|
pic = idInfo[1].trim();
|
||||||
}
|
}
|
||||||
Pattern pattern = Folder;
|
Pattern pattern = Folder;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.github.catvod.spider;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import com.github.catvod.crawler.Spider;
|
import com.github.catvod.crawler.Spider;
|
||||||
import com.github.catvod.crawler.SpiderDebug;
|
import com.github.catvod.crawler.SpiderDebug;
|
||||||
|
import com.github.catvod.utils.Misc;
|
||||||
import com.github.catvod.utils.okhttp.OkHttpUtil;
|
import com.github.catvod.utils.okhttp.OkHttpUtil;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@@ -124,7 +125,7 @@ public class PushAgentQQ extends Spider {
|
|||||||
v.put("vod_id", url + "$$$" + pic + "$$$" + name);
|
v.put("vod_id", url + "$$$" + pic + "$$$" + name);
|
||||||
v.put("vod_name", name);
|
v.put("vod_name", name);
|
||||||
v.put("vod_pic", pic);
|
v.put("vod_pic", pic);
|
||||||
v.put("vod_remarks", "");
|
v.put("vod_remarks", Misc.getWebName(url));
|
||||||
videos.put(v);
|
videos.put(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,15 +43,44 @@ public class Misc {
|
|||||||
return false;
|
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<>();
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
if(type==0){
|
if(type==0){
|
||||||
headers.put("User-Agent", UaWinChrome);
|
headers.put("User-Agent", UaWinChrome);
|
||||||
}else headers.put("User-Agent", MoAgent);
|
}else headers.put("User-Agent", MoAgent);
|
||||||
|
|
||||||
headers.put("Connection", " Keep-Alive");
|
headers.put("Connection", " Keep-Alive");
|
||||||
|
if (url != null) {
|
||||||
|
headers.put("Referer", url);
|
||||||
|
}
|
||||||
return headers;
|
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/.*");
|
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/.*");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user