diff --git a/app/src/main/java/com/github/catvod/api/YunDrive.java b/app/src/main/java/com/github/catvod/api/YunDrive.java index 9865fe20..6e01bedb 100644 --- a/app/src/main/java/com/github/catvod/api/YunDrive.java +++ b/app/src/main/java/com/github/catvod/api/YunDrive.java @@ -1,9 +1,13 @@ package com.github.catvod.api; +import androidx.annotation.NonNull; + +import com.github.catvod.bean.Result; import com.github.catvod.crawler.SpiderDebug; import com.github.catvod.net.OkHttp; import com.github.catvod.net.OkResult; import com.github.catvod.utils.Json; +import com.github.catvod.utils.ProxyVideo; import com.github.catvod.utils.Util; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -216,10 +220,8 @@ public class YunDrive { } public String get4kVideoInfo(String fid, String linkID) throws Exception { - String auth = YunTokenHandler.get().getToken(); - SpiderDebug.log("auth:" + auth); - String phone = StringUtils.split(Util.base64Decode(auth), ":")[1]; - SpiderDebug.log("phone:" + phone); + String auth = getAuth(); + String phone = getPhone(); // 构建 JSON 请求体 Map requestBody = new HashMap<>(); @@ -255,12 +257,7 @@ public class YunDrive { // 构建请求 - Map header = new HashMap<>(); - - header.put("X-Deviceinfo", "||3|12.27.0|safari|13.1.2|1||macos 10.15.6|1324X381|zh-cn|||"); - header.put("hcy-cool-flag", "1"); - header.put("Authorization", "Basic " + auth); - header.put("Content-Type", "application/json"); + Map header = getHeader(); OkResult okResult = OkHttp.post(baseUrl + "dlFromOutLinkV3", encrypt(Json.toJson(requestBody)), header); @@ -274,4 +271,43 @@ public class YunDrive { return null; } + private static String getPhone() { + String phone = StringUtils.split(Util.base64Decode(getAuth()), ":")[1]; + SpiderDebug.log("phone:" + phone); + return phone; + } + + private static String getAuth() { + String auth = YunTokenHandler.get().getToken(); + SpiderDebug.log("auth:" + auth); + return auth; + } + + @NonNull + private static Map getHeader() { + Map header = new HashMap<>(); + + header.put("X-Deviceinfo", "||3|12.27.0|safari|13.1.2|1||macos 10.15.6|1324X381|zh-cn|||"); + header.put("hcy-cool-flag", "1"); + header.put("Authorization", "Basic " + getAuth()); + header.put("Content-Type", "application/json"); + return header; + } + + + public String playerContent(String[] split, String flag) throws Exception { + String playUrl = ""; + if (flag.contains("原画")) { + String contentId = split[0]; + String linkID = split[1]; + playUrl = YunDrive.get().get4kVideoInfo(contentId, linkID); + + } else { + String contentId = split[0]; + String linkID = split[1]; + playUrl = YunDrive.get().fetchPlayUrl(contentId, linkID); + } + return Result.get().url(ProxyVideo.buildCommonProxyUrl(playUrl, getHeader())).octet().header(getHeader()).string(); + } + } diff --git a/app/src/main/java/com/github/catvod/spider/YiDongYun.java b/app/src/main/java/com/github/catvod/spider/YiDongYun.java index 286ce7d0..3480a456 100644 --- a/app/src/main/java/com/github/catvod/spider/YiDongYun.java +++ b/app/src/main/java/com/github/catvod/spider/YiDongYun.java @@ -80,19 +80,8 @@ public class YiDongYun extends Spider { @Override public String playerContent(String flag, String id, List vipFlags) throws Exception { - String playContent = ""; - if (flag.contains("原画")) { - String contentId = id.split("\\+\\+")[0]; - String linkID = id.split("\\+\\+")[1]; - playContent = YunDrive.get().get4kVideoInfo(contentId, linkID); - } else { - String contentId = id.split("\\+\\+")[0]; - String linkID = id.split("\\+\\+")[1]; - playContent = YunDrive.get().fetchPlayUrl(contentId, linkID); - } - SpiderDebug.log("playContent:" + playContent); - return Result.get().url(playContent).octet().string(); + return YunDrive.get().playerContent(id.split("\\+\\+"), flag); } /** diff --git a/jar/custom_spider.jar b/jar/custom_spider.jar index 81699438..ee9b1ad0 100644 Binary files a/jar/custom_spider.jar and b/jar/custom_spider.jar differ diff --git a/jar/custom_spider.jar.md5 b/jar/custom_spider.jar.md5 index fcdfec9f..946d9d47 100644 --- a/jar/custom_spider.jar.md5 +++ b/jar/custom_spider.jar.md5 @@ -1 +1 @@ -9e16172dad5f5417f9948084af40df03 +fb6d4b85d2c157e144fe5d1d5a5d248d diff --git a/json/index.json b/json/index.json index aabedc17..8e32ca4e 100644 --- a/json/index.json +++ b/json/index.json @@ -1,5 +1,5 @@ { - "spider": "https://gh-proxy.com/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThread/jar/custom_spider.jar;md5;9e16172dad5f5417f9948084af40df03", + "spider": "https://andoridspidermt.netlify.app/jar/custom_spider.jar;md5;fb6d4b85d2c157e144fe5d1d5a5d248d", "lives": [ { "name": "电视直播",