From d3873b9c65fcda832d7bc3eefda238dfca628953 Mon Sep 17 00:00:00 2001 From: yangqiang3504 <412594121@qq.com> Date: Fri, 19 Aug 2022 16:36:49 +0800 Subject: [PATCH] add - PushAgent XBiubiu1 --- .../com/github/catvod/spider/PushAgent.java | 23 +++++++------------ .../java/com/github/catvod/utils/Misc.java | 11 +++++---- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/github/catvod/spider/PushAgent.java b/app/src/main/java/com/github/catvod/spider/PushAgent.java index 5a7bd86..1e34978 100644 --- a/app/src/main/java/com/github/catvod/spider/PushAgent.java +++ b/app/src/main/java/com/github/catvod/spider/PushAgent.java @@ -453,17 +453,15 @@ public class PushAgent extends Spider { Matcher matcher2 = pattern2.matcher(url); Matcher matcher = pattern.matcher(url); if (Misc.isVip(url) && !url.contains("qq.com") && !url.contains("mgtv.com")) { - String typeName = "官源"; Document doc = Jsoup.parse(OkHttpUtil.string(url, null)); String VodName = doc.select("head > title").text(); JSONObject result = new JSONObject(); JSONArray lists = new JSONArray(); JSONObject vodAtom = new JSONObject(); - if(url.contains("iqiyi")) typeName = "爱奇艺"; vodAtom.put("vod_id", url); vodAtom.put("vod_name", VodName); vodAtom.put("vod_pic", "https://img.zcool.cn/community/0123545c74c5aea801213f261297df.png"); - vodAtom.put("type_name", typeName); + vodAtom.put("type_name", "官源"); vodAtom.put("vod_year", ""); vodAtom.put("vod_area", ""); vodAtom.put("vod_remarks", ""); @@ -486,16 +484,13 @@ public class PushAgent extends Spider { if (!playListA.isEmpty()) { for (int j = 0; j < playListA.size(); j++) { Element vod = playListA.get(j); - String img = vod.select("img").attr("src"); - if(img.equals("")||!img.contains("trailerlite")){ - String a = vod.select("div").attr("data-vid"); - String b = vod.select("div").attr("data-cid"); - String id = "https://v.qq.com/x/cover/" + b + "/" + a + ".html"; - String name = vod.select("div span").text(); - vodItems.add(name + "$" + id); - } + String a = vod.select("div").attr("data-vid"); + String b = vod.select("div").attr("data-cid"); + String id = "https://v.qq.com/x/cover/" + b + "/" + a; + String name = vod.select("div span").text(); + vodItems.add(name + "$" + id); } - String playList = com.github.catvod.utils.TextUtils.join("#", vodItems); + String playList = TextUtils.join("#", vodItems); vodAtom.put("vod_play_url", playList); } else { vodAtom.put("vod_play_url", "立即播放$" + url); @@ -530,9 +525,7 @@ public class PushAgent extends Spider { if (a.length() > 0) { for (int i = 0; i < a.length(); i++) { JSONObject jObj = a.getJSONObject(i); - String isnew = jObj.getString("isnew"); - String isvip = jObj.getString("isvip"); - if (!(isnew.equals("2")&&isvip.equals("0"))) { + if (jObj.getString("isIntact").equals("1")) { String VodName = jObj.getString("t4"); String id = jObj.getString("video_id"); String VodId = "https://www.mgtv.com/b/" + mgtv1.group(1) + "/" + id + ".html"; diff --git a/app/src/main/java/com/github/catvod/utils/Misc.java b/app/src/main/java/com/github/catvod/utils/Misc.java index 3470503..e9b6b66 100644 --- a/app/src/main/java/com/github/catvod/utils/Misc.java +++ b/app/src/main/java/com/github/catvod/utils/Misc.java @@ -13,9 +13,9 @@ import java.security.NoSuchAlgorithmException; import java.util.regex.Pattern; public class Misc { - public static final String MoAgent = "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 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 UaWinChrome = "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 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 boolean isVip(String url) { // 适配2.0.6的调用应用内解析列表的支持, 需要配合直连分析一起使用,参考cjt影视和极品直连 @@ -43,9 +43,12 @@ public class Misc { return false; } - public HashMap Headers() { + public static HashMap Headers(int type) { HashMap headers = new HashMap<>(); - headers.put("User-Agent", MoAgent); + if(type==0){ + headers.put("User-Agent", UaWinChrome); + }else headers.put("User-Agent", MoAgent); + headers.put("Connection", " Keep-Alive"); return headers; }