add - 详情页播放

This commit is contained in:
yangqiang3504
2022-09-06 09:24:20 +08:00
parent 6c3081d719
commit 3388b9cac6
6 changed files with 33 additions and 42 deletions
@@ -46,7 +46,7 @@ public class Base64Utils {
uri = o.optString("page_url", "");
o2.put("title", title);
o2.put("url", uri);
o2.put("url", "upyunso.com/"+uri);
a2.put(o2);
}
}
@@ -41,11 +41,15 @@ public class PushAgent extends Spider {
public static Pattern Folder = Pattern.compile("www.aliyundrive.com/s/([^/]+)(/folder/([^/]+))?");
public static String Token="http://catvod.fun:8001/tv/ali.txt";
public static JSONObject siteRule = null;
public static String jsonUrl = "http://test.xinjun58.com/sp/d.json";
@Override
public void init(Context context, String extend) {
super.init(context, extend);
if (extend != null && !extend.equals("")) {
if (extend.startsWith("http")) {
Misc.jsonUrl = extend;
}
}
fetchRule(false,0);
}
@@ -58,7 +62,7 @@ public class PushAgent extends Spider {
public static JSONObject fetchRule(boolean flag,int t) {
try {
if (flag || siteRule == null) {
String json = OkHttpUtil.string(jsonUrl+"?t="+Time(), null);
String json = OkHttpUtil.string(Misc.jsonUrl+"?t="+Time(), null);
JSONObject jo = new JSONObject(json);
if(t==0) {
String[] fenleis = getRuleVal(jo,"fenlei", "").split("#");
@@ -87,7 +91,7 @@ public class PushAgent extends Spider {
return v;
}
public String getRuleVal(JSONObject o,String key) {
public static String getRuleVal(JSONObject o,String key) {
return getRuleVal(o,key, "");
}
@@ -469,6 +473,7 @@ public class PushAgent extends Spider {
}
String join2 = TextUtils.join("$$$", arrayList3);
jSONObject6.put("vod_play_url", join2);
jSONObject6.put("vod_area", type + Token);
JSONObject result = new JSONObject();
JSONArray jSONArray2 = new JSONArray();
jSONArray2.put(jSONObject6);
@@ -490,6 +495,7 @@ public class PushAgent extends Spider {
String url = list.get(0).trim();
String[] idInfo = url.split("\\$\\$\\$");
if (idInfo.length > 0) url = idInfo[0].trim();
url = Upyunso.getRealUrl(url);
String pic = null;
if (idInfo.length>1&&!idInfo[1].equals("")) {
pic = idInfo[1].trim();
@@ -13,25 +13,15 @@ import java.util.HashMap;
import java.util.List;
public class PushAgentQQ extends Spider {
private PushAgent pushAgent;
private static String j = "";
private static final long n = 0;
protected String ext = null;
protected JSONObject rule = null;
@Override
public void init(Context context, String extend) {
super.init(context, extend);
pushAgent = new PushAgent();
if (extend != null) {
if (!extend.startsWith("http")) {
String[] arr = extend.split(";");
this.ext = arr[1];
pushAgent.jsonUrl = arr[1];
}else {
this.ext = extend;
if (extend != null && !extend.equals("")) {
if (extend.startsWith("http")) {
Misc.jsonUrl = extend;
}
}
pushAgent.init(context, extend);
}
@Override
@@ -40,7 +30,7 @@ public class PushAgentQQ extends Spider {
fetchRule(true);
JSONObject result = new JSONObject();
JSONArray classes = new JSONArray();
String[] fenleis = pushAgent.getRuleVal(rule,"fenlei", "").split("#");
String[] fenleis = PushAgent.getRuleVal(rule,"fenlei", "").split("#");
for (String fenlei : fenleis) {
String[] info = fenlei.split("\\$");
JSONObject jsonObject = new JSONObject();
@@ -57,15 +47,15 @@ public class PushAgentQQ extends Spider {
return "";
}
protected JSONObject fetchRule(boolean flag) {
rule = pushAgent.fetchRule(flag, 0);
rule = PushAgent.fetchRule(flag, 0);
return rule;
}
@Override
public String homeVideoContent() {
try {
JSONObject jo = pushAgent.fetchRule(true,1);
JSONObject jo = PushAgent.fetchRule(true,1);
JSONArray videos = new JSONArray();
String[] fenleis = pushAgent.getRuleVal(jo, "fenlei", "").split("#");
String[] fenleis = PushAgent.getRuleVal(jo, "fenlei", "").split("#");
for (String fenlei : fenleis) {
String[] info = fenlei.split("\\$");
JSONObject data = category(info[1], "1", false, new HashMap<>(),jo);
@@ -91,16 +81,16 @@ public class PushAgentQQ extends Spider {
private JSONObject category(String tid, String pg, boolean filter, HashMap<String, String> extend,JSONObject jo) {
try {
if (jo == null) jo = pushAgent.fetchRule(true,1);
if (jo == null) jo = PushAgent.fetchRule(true,1);
JSONArray videos = new JSONArray();
JSONArray array = jo.getJSONArray(tid);
JSONObject jsonObject = null, v = null;
String url=null,name=null,pic=null;
for (int i = 0; i < array.length(); i++) {
jsonObject = array.getJSONObject(i);
url = pushAgent.getRuleVal(jsonObject, "url");
name = pushAgent.getRuleVal(jsonObject, "name");
pic = pushAgent.getRuleVal(jsonObject, "pic");
url = PushAgent.getRuleVal(jsonObject, "url");
name = PushAgent.getRuleVal(jsonObject, "name");
pic = PushAgent.getRuleVal(jsonObject, "pic");
if(pic.equals("")) pic = Misc.getWebName(url, 1);
v = new JSONObject();
v.put("vod_id", url + "$$$" + pic + "$$$" + name);
@@ -134,13 +124,13 @@ public class PushAgentQQ extends Spider {
@Override
public String detailContent(List<String> list) {
return pushAgent.detailContent(list);
return PushAgent.getDetail(list);
}
@Override
public String playerContent(String str, String str2, List<String> list) {
return pushAgent.playerContent(str, str2, list);
return PushAgent.player(str, str2, list);
}
@Override
@@ -21,13 +21,6 @@ public class Upyunso extends Spider {
@Override
public String detailContent(List<String> list) {
try {
String id = list.get(0);
String[] idInfo = id.split("\\$\\$\\$");
String url = idInfo[0];
String pic = idInfo[1];
String title = idInfo[2];
url = Base64Utils.sendGet(url);
list.set(0, url + "$$$" + pic + "$$$" + title);
return PushAgent.getDetail(list);
} catch (Exception e) {
e.printStackTrace();
@@ -35,6 +28,13 @@ public class Upyunso extends Spider {
}
}
public static String getRealUrl(String url){
if (url.contains("upyunso.com/download")) {
url = Base64Utils.sendGet(url);
}
return url;
}
@Override
public String playerContent(String str, String str2, List<String> list) {
return PushAgent.player(str, str2, list);
@@ -23,15 +23,12 @@ import okhttp3.Call;
import org.jsoup.Jsoup;
public class XBiubiu extends Spider {
private static PushAgent pushAgent= null;
@Override
public void init(Context context) {
super.init(context);
}
public void init(Context context, String extend) {
pushAgent= new PushAgent();
pushAgent.init(context, "");
super.init(context, extend);
this.ext = extend;
}
@@ -61,9 +58,7 @@ public class XBiubiu extends Spider {
protected HashMap<String, String> getHeaders(String url) {
HashMap<String, String> headers = new HashMap<>();
String ua = getRuleVal("UserW", Misc.UaWinChrome).trim();
if (ua.isEmpty())
ua = Misc.UaWinChrome;
String ua = getRuleVal("ua", Misc.UaWinChrome).trim();
headers.put("User-Agent", ua);
return headers;
}
@@ -309,7 +304,7 @@ public class XBiubiu extends Spider {
list.put(vod);
result.put("list", list);
return result.toString();
} else return pushAgent.detailContent(ids);
} else return PushAgent.getDetail(ids);
} catch (Exception e) {
SpiderDebug.log(e);
}
@@ -15,7 +15,7 @@ public class Misc {
public static final String UaWinChrome = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36";
public static final String DeAgent = "Dalvik/2.1.0 (Linux; U; Android " + Build.VERSION.RELEASE + "; " + Build.MODEL + " Build/" + Build.ID + ")";
public static final String MoAgent = "Mozilla/5.0 (Linux; Android 11; Ghxi Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 Mobile Safari/537.36 T7/12.16 SearchCraft/3.9.1 (Baidu; P1 11)";
public static String jsonUrl = "http://test.xinjun58.com/sp/d.json";
public static boolean isVip(String url) {
// 适配2.0.6的调用应用内解析列表的支持, 需要配合直连分析一起使用,参考cjt影视和极品直连
try {