夸克盘扫码 debug

This commit is contained in:
lushunming 2024-09-15 10:42:33 +08:00
parent 4e3ab0ed43
commit 8674a2b138
2 changed files with 35 additions and 5 deletions

View File

@ -1,5 +1,9 @@
package com.github.catvod.spider; package com.github.catvod.spider;
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.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;
@ -17,6 +21,8 @@ import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.ArrayList; import java.util.ArrayList;
@ -158,17 +164,34 @@ 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 = "src: \"(.*?)\","; String regex = "window.whatTMDwhatTMDPPPP = '(.*?)'";
Pattern pattern = Pattern.compile(regex); Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(doc.html()); Matcher matcher = pattern.matcher(doc.html());
String url = ""; String url = "";
if (matcher.find()) { if (matcher.find()) {
url = matcher.group(1); url = matcher.group(1);
url = url.replace("\\/", "/").replace(" ",""); url = decryptUrl(url);
} }
return Result.get().url(url).header(getHeaders()).string(); return Result.get().url(url).header(getHeaders()).string();
} }
public String decryptUrl(String encryptedData) {
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);
return new String(decryptedBytes, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
return "123456";
}
}
} }

View File

@ -73,8 +73,8 @@ public class NCatTest {
@org.junit.Test @org.junit.Test
public void playerContent() throws Exception { public void playerContent() throws Exception {
String froms = "超清$$$4K(高峰不卡)$$$FF线路$$$蓝光8$$$蓝光3$$$蓝光2$$$蓝光2-1$$$蓝光2-2$$$蓝光9$$$蓝光9-1"; 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-34-345909.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"; 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], new ArrayList<>());
JsonObject map = Json.safeObject(content); JsonObject map = Json.safeObject(content);
@ -94,4 +94,11 @@ public class NCatTest {
System.out.println("searchContent--" + gson.toJson(map)); System.out.println("searchContent--" + gson.toJson(map));
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);
}
} }