ncat修复

This commit is contained in:
lushunming 2024-07-29 11:17:40 +08:00
parent e9c23f28ba
commit 1095ba8e73
5 changed files with 16 additions and 10 deletions

View File

@ -160,14 +160,14 @@ 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: \"(.*?)m3u8\","; String regex = "src: \"(.*?)\",";
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("\\/", "/") + "m3u8"; url = url.replace("\\/", "/").replace(" ","");
} }
return Result.get().url(url).header(getHeaders()).string(); return Result.get().url(url).header(getHeaders()).string();
} }

View File

@ -64,7 +64,7 @@ public class NCatTest {
@org.junit.Test @org.junit.Test
public void detailContent() throws Exception { public void detailContent() throws Exception {
String content = spider.detailContent(Arrays.asList("237526.html")); String content = spider.detailContent(Arrays.asList("241982.html"));
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("detailContent--" + gson.toJson(map)); System.out.println("detailContent--" + gson.toJson(map));
@ -73,13 +73,19 @@ public class NCatTest {
@org.junit.Test @org.junit.Test
public void playerContent() throws Exception { public void playerContent() throws Exception {
String content = spider.playerContent("", "15744-4-99491.html", new ArrayList<>()); String froms = "超清$$$4K(高峰不卡)$$$FF线路$$$蓝光8$$$蓝光3$$$蓝光2$$$蓝光2-1$$$蓝光2-2$$$蓝光9$$$蓝光9-1";
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";
for (int i = 0; i < urls.split("\\$\\$\\$").length; i++) {
String content = spider.playerContent(froms.split("\\$\\$\\$")[i], urls.split("\\$\\$\\$")[i].split("\\$")[1], 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());
} }
}
@org.junit.Test @org.junit.Test
public void searchContent() throws Exception { public void searchContent() throws Exception {
String content = spider.searchContent("红海", false); String content = spider.searchContent("红海", false);

Binary file not shown.

View File

@ -1 +1 @@
3495a63cf181e6f690d3f257478e1913 b92fe52d6ac0ed4005b6780dd937cb54

View File

@ -1,5 +1,5 @@
{ {
"spider": "https://gh.idayer.com/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/mine/jar/custom_spider.jar;md5;3495a63cf181e6f690d3f257478e1913", "spider": "https://gh.idayer.com/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/mine/jar/custom_spider.jar;md5;b92fe52d6ac0ed4005b6780dd937cb54",
"lives": [ "lives": [
{ {
"name": "直播ipv6", "name": "直播ipv6",