diff --git a/app/src/main/java/com/github/catvod/spider/Zxzj.java b/app/src/main/java/com/github/catvod/spider/Zxzj.java index 1476a77c..df29b1dc 100644 --- a/app/src/main/java/com/github/catvod/spider/Zxzj.java +++ b/app/src/main/java/com/github/catvod/spider/Zxzj.java @@ -33,13 +33,13 @@ import java.util.regex.Pattern; public class Zxzj extends Spider { - private final String siteUrl = "https://www.zxzja.com"; + private final String siteUrl = "http://zxzj.shop"; private Map getHeader() { Map header = new HashMap<>(); header.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/100.0.4896.77 Mobile/15E148 Safari/604.1"); header.put("Connection", "keep-alive"); - header.put("Referer", "https://www.zxzj.com/"); + header.put("Referer", "http://zxzj.shop/"); header.put("sec-fetch-dest", "iframe"); header.put("sec-fetch-mode", "navigate"); header.put("sec-fetch-site", "cross-site"); @@ -164,7 +164,15 @@ public class Zxzj extends Spider { } Document document = Jsoup.parse(html); List list = new ArrayList<>(); - getVods(list, document); + for (Element div : document.select(".stui-vodlist__media >li")) { + String id = div.select("a.stui-vodlist__thumb").attr("href"); + String name = div.select(".detail >h3.title > a").text(); + String pic = div.select("a.stui-vodlist__thumb").attr("data-original"); + if (pic.isEmpty()) pic = div.select("img").attr("src"); + String remark = div.select("a.stui-vodlist__thumb > span.pic-text").text(); + + list.add(new Vod(id, name, pic, remark)); + } return Result.string(list); } @@ -177,6 +185,9 @@ public class Zxzj extends Spider { String json = matcher.find() ? matcher.group(1) : ""; org.json.JSONObject player = new JSONObject(json); String realUrl = player.getString("url"); + if(realUrl.indexOf("m3u8")>-1){ + return Result.get().url(realUrl).header(getVideoHeader()).string(); + } String videoContent = OkHttp.string(realUrl, getHeader()); Matcher matcher2 = Pattern.compile("result_v2 =(.*?);").matcher(videoContent); String json2 = matcher2.find() ? matcher2.group(1) : ""; diff --git a/app/src/test/java/ZxzjTest.java b/app/src/test/java/ZxzjTest.java index 33a993af..c657ea6b 100644 --- a/app/src/test/java/ZxzjTest.java +++ b/app/src/test/java/ZxzjTest.java @@ -12,11 +12,13 @@ import org.junit.Assert; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; import java.util.ArrayList; import java.util.Arrays; -@RunWith(MockitoJUnitRunner.class) +@RunWith(RobolectricTestRunner.class) public class ZxzjTest { @Mock private Application mockContext; @@ -25,6 +27,7 @@ public class ZxzjTest { @org.junit.Before public void setUp() throws Exception { + mockContext = RuntimeEnvironment.application; Init.init(mockContext); spider = new Zxzj(); spider.init(mockContext, ""); @@ -43,7 +46,7 @@ public class ZxzjTest { @org.junit.Test public void categoryContent() throws Exception { - String content = spider.categoryContent("/list/1.html", "2", true, null); + String content = spider.categoryContent("/type/1.html", "2", true, null); JsonObject map = Json.safeObject(content); Gson gson = new GsonBuilder().setPrettyPrinting().create(); System.out.println("categoryContent--" + gson.toJson(map)); @@ -53,28 +56,28 @@ public class ZxzjTest { @org.junit.Test public void detailContent() throws Exception { - String content = spider.detailContent(Arrays.asList("/detail/4463.html")); + String content = spider.detailContent(Arrays.asList("/detail/354820.html")); JsonObject map = Json.safeObject(content); Gson gson = new GsonBuilder().setPrettyPrinting().create(); System.out.println("detailContent--" + gson.toJson(map)); Assert.assertFalse(map.getAsJsonArray("list").isEmpty()); } + @org.junit.Test + public void playerContent() throws Exception { + String content = spider.playerContent("HD", "/video/354820-2-1.html", 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()); + } + @org.junit.Test public void searchContent() throws Exception { - String content = spider.playerContent("", "/video/4463-1-1.html", new ArrayList<>()); + String content = spider.searchContent("红", false); JsonObject map = Json.safeObject(content); Gson gson = new GsonBuilder().setPrettyPrinting().create(); System.out.println("searchContent--" + gson.toJson(map)); Assert.assertFalse(map.getAsJsonArray("list").isEmpty()); } - - @org.junit.Test - public void playerContent() throws Exception { - String content = spider.searchContent("我的人间烟火", false); - JsonObject map = Json.safeObject(content); - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - System.out.println("playerContent--" + gson.toJson(map)); - Assert.assertFalse(map.getAsJsonArray("list").isEmpty()); - } } \ No newline at end of file diff --git a/jar/custom_spider.jar b/jar/custom_spider.jar index 62caee0d..c0707a5d 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 9ce8e50c..2612e50e 100644 --- a/jar/custom_spider.jar.md5 +++ b/jar/custom_spider.jar.md5 @@ -1 +1 @@ -1823faf92e43593a4caa80d664204b94 +ee482f7aaf35e8b539e99292d0bad07f diff --git a/json/index.json b/json/index.json index ffb4edb5..1bced7b0 100644 --- a/json/index.json +++ b/json/index.json @@ -1,5 +1,5 @@ { - "spider": "https://gh.idayer.com/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/mine/jar/custom_spider.jar;md5;1823faf92e43593a4caa80d664204b94", + "spider": "https://gh.idayer.com/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/mine/jar/custom_spider.jar;md5;ee482f7aaf35e8b539e99292d0bad07f", "lives": [ { "name": "直播ipv6", @@ -44,7 +44,14 @@ "changeable": 1, "ext": {} }, - + { + "key": "NCat", + "name": "\uD83D\uDE3C 网飞猫 | 影视", + "type": 3, + "api": "csp_NCat", + "searchable": 1, + "filterable": 1 + }, { "key": "Zxzj", "name": "在线之家", @@ -55,14 +62,6 @@ "changeable": 0, "ext": {} }, - { - "key": "NCat", - "name": "\uD83D\uDE3C 网飞猫 | 影视", - "type": 3, - "api": "csp_NCat", - "searchable": 1, - "filterable": 1 - }, { "key": "TvDy", "name": "\uD83D\uDE07 电影天堂 | 影视", @@ -119,7 +118,6 @@ "searchable": 1, "filterable": 1 }, - { "key": "Ying", "name": "\uD83C\uDF38 樱花动漫 | 动漫", @@ -162,7 +160,6 @@ "timeout": 30, "ext": "{\"box\": \"TVBox\", \"danmu\": false}" } - ], "parses": [ {