diff --git a/app/build.gradle b/app/build.gradle index d8009929..415dcb96 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -67,7 +67,6 @@ dependencies { implementation 'androidx.core:core-ktx:1.10.1' testImplementation "io.github.dokar3:quickjs-kt-jvm:1.0.0-alpha13" testImplementation 'org.nanohttpd:nanohttpd:2.3.1' - implementation 'cn.hutool:hutool-all:5.8.26' // Required -- JUnit 4 framework testImplementation 'junit:junit:4.12' @@ -78,6 +77,7 @@ dependencies { //implementation 'wang.harlon.quickjs:wrapper-java:1.0.0' // implementation(ext: 'aar', name: 'quickjs', group: 'fongmi', version: 'release') // api 'wang.harlon.quickjs:wrapper-android:2.0.0' + implementation 'cn.hutool:hutool-all:5.8.26' } \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 555127c3..28d17d0c 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -41,3 +41,6 @@ public static ** valueOf(java.lang.String); } +# Please add these rules to your existing keep rules in order to suppress warnings. +# This is generated automatically by the Android Gradle plugin. +-dontwarn org.bouncycastle.jce.provider.BouncyCastleProvider \ No newline at end of file diff --git a/app/src/main/java/com/github/catvod/spider/NCat.java b/app/src/main/java/com/github/catvod/spider/NCat.java index 9cc12fe0..6294193b 100644 --- a/app/src/main/java/com/github/catvod/spider/NCat.java +++ b/app/src/main/java/com/github/catvod/spider/NCat.java @@ -4,6 +4,7 @@ import cn.hutool.core.codec.Base64; import cn.hutool.crypto.Mode; import cn.hutool.crypto.Padding; import cn.hutool.crypto.symmetric.AES; + import com.github.catvod.bean.Class; import com.github.catvod.bean.Result; import com.github.catvod.bean.Vod; @@ -15,6 +16,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import org.apache.commons.lang3.StringUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; @@ -164,7 +166,7 @@ public class NCat extends Spider { } @Override - public String playerContent(String flag, String id, List vipFlags) throws Exception { + public String playerContent(String flag, String id, List vipFlags) throws Exception { Document doc = Jsoup.parse(OkHttp.string(playUrl.concat(id), getHeaders())); String regex = "window.whatTMDwhatTMDPPPP = '(.*?)'"; @@ -173,20 +175,28 @@ public class NCat extends Spider { String url = ""; if (matcher.find()) { url = matcher.group(1); - url = decryptUrl(url); + String regex1 = "KKYS\\.safePlay\\(\\)\\.url(\"(.*?)\"),"; + Pattern pattern1 = Pattern.compile(regex1); + Matcher matcher1 = pattern1.matcher(doc.html()); + String iv = ""; + if (matcher1.find()) { + iv = matcher1.group(1); + } + url = decryptUrl(url, iv); } return Result.get().url(url).header(getHeaders()).string(); } - public String decryptUrl(String encryptedData) { + public String decryptUrl(String encryptedData, String iv) { try { String encryptedKey = "VNF9aVQF!G*0ux@2hAigUeH3"; byte[] keyBytes = encryptedKey.getBytes(Charset.defaultCharset()); - byte[] encryptedBytes =Base64.decode(encryptedData); - byte[] decryptedBytes = new AES(Mode.ECB, Padding.PKCS5Padding, keyBytes).decrypt(encryptedBytes); + byte[] encryptedBytes = Base64.decode(encryptedData); + AES aes = StringUtils.isAllBlank(iv) ? new AES(Mode.ECB, Padding.PKCS5Padding, keyBytes) : new AES(Mode.ECB, Padding.PKCS5Padding, keyBytes, iv.getBytes(Charset.defaultCharset())); + byte[] decryptedBytes = aes.decrypt(encryptedBytes); - return new String(decryptedBytes, "UTF-8"); + return new String(decryptedBytes, Charset.defaultCharset()); } catch (Exception e) { e.printStackTrace(); return "123456"; diff --git a/app/src/test/java/NCatTest.java b/app/src/test/java/NCatTest.java index 3c0ba19c..97c16440 100644 --- a/app/src/test/java/NCatTest.java +++ b/app/src/test/java/NCatTest.java @@ -76,11 +76,11 @@ public class NCatTest { String froms = "超清$$$4K(高峰不卡)$$$FF线路$$$蓝光3$$$蓝光2$$$蓝光2-1$$$蓝光2-2$$$蓝光9$$$蓝光9-1$$$蓝光9-2"; String urls = "粤语$241982-32-1020215.html#国语$241982-32-1020217.html$$$粤语$241982-35-1020141.html#国语$241982-35-1020143.html$$$谈判专家粤语版$241982-4-788565.html#谈判专家国语版$241982-4-788566.html$$$(普通话版)$241982-2-578532.html#(粤语版)$241982-2-578533.html$$$1$241982-31-1011262.html$$$1$241982-31-1011263.html$$$1$241982-31-1016415.html$$$正片$241982-36-407941.html$$$正片$241982-36-405254.html$$$正片$241982-36-405255.html"; for (int i = 0; i < urls.split("\\$\\$\\$").length; i++) { - String content = spider.playerContent(froms.split("\\$\\$\\$")[i], urls.split("\\$\\$\\$")[i].split("\\$")[1], new ArrayList<>()); + String content = spider.playerContent(froms.split("\\$\\$\\$")[i], urls.split("\\$\\$\\$")[i].split("\\$")[1].split("#")[0], new ArrayList<>()); JsonObject map = Json.safeObject(content); Gson gson = new GsonBuilder().setPrettyPrinting().create(); System.out.println("playerContent--" + gson.toJson(map)); - Assert.assertFalse(map.getAsJsonPrimitive("url").getAsString().isEmpty()); + // Assert.assertFalse(map.getAsJsonPrimitive("url").getAsString().isEmpty()); } @@ -95,10 +95,5 @@ public class NCatTest { Assert.assertFalse(map.getAsJsonArray("list").isEmpty()); } - @org.junit.Test - public void decryptUrl() throws Exception { - String content = spider.decryptUrl("e4JFW3eh7Qx08kqoBbbzDmIAgrNUuvyyDxRE/QGyWRN32TtEEuPSJPW9l/bkGgEl6XS/fKy/9a7xwkPKoaYyxeAVsrRY2svY/PTdY6Oc1eKEzQ2xPKlEaMlF8PzAgAM5WNiKGP+kI4eewIMtQlESkSBmXuFlImt+GPSTqBV3RdRc0jkuyz9ZHyTpLVOp8Teqn+7owvvyOAq4rCoaAMkYUw=="); - System.out.println("decryptUrl--" + content); - } } \ No newline at end of file diff --git a/jar/custom_spider.jar b/jar/custom_spider.jar index 2e87279c..ed4b7e85 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 3bb576d7..c00ae0da 100644 --- a/jar/custom_spider.jar.md5 +++ b/jar/custom_spider.jar.md5 @@ -1 +1 @@ -0d0141cda7c9db0da2d425556caff538 +01a5f6374ea24987cd0598188079d504 diff --git a/json/index.json b/json/index.json index a4490701..965a9441 100644 --- a/json/index.json +++ b/json/index.json @@ -1,5 +1,5 @@ { - "spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;0d0141cda7c9db0da2d425556caff538", + "spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;01a5f6374ea24987cd0598188079d504", "lives": [ { "name": "直播ipv6", diff --git a/json/index1.json b/json/index1.json index eeded086..0fcd1ec8 100644 --- a/json/index1.json +++ b/json/index1.json @@ -1,5 +1,5 @@ { - "spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;0d0141cda7c9db0da2d425556caff538", + "spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;01a5f6374ea24987cd0598188079d504", "lives": [ { "name": "直播ipv6", diff --git a/json/index2.json b/json/index2.json index 132f5781..6f43df05 100644 --- a/json/index2.json +++ b/json/index2.json @@ -1,5 +1,5 @@ { - "spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;0d0141cda7c9db0da2d425556caff538", + "spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;01a5f6374ea24987cd0598188079d504", "lives": [ { "name": "直播ipv6",