ncat修复

This commit is contained in:
“lushunming” 2024-09-15 14:32:50 +08:00
parent 8674a2b138
commit 2cdf7cbd19
9 changed files with 26 additions and 18 deletions

View File

@ -67,7 +67,6 @@ dependencies {
implementation 'androidx.core:core-ktx:1.10.1' implementation 'androidx.core:core-ktx:1.10.1'
testImplementation "io.github.dokar3:quickjs-kt-jvm:1.0.0-alpha13" testImplementation "io.github.dokar3:quickjs-kt-jvm:1.0.0-alpha13"
testImplementation 'org.nanohttpd:nanohttpd:2.3.1' testImplementation 'org.nanohttpd:nanohttpd:2.3.1'
implementation 'cn.hutool:hutool-all:5.8.26'
// Required -- JUnit 4 framework // Required -- JUnit 4 framework
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
@ -78,6 +77,7 @@ dependencies {
//implementation 'wang.harlon.quickjs:wrapper-java:1.0.0' //implementation 'wang.harlon.quickjs:wrapper-java:1.0.0'
// implementation(ext: 'aar', name: 'quickjs', group: 'fongmi', version: 'release') // implementation(ext: 'aar', name: 'quickjs', group: 'fongmi', version: 'release')
// api 'wang.harlon.quickjs:wrapper-android:2.0.0' // api 'wang.harlon.quickjs:wrapper-android:2.0.0'
implementation 'cn.hutool:hutool-all:5.8.26'
} }

View File

@ -41,3 +41,6 @@
public static ** valueOf(java.lang.String); 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

View File

@ -4,6 +4,7 @@ import cn.hutool.core.codec.Base64;
import cn.hutool.crypto.Mode; import cn.hutool.crypto.Mode;
import cn.hutool.crypto.Padding; import cn.hutool.crypto.Padding;
import cn.hutool.crypto.symmetric.AES; import cn.hutool.crypto.symmetric.AES;
import com.github.catvod.bean.Class; import com.github.catvod.bean.Class;
import com.github.catvod.bean.Result; import com.github.catvod.bean.Result;
import com.github.catvod.bean.Vod; import com.github.catvod.bean.Vod;
@ -15,6 +16,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
@ -164,7 +166,7 @@ public class NCat extends Spider {
} }
@Override @Override
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception { public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
Document doc = Jsoup.parse(OkHttp.string(playUrl.concat(id), getHeaders())); Document doc = Jsoup.parse(OkHttp.string(playUrl.concat(id), getHeaders()));
String regex = "window.whatTMDwhatTMDPPPP = '(.*?)'"; String regex = "window.whatTMDwhatTMDPPPP = '(.*?)'";
@ -173,20 +175,28 @@ public class NCat extends Spider {
String url = ""; String url = "";
if (matcher.find()) { if (matcher.find()) {
url = matcher.group(1); 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(); return Result.get().url(url).header(getHeaders()).string();
} }
public String decryptUrl(String encryptedData) { public String decryptUrl(String encryptedData, String iv) {
try { try {
String encryptedKey = "VNF9aVQF!G*0ux@2hAigUeH3"; String encryptedKey = "VNF9aVQF!G*0ux@2hAigUeH3";
byte[] keyBytes = encryptedKey.getBytes(Charset.defaultCharset()); byte[] keyBytes = encryptedKey.getBytes(Charset.defaultCharset());
byte[] encryptedBytes =Base64.decode(encryptedData); byte[] encryptedBytes = Base64.decode(encryptedData);
byte[] decryptedBytes = new AES(Mode.ECB, Padding.PKCS5Padding, keyBytes).decrypt(encryptedBytes); 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return "123456"; return "123456";

View File

@ -76,11 +76,11 @@ public class NCatTest {
String froms = "超清$$$4K(高峰不卡)$$$FF线路$$$蓝光3$$$蓝光2$$$蓝光2-1$$$蓝光2-2$$$蓝光9$$$蓝光9-1$$$蓝光9-2"; 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"; 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++) { 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); JsonObject map = Json.safeObject(content);
Gson gson = new GsonBuilder().setPrettyPrinting().create(); Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println("playerContent--" + gson.toJson(map)); 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()); 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);
}
} }

Binary file not shown.

View File

@ -1 +1 @@
0d0141cda7c9db0da2d425556caff538 01a5f6374ea24987cd0598188079d504

View File

@ -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": [ "lives": [
{ {
"name": "直播ipv6", "name": "直播ipv6",

View File

@ -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": [ "lives": [
{ {
"name": "直播ipv6", "name": "直播ipv6",

View File

@ -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": [ "lives": [
{ {
"name": "直播ipv6", "name": "直播ipv6",