From 83e72fd98a53a88dca2efcc23e6457453c54bfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=BB=84=E7=93=9C?= <> Date: Wed, 5 Jan 2022 20:08:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0json=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=92=8C=E5=BD=B1=E8=A7=86=E5=B7=A5=E5=8E=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../github/catvod/parser/JsonParallel.java | 15 +---- .../github/catvod/parser/JsonSequence.java | 17 ++--- .../java/com/github/catvod/spider/AppYs.java | 44 ++++++++----- .../java/com/github/catvod/spider/Ysgc.java | 65 ++++++++++--------- .../java/com/github/catvod/utils/Misc.java | 55 ++++++++++++++++ 5 files changed, 124 insertions(+), 72 deletions(-) diff --git a/app/src/main/java/com/github/catvod/parser/JsonParallel.java b/app/src/main/java/com/github/catvod/parser/JsonParallel.java index f8c7b0c10..077a415e0 100644 --- a/app/src/main/java/com/github/catvod/parser/JsonParallel.java +++ b/app/src/main/java/com/github/catvod/parser/JsonParallel.java @@ -3,6 +3,7 @@ import com.github.catvod.crawler.SpiderDebug; import com.github.catvod.crawler.SpiderReq; import com.github.catvod.crawler.SpiderUrl; +import com.github.catvod.utils.Misc; import org.json.JSONObject; @@ -37,19 +38,7 @@ public static JSONObject parse(LinkedHashMap jx, String url) { futures.add(completionService.submit(() -> { try { String json = SpiderReq.get(new SpiderUrl(parseUrl, null), "p_json_parse").content; - JSONObject jsonPlayData = new JSONObject(json); - JSONObject headers = new JSONObject(); - String ua = jsonPlayData.optString("user-agent", ""); - if (ua.trim().length() > 0) { - headers.put("User-Agent", " " + ua); - } - String referer = jsonPlayData.optString("referer", ""); - if (referer.trim().length() > 0) { - headers.put("Referer", " " + referer); - } - JSONObject taskResult = new JSONObject(); - taskResult.put("header", headers); - taskResult.put("url", jsonPlayData.getString("url")); + JSONObject taskResult = Misc.jsonParse(url, json); taskResult.put("jxFrom", jxName); SpiderDebug.log(taskResult.toString()); return taskResult; diff --git a/app/src/main/java/com/github/catvod/parser/JsonSequence.java b/app/src/main/java/com/github/catvod/parser/JsonSequence.java index cf74bbb9b..0ab12450c 100644 --- a/app/src/main/java/com/github/catvod/parser/JsonSequence.java +++ b/app/src/main/java/com/github/catvod/parser/JsonSequence.java @@ -3,6 +3,7 @@ import com.github.catvod.crawler.SpiderDebug; import com.github.catvod.crawler.SpiderReq; import com.github.catvod.crawler.SpiderUrl; +import com.github.catvod.utils.Misc; import org.json.JSONObject; @@ -26,19 +27,9 @@ public static JSONObject parse(LinkedHashMap jx, String url) { SpiderDebug.log(parseUrl); try { String json = SpiderReq.get(new SpiderUrl(parseUrl, null)).content; - JSONObject jsonPlayData = new JSONObject(json); - JSONObject headers = new JSONObject(); - String ua = jsonPlayData.optString("user-agent", ""); - if (ua.trim().length() > 0) { - headers.put("User-Agent", " " + ua); - } - String referer = jsonPlayData.optString("referer", ""); - if (referer.trim().length() > 0) { - headers.put("Referer", " " + referer); - } - JSONObject taskResult = new JSONObject(); - taskResult.put("header", headers); - taskResult.put("url", jsonPlayData.getString("url")); + JSONObject taskResult = Misc.jsonParse(url, json); + if (taskResult == null) + continue; taskResult.put("jxFrom", jxName); return taskResult; } catch (Throwable th) { diff --git a/app/src/main/java/com/github/catvod/spider/AppYs.java b/app/src/main/java/com/github/catvod/spider/AppYs.java index cdef54169..8228aa236 100644 --- a/app/src/main/java/com/github/catvod/spider/AppYs.java +++ b/app/src/main/java/com/github/catvod/spider/AppYs.java @@ -477,8 +477,10 @@ private String getSearchUrl(String URL, String KEY) { } else if (URL.contains("api.php/app") || URL.contains("xgapp.php/v1")) { return URL + "search?text=" + KEY + "&pg="; } else if (urlPattern1.matcher(URL).find()) { - if (URL.contains("lxue") - || URL.contains("jdys.weetai.cn") + if (URL.contains("tv.cttv") + || URL.contains("dcd") + || URL.contains("lxue") + || URL.contains("weetai.cn") || URL.contains("haokanju1") || URL.contains("fit:8") || URL.contains("zjj.life") @@ -497,7 +499,7 @@ private String getSearchUrl(String URL, String KEY) { || URL.contains("chxjon") || URL.contains("watchmi") || URL.contains("vipbp") - || URL.contains("wsba") + || URL.contains("bhtv") || URL.contains("xfykl")) { return URL + "?ac=list&" + "wd=" + KEY + "&page="; } else { @@ -529,7 +531,7 @@ private String getSearchUrl(String URL, String KEY) { Pattern.compile("zly\\.+xjqxz\\.+top/player/\\?url="), Pattern.compile("5znn\\.+xyz/m3u8\\.+php"), Pattern.compile("uid=1735&my="), - Pattern.compile("api\\.+iopenyun\\.+com:88/vip/\\?url="), + Pattern.compile("api\\.+xkvideo\\.+design/m3u8\\.+php\\?url="), Pattern.compile("play\\.+szbodankyy\\.+com/xxoocnmb"), Pattern.compile("vip\\.+fj6080\\.+xyz/player/\\?url="), Pattern.compile("a\\.+dxzj88\\.+com/jiexi"), @@ -548,8 +550,10 @@ private String getSearchUrl(String URL, String KEY) { }; private String UA(String URL) { - if (URL.contains("api.php/app") || URL.contains("xgapp.php/v1")) { + if (URL.contains("api.php/app") || URL.contains("xgapp.php/v1") || URL.contains("freekan")) { return "Dart/2.13 (dart:io)"; + } else if (URL.contains("xays") || URL.contains("xcys") || URL.contains("szys") || URL.contains("dxys") || URL.contains("ytys") || URL.contains("qnys")) { + return "Dart/2.15 (dart:io)"; } else if (URL.contains(".vod")) { return "okhttp/4.1.0"; } else { @@ -624,11 +628,11 @@ String getCateFilterUrlSuffix(String URL) { // ######筛选内容 String getFilterTypes(String URL) { if (URL.contains("api.php/app") || URL.contains("xgapp.php/v1")) { - return "类型+全部=+喜剧+爱情+恐怖+动作+科幻+剧情+战争+警匪+犯罪+动画+奇幻+武侠+冒险+枪战+恐怖+悬疑+惊悚+经典+青春+文艺+微电影+古装+历史+运动+农村+惊悚+伦理+情色+福利+惊悚+儿童+网络电影\n地区+全部=+内地+香港+台湾+美国+英国+法国+日本+韩国+德国+泰国+印度+西班牙+加拿大+其他\n语种+全部=+国语+英语+粤语+闽南语+韩语+日语+法语+德语+其他\n年份+全部=+2021+2020+2019+2018+2017+2016+2015+2014+2013+2012+2011+2010+2009+2008+2007+2006+2005+2004+2003+2002+2001+2000"; + return "类型+全部=+喜剧+爱情+恐怖+动作+科幻+剧情+战争+警匪+犯罪+动画+奇幻+武侠+冒险+枪战+恐怖+悬疑+惊悚+经典+青春+文艺+微电影+古装+历史+运动+农村+惊悚+伦理+情色+福利+三级+惊悚+儿童+网络电影\n地区+全部=+内地+香港+台湾+美国+英国+法国+日本+韩国+德国+泰国+印度+西班牙+加拿大+其他\n语种+全部=+国语+英语+粤语+闽南语+韩语+日语+法语+德语+其他\n年份+全部=+2021+2020+2019+2018+2017+2016+2015+2014+2013+2012+2011+2010+2009+2008+2007+2006+2005+2004+2003+2002+2001+2000"; } else if (URL.contains(".vod")) { - return "类型+全部=+喜剧+爱情+恐怖+动作+科幻+剧情+战争+警匪+犯罪+动画+奇幻+武侠+冒险+枪战+恐怖+悬疑+惊悚+经典+青春+文艺+微电影+古装+历史+运动+农村+惊悚+伦理+情色+福利+惊悚+儿童+网络电影\n地区+全部=+内地+香港+台湾+美国+英国+法国+日本+韩国+德国+泰国+印度+西班牙+加拿大+其他\n语种+全部=+国语+英语+粤语+闽南语+韩语+日语+法语+德语+其他\n年份+全部=+2021+2020+2019+2018+2017+2016+2015+2014+2013+2012+2011+2010+2009+2008+2007+2006+2005+2004+2003+2002+2001+2000\n排序+全部=+最新=time+最热=hits+评分=score"; + return "类型+全部=+喜剧+爱情+恐怖+动作+科幻+剧情+战争+警匪+犯罪+动画+奇幻+武侠+冒险+枪战+恐怖+悬疑+惊悚+经典+青春+文艺+微电影+古装+历史+运动+农村+惊悚+伦理+情色+福利+三级+惊悚+儿童+网络电影\n地区+全部=+内地+香港+台湾+美国+英国+法国+日本+韩国+德国+泰国+印度+西班牙+加拿大+其他\n语种+全部=+国语+英语+粤语+闽南语+韩语+日语+法语+德语+其他\n年份+全部=+2021+2020+2019+2018+2017+2016+2015+2014+2013+2012+2011+2010+2009+2008+2007+2006+2005+2004+2003+2002+2001+2000\n排序+全部=+最新=time+最热=hits+评分=score"; } else { - return "分类+电影=movie+连续剧=tvplay+综艺=tvshow+动漫=comic+4K=movie_4k+体育=tiyu\n类型+全部=+喜剧+爱情+恐怖+动作+科幻+剧情+战争+警匪+犯罪+动画+奇幻+武侠+冒险+枪战+恐怖+悬疑+惊悚+经典+青春+文艺+微电影+古装+历史+运动+农村+惊悚+惊悚+伦理+情色+福利+儿童+网络电影\n地区+全部=+大陆+香港+台湾+美国+英国+法国+日本+韩国+德国+泰国+印度+西班牙+加拿大+其他\n年份+全部=+2021+2020+2019+2018+2017+2016+2015+2014+2013+2012+2011+2010+2009+2008+2007+2006+2005+2004+2003+2002+2001+2000"; + return "分类+全部=+电影=movie+连续剧=tvplay+综艺=tvshow+动漫=comic+4K=movie_4k+体育=tiyu\n类型+全部=+喜剧+爱情+恐怖+动作+科幻+剧情+战争+警匪+犯罪+动画+奇幻+武侠+冒险+枪战+恐怖+悬疑+惊悚+经典+青春+文艺+微电影+古装+历史+运动+农村+惊悚+惊悚+伦理+情色+福利+三级+儿童+网络电影\n地区+全部=+大陆+香港+台湾+美国+英国+法国+日本+韩国+德国+泰国+印度+西班牙+加拿大+其他\n年份+全部=+2021+2020+2019+2018+2017+2016+2015+2014+2013+2012+2011+2010+2009+2008+2007+2006+2005+2004+2003+2002+2001+2000"; } } @@ -865,11 +869,16 @@ private String getPlayerUrl(String URL, String parseUrl, String playUrl) { if (playUrl.indexOf(".m3u8") > 15 || playUrl.indexOf(".mp4") > 15 || playUrl.contains("/obj/tos")) { if (playUrl.contains("url=")) { return "https://www.baidu.com/s?wd=" + playUrl.split("url=")[1]; - } else if (parseUrl.contains("vip.byteamone.cn") && playUrl.contains("xfy")) { - return "https://vip.xfyun.cc/home/api?type=ys&uid=207276&key=cgmqruvwCGPQRTUVW5&url=" + playUrl.split("url=")[1]; } else { return "https://www.baidu.com/s?wd=" + playUrl; } + } else if (playUrl.contains("xfy")) { + if (playUrl.contains("url=")) { + String spUrl = playUrl.split("url=")[1]; + return "https://www.baidu.com/s?wd=https://json.hfyrw.com/mao.go?url=" + spUrl; + } else { + return "https://www.baidu.com/s?wd=https://json.hfyrw.com/mao.go?url=" + playUrl; + } } else { return "https://www.baidu.com/s?wd=" + parseUrl + playUrl; } @@ -885,8 +894,8 @@ private String getPlayerUrl(String URL, String parseUrl, String playUrl) { return "https://www.baidu.com/s?wd=https://jx.parwix.com:4433/player/?url=" + spUrl; } else if (URL.contains("fit:8") || URL.contains("diliktv.xyz") || URL.contains("ppzhu.vip") || URL.contains("api.8d8q.com") || URL.contains("haokanju1.cc") || URL.contains("cztv")) { return "https://www.baidu.com/s?wd=" + playUrl + "&app=10000&account=272775028&password=qq272775028"; - } else if (URL.contains(".life") || URL.contains("lktv") || URL.contains("0818tv") || URL.contains("ruoxinew")) { - return "https://www.baidu.com/s?wd=https://vip.parwix.com:4433/player/?url=" + playUrl.split("url=")[1]; + } else if (URL.contains("lxyyy") || URL.contains("j.zjj.life") || URL.contains("lktv") || URL.contains("0818tv") || URL.contains("ruoxinew")) { + return "https://www.baidu.com/s?wd=https://play.tkys.tv/?url=" + playUrl.split("url=")[1]; } else { return "https://www.baidu.com/s?wd=" + playUrl; } @@ -934,16 +943,21 @@ private void getFinalVideo(String uu, JSONObject result) throws JSONException { result.put("parse", 0); result.put("playUrl", ""); result.put("url", playurl); - result.put("header", "{\"User-Agent\":\" Mozilla/5.0\",\"Referer\":\" https://qian.wkfile.com/\"}"); + result.put("header", "{\"User-Agent\":\" Lavf/58.12.100\",\"Referer\":\" wkfile.com\"}"); } else if (!playurl.contains("=") && playurl.indexOf(".m3u8") > 15 || playurl.indexOf(".mp4") > 15 || playurl.contains("/obj/tos")) { if (playurl.contains("hsl.ysgc.xyz")) { - SpiderReqResult resp = SpiderReq.get(new SpiderUrl("https://play.dushe520.com/m3u8.php?url=" + playurl, null)); + SpiderReqResult resp = SpiderReq.get(new SpiderUrl("https://jx.ysgc.xyz/?url=" + playurl, null)); JSONObject obj = new JSONObject(resp.content); String ppurl = obj.getString("url"); result.put("parse", 0); result.put("playUrl", ""); result.put("url", ppurl); result.put("header", "{\"Referer\":\" https://ysgc.cc\"}"); + } else if (playurl.contains("1.ruifenglb.com")) { + result.put("parse", 0); + result.put("playUrl", ""); + result.put("url", playurl); + result.put("header", "{\"Referer\":\" https://1.ruifenglb.com\"}"); } else { Matcher matcher = Pattern.compile(".*(http.*)").matcher(playurl); if (matcher.find()) { @@ -958,7 +972,7 @@ private void getFinalVideo(String uu, JSONObject result) throws JSONException { } } else if (playurl.contains("=")) { HashMap headers = new HashMap(); - headers.put("User-Agent", "Mozilla/5.0"); + headers.put("User-Agent", "Mozilla/5.0 Android"); SpiderReqResult resp = SpiderReq.get(SpiderOKClient.noRedirectClient(), new SpiderUrl(playurl, headers)); String redLoc = SpiderOKClient.getRedirectLocation(resp.headers); if (redLoc != null) { diff --git a/app/src/main/java/com/github/catvod/spider/Ysgc.java b/app/src/main/java/com/github/catvod/spider/Ysgc.java index 2614dd5ba..631411b09 100644 --- a/app/src/main/java/com/github/catvod/spider/Ysgc.java +++ b/app/src/main/java/com/github/catvod/spider/Ysgc.java @@ -8,6 +8,7 @@ import com.github.catvod.crawler.SpiderReq; import com.github.catvod.crawler.SpiderReqResult; import com.github.catvod.crawler.SpiderUrl; +import com.github.catvod.utils.Misc; import org.json.JSONArray; import org.json.JSONObject; @@ -31,8 +32,8 @@ */ public class Ysgc extends Spider { - private static final String siteUrl = "http://www.ysgc.cc"; - private static final String siteHost = "www.ysgc.cc"; + private static final String siteUrl = "https://www.ik4.cc"; + private static final String siteHost = "www.ik4.cc"; protected JSONObject playerConfig = new JSONObject(); @@ -43,24 +44,22 @@ public void init(Context context) { protected HashMap getHeaders(String url) { HashMap headers = new HashMap<>(); - headers.put("platform_version", "LMY47I"); - headers.put("user-agent", "Dart/2.12 (dart:io)"); - headers.put("version", "1.6.4"); + headers.put("user-agent", "Dart/2.14 (dart:io)"); + headers.put("version", "1.9.8"); headers.put("copyright", "xiaogui"); headers.put("host", siteHost); headers.put("platform", "android"); - headers.put("client_name", "6L+95Ymn6L6+5Lq6"); return headers; } @Override public String homeContent(boolean filter) { try { - String url = siteUrl + "/api.php/app/nav?token="; + String url = siteUrl + "/xgapp.php/v1/nav?token="; SpiderUrl su = new SpiderUrl(url, getHeaders(url)); SpiderReqResult srr = SpiderReq.get(su); JSONObject jsonObject = new JSONObject(srr.content); - JSONArray jsonArray = jsonObject.getJSONArray("list"); + JSONArray jsonArray = jsonObject.getJSONArray("data"); JSONArray classes = new JSONArray(); JSONObject filterConfig = new JSONObject(); for (int i = 0; i < jsonArray.length(); i++) { @@ -144,11 +143,11 @@ public String homeContent(boolean filter) { @Override public String homeVideoContent() { try { - String url = siteUrl + "/api.php/app/index_video?token="; + String url = siteUrl + "/xgapp.php/v1/index_video?token="; SpiderUrl su = new SpiderUrl(url, getHeaders(url)); SpiderReqResult srr = SpiderReq.get(su); JSONObject jsonObject = new JSONObject(srr.content); - JSONArray jsonArray = jsonObject.getJSONArray("list"); + JSONArray jsonArray = jsonObject.getJSONArray("data"); JSONArray videos = new JSONArray(); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jObj = jsonArray.getJSONObject(i); @@ -175,7 +174,7 @@ public String homeVideoContent() { @Override public String categoryContent(String tid, String pg, boolean filter, HashMap extend) { try { - String url = siteUrl + "/api.php/app/video?tid=" + tid + "&pg=" + pg + "&token="; + String url = siteUrl + "/xgapp.php/v1/video?tid=" + tid + "&pg=" + pg + "&token="; Set keys = extend.keySet(); for (String key : keys) { url += "&" + key + "=" + URLEncoder.encode(extend.get(key)); @@ -183,7 +182,7 @@ public String categoryContent(String tid, String pg, boolean filter, HashMap ids) { try { - String url = siteUrl + "/api.php/app/video_detail?id=" + ids.get(0) + "&token="; + String url = siteUrl + "/xgapp.php/v1/video_detail?id=" + ids.get(0) + "&token="; SpiderUrl su = new SpiderUrl(url, getHeaders(url)); SpiderReqResult srr = SpiderReq.get(su); JSONObject jsonObject = new JSONObject(srr.content); JSONObject dataObject = jsonObject.getJSONObject("data"); + if (dataObject.has("vod_info")) { + try { + dataObject = dataObject.getJSONObject("vod_info"); + } catch (Exception e) { + + } + } JSONObject vodList = new JSONObject(); vodList.put("vod_id", dataObject.getString("vod_id")); vodList.put("vod_name", dataObject.getString("vod_name")); @@ -232,9 +238,11 @@ public String detailContent(List ids) { vodList.put("vod_content", dataObject.getString("vod_content")); JSONArray playerList = dataObject.getJSONArray("vod_url_with_player"); List playFlags = new ArrayList<>(); + HashMap playUrls = new HashMap<>(); for (int i = 0; i < playerList.length(); i++) { JSONObject playerListObj = playerList.getJSONObject(i); String from = playerListObj.getString("code"); + playUrls.put(from, playerListObj.getString("url")); playerListObj.remove("url"); playerConfig.put(from, playerListObj); playFlags.add(from); @@ -257,8 +265,16 @@ public int compare(String o1, String o2) { String[] vod_play_url_list = dataObject.getString("vod_play_url").split("\\$\\$\\$"); for (int i = 0; i < vod_play_from_list.length; i++) { + String from = vod_play_from_list[i]; + if (i >= vod_play_url_list.length || vod_play_url_list[i].trim().length() == 0) { + if (playUrls.containsKey(from) && playUrls.get(from).trim().length() > 0) { + vod_play.put(vod_play_from_list[i], playUrls.get(from)); + } + continue; + } vod_play.put(vod_play_from_list[i], vod_play_url_list[i]); } + String vod_play_from = TextUtils.join("$$$", vod_play.keySet()); String vod_play_url = TextUtils.join("$$$", vod_play.values()); vodList.put("vod_play_from", vod_play_from); @@ -309,22 +325,9 @@ public String playerContent(String flag, String id, List vipFlags) { } return result.toString(); } else if (id.contains("duoduozy.com")) { - String uuu = "https://player.duoduozy.com/ddplay/?url=" + id; - HashMap headers = new HashMap(); - headers.put("referer", "https://www.duoduozy.com/"); - SpiderReqResult srr = SpiderReq.get(new SpiderUrl(uuu, headers)); - Matcher matcher = Pattern.compile("var urls.+?\"(.+?)\"").matcher(srr.content); - if (matcher.find()) { - result.put("parse", 0); - result.put("playUrl", ""); - result.put("url", matcher.group(1)); - } else { - result.put("parse", 1); - result.put("playUrl", ""); - result.put("url", id); - result.put("header", "{\"Referer\":\"https://www.duoduozy.com/\"}"); - } - return result.toString(); + String uuu = "https://www.6080kan.cc/app.php?url=" + id; + SpiderReqResult srr = SpiderReq.get(new SpiderUrl(uuu, null)); + return Misc.jsonParse(id, srr.content).toString(); } if (vipFlags.contains(flag)) { try { @@ -378,11 +381,11 @@ public String searchContent(String key, boolean quick) { if (quick) return ""; try { - String url = siteUrl + "/api.php/app/search?text=" + URLEncoder.encode(key) + "&pg=1"; + String url = siteUrl + "/xgapp.php/v1/search?text=" + URLEncoder.encode(key) + "&pg=1"; SpiderUrl su = new SpiderUrl(url, getHeaders(url)); SpiderReqResult srr = SpiderReq.get(su); JSONObject dataObject = new JSONObject(srr.content); - JSONArray jsonArray = dataObject.getJSONArray("list"); + JSONArray jsonArray = dataObject.getJSONArray("data"); JSONArray videos = new JSONArray(); for (int i = 0; i < jsonArray.length(); i++) { JSONObject vObj = jsonArray.getJSONObject(i); 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 93bba1799..811f82f7c 100644 --- a/app/src/main/java/com/github/catvod/utils/Misc.java +++ b/app/src/main/java/com/github/catvod/utils/Misc.java @@ -4,6 +4,9 @@ import com.github.catvod.crawler.SpiderDebug; +import org.json.JSONException; +import org.json.JSONObject; + import java.util.regex.Pattern; public class Misc { @@ -53,4 +56,56 @@ public static String fixUrl(String base, String src) { } return src; } + + public static boolean isBlackVodUrl(String input, String url) { + if (url.contains("973973.xyz") || url.contains(".fit:")) + return true; + return false; + } + + public static final String UaWinChrome = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36"; + + public static JSONObject fixJsonVodHeader(JSONObject headers, String input, String url) throws JSONException { + if (headers == null) + headers = new JSONObject(); + if (input.contains("www.mgtv.com")) { + headers.put("Referer", " "); + headers.put("User-Agent", " Mozilla/5.0"); + } else if (url.contains("titan.mgtv")) { + headers.put("Referer", " "); + headers.put("User-Agent", " Mozilla/5.0"); + } else if (input.contains("bilibili")) { + headers.put("Referer", " https://www.bilibili.com/"); + headers.put("User-Agent", " " + Misc.UaWinChrome); + } + return headers; + } + + public static JSONObject jsonParse(String input, String json) throws JSONException { + JSONObject jsonPlayData = new JSONObject(json); + String url = jsonPlayData.getString("url"); + if (url.startsWith("//")) { + url = "https:" + url; + } + if (!url.startsWith("http")) { + return null; + } + if (Misc.isBlackVodUrl(input, url)) { + return null; + } + JSONObject headers = new JSONObject(); + String ua = jsonPlayData.optString("user-agent", ""); + if (ua.trim().length() > 0) { + headers.put("User-Agent", " " + ua); + } + String referer = jsonPlayData.optString("referer", ""); + if (referer.trim().length() > 0) { + headers.put("Referer", " " + referer); + } + headers = Misc.fixJsonVodHeader(headers, input, url); + JSONObject taskResult = new JSONObject(); + taskResult.put("header", headers); + taskResult.put("url", url); + return taskResult; + } }