diff --git a/app/src/main/java/com/github/catvod/spider/Ddrk.java b/app/src/main/java/com/github/catvod/spider/Ddrk.java index 889cd14c..e76b94d8 100644 --- a/app/src/main/java/com/github/catvod/spider/Ddrk.java +++ b/app/src/main/java/com/github/catvod/spider/Ddrk.java @@ -34,7 +34,7 @@ import java.util.regex.Pattern; public class Ddrk extends Cloud { - private static String siteUrl = "https://ddys.mov"; + private static String siteUrl = "https://ddys.pro"; protected JSONObject filterConfig; @@ -168,7 +168,7 @@ public class Ddrk extends Cloud { } } } else { - url = tid; + url = tid; } if (pg.equals("1")) { url = url + "/"; @@ -335,9 +335,10 @@ public class Ddrk extends Cloud { if (!clouds.isEmpty()) { for (Element cloud : clouds) { String cloudUrl = cloud.attr("href"); - if (!Util.findByRegex(Util.patternQuark, cloudUrl, 0).isBlank()) { + if (!Util.findByRegex(Util.patternQuark, cloudUrl, 0).isBlank() || !Util.findByRegex(Util.patternUC, cloudUrl, 0).isBlank()) { shareLinks.add(cloudUrl); } + } } diff --git a/app/src/main/java/com/github/catvod/spider/Mogg.java b/app/src/main/java/com/github/catvod/spider/Mogg.java new file mode 100644 index 00000000..b8a6af5b --- /dev/null +++ b/app/src/main/java/com/github/catvod/spider/Mogg.java @@ -0,0 +1,150 @@ +package com.github.catvod.spider; + +import android.content.Context; +import com.github.catvod.bean.Class; +import com.github.catvod.bean.Result; +import com.github.catvod.bean.Vod; +import com.github.catvod.net.OkHttp; +import com.github.catvod.utils.Util; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author zhixc + */ +public class Mogg extends Cloud { + + private final String siteUrl = "https://www.mogg.top"; + private final Pattern regexCategory = Pattern.compile("index.php/vod/type/id/(\\w+).html"); + private final Pattern regexPageTotal = Pattern.compile("\\$\\(\"\\.mac_total\"\\)\\.text\\('(\\d+)'\\);"); + + private Map getHeader() { + Map header = new HashMap<>(); + header.put("User-Agent", Util.CHROME); + return header; + } + + @Override + public void init(Context context, String extend) throws Exception { + // JsonObject ext = Json.safeObject(extend); + super.init(context, extend); + } + + @Override + public String homeContent(boolean filter) { + List classes = new ArrayList<>(); + Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeader())); + Elements elements = doc.select(".nav-link"); + for (Element e : elements) { + Matcher mather = regexCategory.matcher(e.attr("href")); + if (mather.find()) { + classes.add(new Class(mather.group(1), e.text().trim())); + } + } + return Result.string(classes, parseVodListFromDoc(doc)); + } + + @Override + public String categoryContent(String tid, String pg, boolean filter, HashMap extend) { + String[] urlParams = new String[]{tid, "", "", "", "", "", "", "", pg, "", "", ""}; + if (extend != null && extend.size() > 0) { + for (String key : extend.keySet()) { + urlParams[Integer.parseInt(key)] = extend.get(key); + } + } + Document doc = Jsoup.parse(OkHttp.string(String.format("%s/index.php/vod/show/id/%s/page/%s.html", siteUrl, tid, pg), getHeader())); + int page = Integer.parseInt(pg), limit = 72, total = 0; + Matcher matcher = regexPageTotal.matcher(doc.html()); + if (matcher.find()) total = Integer.parseInt(matcher.group(1)); + int count = total <= limit ? 1 : ((int) Math.ceil(total / (double) limit)); + return Result.get().vod(parseVodListFromDoc(doc)).page(page, count, limit, total).string(); + } + + private List parseVodListFromDoc(Document doc) { + List list = new ArrayList<>(); + Elements elements = doc.select(".module-item"); + for (Element e : elements) { + String vodId = e.selectFirst(".video-name a").attr("href"); + String vodPic = e.selectFirst(".module-item-pic > img").attr("data-src"); + String vodName = e.selectFirst(".video-name").text(); + String vodRemarks = e.selectFirst(".module-item-text").text(); + list.add(new Vod(vodId, vodName, vodPic, vodRemarks)); + } + return list; + } + + @Override + public String detailContent(List ids) throws Exception { + String vodId = ids.get(0); + Document doc = Jsoup.parse(OkHttp.string(siteUrl + vodId, getHeader())); + + Vod item = new Vod(); + item.setVodId(vodId); + item.setVodName(doc.selectFirst(".video-info-header > .page-title").text()); + item.setVodPic(doc.selectFirst(".module-item-pic img").attr("data-src")); + item.setVodArea(doc.select(".video-info-header a.tag-link").last().text()); + item.setTypeName(String.join(",", doc.select(".video-info-header div.tag-link a").eachText())); + + List shareLinks = doc.select(".module-row-text").eachAttr("data-clipboard-text"); + for (int i = 0; i < shareLinks.size(); i++) { + shareLinks.set(i, shareLinks.get(i).trim()); + //String detailContent = super.detailContent(List.of(shareLinks.get(i))); + } + item.setVodPlayUrl(super.detailContentVodPlayUrl(shareLinks)); + item.setVodPlayFrom(super.detailContentVodPlayFrom(shareLinks)); + + Elements elements = doc.select(".video-info-item"); + for (Element e : elements) { + String title = e.previousElementSibling().text(); + if (title.contains("导演")) { + item.setVodDirector(String.join(",", e.select("a").eachText())); + } else if (title.contains("主演")) { + item.setVodActor(String.join(",", e.select("a").eachText())); + } else if (title.contains("年代")) { + item.setVodYear(e.selectFirst("a").text().trim()); + } else if (title.contains("备注")) { + item.setVodRemarks(e.text().trim()); + } else if (title.contains("剧情")) { + item.setVodContent(e.selectFirst(".sqjj_a").text().replace("[收起部分]", "").trim()); + } + } + + return Result.string(item); + } + + @Override + public String searchContent(String key, boolean quick) throws Exception { + return searchContent(key, "1"); + } + + @Override + public String searchContent(String key, boolean quick, String pg) throws Exception { + return searchContent(key, pg); + } + + + private String searchContent(String key, String pg) { + String searchURL = siteUrl + String.format("/index.php/vod/search/page/%s/wd/%s.html", pg,URLEncoder.encode(key)); + String html = OkHttp.string(searchURL, getHeader()); + Elements items = Jsoup.parse(html).select(".module-search-item"); + List list = new ArrayList<>(); + for (Element item : items) { + String vodId = item.select(".video-serial").attr("href"); + String name = item.select(".video-serial").attr("title"); + String pic = item.select(".module-item-pic > img").attr("data-src"); + String remark = item.select(".video-tag-icon").text(); + list.add(new Vod(vodId, name, pic, remark)); + } + return Result.string(list); + } +} \ No newline at end of file diff --git a/app/src/test/java/DdrkTest.java b/app/src/test/java/DdrkTest.java index c6393705..5b5a3f7b 100644 --- a/app/src/test/java/DdrkTest.java +++ b/app/src/test/java/DdrkTest.java @@ -1,13 +1,10 @@ import android.app.Application; - import com.github.catvod.spider.Ddrk; -import com.github.catvod.spider.HkTv; import com.github.catvod.spider.Init; import com.github.catvod.utils.Json; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; - import org.junit.Assert; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @@ -29,12 +26,12 @@ public class DdrkTest { Init.init(mockContext); spider = new Ddrk(); - spider.init(mockContext, "{\"site\":\"https://ddys.info/\" ,\"cookie\":\"b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; _UP_A4A_11_=wb9661c6dfb642f88f73d8e0c7edd398; b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; ctoken=wla6p3EUOLyn1FSB8IKp1SEW; grey-id=5583e32b-39df-4bf0-f39f-1adf83f604a2; grey-id.sig=p8ReBIMG2BeZu1sYvsuOAZxYbx-MVrsfKEiCv87MsTM; isQuark=true; isQuark.sig=hUgqObykqFom5Y09bll94T1sS9abT1X-4Df_lzgl8nM; _UP_F7E_8D_=ZkyvVHnrBLp1A1NFJIjWi0PwKLOVbxJPcg0RzQPI6KmBtV6ZMgPh38l93pgubgHDQqhaZ2Sfc0qv%2BRantbfg1mWGAUpRMP4RqXP78Wvu%2FCfvkWWGc5NhCTV71tGOIGgDBR3%2Bu6%2Fjj44KlE5biSNDOWW7Bigcz27lvOTidzNw8s%2FWtKAIxWbnCzZn4%2FJMBUub1SIMcW89g57k4mfPmDlCgpZKzxwl6beSfdtZ4RUWXmZOn5v5NkxVKhU4wR0Pq7NklczEGdRq2nIAcu7v22Uw2o%2FxMY0xBdeC9Korm5%2FNHnxl6K%2Bd6FXSoT9a3XIMQO359auZPiZWzrNlZe%2BqnOahXcx7KAhQIRqSOapSmL4ygJor4r5isJhRuDoXy7vJAVuH%2FRDtEJJ8rZTq0BdC23Bz%2B0MrsdgbK%2BiW; _UP_D_=pc; __wpkreporterwid_=3d3f74a7-99b7-4916-3f78-911fc2eb9d87; tfstk=fIoZNxjnbhKwPOu0TWZ4LsaRqirTcudSSmNbnxD0C5VgClMm8xMyB-GsnSu4tjpOflAOmSD-9PNiGl120XrgkVNb1SrqHbJBN3tSBAEYoQOWVUUg9qZ8n1bGGkD3CqGYINKSBABhjnXgp3_Vywz6gSc0Syj3BWf0mr2DLW24eZfiiovEKWefj1q0swq3E82iNEMinMy7SLrcpA4Fh3z_ZAViCfih3PbtdW5N_DuU77AaTijmYRkL2Wq54ENoy5a7ZXxCbok33XzS7QSZgxD-oyoVsdGotql0p2dVu7umC4nLStbiLmParc4FELHrI-c0u2dPVRrs8zoZWKCnIbNZrlHfUCMUz2z8KyXVSlgSFmUojh58OzeqTzgwaGll4YCYKwctDV5coP2LL79eKHxpNTXHmre1kZU32JPWCR_AkP2LL79eLZQY-WeUNdw1.; __pus=2051c82285199d8be553be41dd5a2100AAQ+mmv35G4FDDZ5x+3Mhe2OMbNgweQ1ODbW8zDt9YuP1LQVqHUuAAz9KWLsPjpNtim0AVGHusN4MCosTmbq/khM; __kp=e6604120-6051-11ef-bfe4-c31b6cdd0766; __kps=AATcZArVgS76EPn0FMaV4HEj; __ktd=sii/iz4ePzEaoVirXul7QQ==; __uid=AATcZArVgS76EPn0FMaV4HEj; __itrace_wid=5829b95d-dac1-48d3-bfd5-f60cd9462786; __puus=7da0b96cb710fa1b376934485f977e05AATp/q8/QupT7IiBR1GWqZhxlIRT677smMvoHlLxQA0Lk6CkP0YJBOTl+p9DZgzlMz6w4hPXPgWsokukk8PW7ZfhFfPmv8tKMgLpCGLW+tk57luhNghmSdTeVPkAF59STtyCPBEtiNzNAd/zZJ6qILJDi5ywEBAAAg+gOyWHoLHNUR+QxeHRuQa8g5WWA95J8jebIlrr8rCvI1vjTbtiYktT\",\"token\":\"26fc6787afff43e78b78992e782502f1\"}"); + spider.init(mockContext, "{\"site\":\"https://ddys.info/\",\"uccookie\":\"_UP_28A_52_=381;_UP_BT_=html5;_UP_F7E_8D_=ZkyvVHnrBLp1A1NFJIjWi0PwKLOVbxJPcg0RzQPI6Kl8ttcYB1X9Nkx0DnGMyJVLgv0M%2FCztZQaIhZhKaI%2F0Fa%2F5Fqe1t%2BDWF1o9sO71vnupc%2Fvxa%2B78J%2B%2BRZYZzk2EJNXvW0Y4gaAMFHf67r%2BOPjtggEPU7aNnlZbsGKBzPbuW85OJ3M3Dyz9a0oAjFZucLNmfj8kwFS5su6ugGZUgH1RU4wR0Pq7NklczEGdRq2nIAcu7v22Uw2o%2FxMY0xBdeC9Korm5%2FNHnxl6K%2Bd6FXSoT9a3XIMQO359auZPiZWzrNlZe%2BqnOahXcx7KAhQIRqSHYYCfquwtPWx%2FgYBqTnLfzoXy7vJAVuH%2FRDtEJJ8rZTq0BdC23Bz%2B0MrsdgbK%2BiW;_UP_6D1_64_=069;_UP_A4A_11_=wb96b12a16f941809f5af993726ba192;_UP_D_=mobilectoken=oxJV13ITm7aa7_rsplIXC-_v;__pus=cef2cc2dfd5d8af70df36bcedf83995cAAT3ZYhqlLos+yCaVQYYC944c4HEQnHz8uEpdQner0OcqISOpBObxl2kck65MGceRIDBd+MLtDxsNqwXvgDIFpYU;__kp=0d340990-9b39-11ef-ae54-4f733858896a;__kps=AAQXoZxLp9Oe2Ps0d/hNBJl4;__ktd=2gPNadz6Z9c+2+FyQyQZUw==;__uid=AAQXoZxLp9Oe2Ps0d/hNBJl4;UDRIVE_TRANSFER_SESS=UpLXXX2HAXJNW0AHgDcMurpazcqTbU-EQWnKG6RKtkdhdqZgHGTM-BSulf_oo1nmMMjo6hFdByLlm-bEiwjByMbIIEehsxhuuV00b96SSaPExn0wMcQ8SmzJa-YwonEE2MEVWCHcRYuW4Z-ljMOgab7qaGtQUpqjkl-p6OTv23BW-4gM6y7DNKvGeaMv_3NX\"," + "\"cookie\":\"b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; _UP_A4A_11_=wb9661c6dfb642f88f73d8e0c7edd398; b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; ctoken=wla6p3EUOLyn1FSB8IKp1SEW; grey-id=5583e32b-39df-4bf0-f39f-1adf83f604a2; grey-id.sig=p8ReBIMG2BeZu1sYvsuOAZxYbx-MVrsfKEiCv87MsTM; isQuark=true; isQuark.sig=hUgqObykqFom5Y09bll94T1sS9abT1X-4Df_lzgl8nM; _UP_F7E_8D_=ZkyvVHnrBLp1A1NFJIjWi0PwKLOVbxJPcg0RzQPI6KmBtV6ZMgPh38l93pgubgHDQqhaZ2Sfc0qv%2BRantbfg1mWGAUpRMP4RqXP78Wvu%2FCfvkWWGc5NhCTV71tGOIGgDBR3%2Bu6%2Fjj44KlE5biSNDOWW7Bigcz27lvOTidzNw8s%2FWtKAIxWbnCzZn4%2FJMBUub1SIMcW89g57k4mfPmDlCgpZKzxwl6beSfdtZ4RUWXmZOn5v5NkxVKhU4wR0Pq7NklczEGdRq2nIAcu7v22Uw2o%2FxMY0xBdeC9Korm5%2FNHnxl6K%2Bd6FXSoT9a3XIMQO359auZPiZWzrNlZe%2BqnOahXcx7KAhQIRqSOapSmL4ygJor4r5isJhRuDoXy7vJAVuH%2FRDtEJJ8rZTq0BdC23Bz%2B0MrsdgbK%2BiW; _UP_D_=pc; __wpkreporterwid_=3d3f74a7-99b7-4916-3f78-911fc2eb9d87; tfstk=fIoZNxjnbhKwPOu0TWZ4LsaRqirTcudSSmNbnxD0C5VgClMm8xMyB-GsnSu4tjpOflAOmSD-9PNiGl120XrgkVNb1SrqHbJBN3tSBAEYoQOWVUUg9qZ8n1bGGkD3CqGYINKSBABhjnXgp3_Vywz6gSc0Syj3BWf0mr2DLW24eZfiiovEKWefj1q0swq3E82iNEMinMy7SLrcpA4Fh3z_ZAViCfih3PbtdW5N_DuU77AaTijmYRkL2Wq54ENoy5a7ZXxCbok33XzS7QSZgxD-oyoVsdGotql0p2dVu7umC4nLStbiLmParc4FELHrI-c0u2dPVRrs8zoZWKCnIbNZrlHfUCMUz2z8KyXVSlgSFmUojh58OzeqTzgwaGll4YCYKwctDV5coP2LL79eKHxpNTXHmre1kZU32JPWCR_AkP2LL79eLZQY-WeUNdw1.; __pus=2051c82285199d8be553be41dd5a2100AAQ+mmv35G4FDDZ5x+3Mhe2OMbNgweQ1ODbW8zDt9YuP1LQVqHUuAAz9KWLsPjpNtim0AVGHusN4MCosTmbq/khM; __kp=e6604120-6051-11ef-bfe4-c31b6cdd0766; __kps=AATcZArVgS76EPn0FMaV4HEj; __ktd=sii/iz4ePzEaoVirXul7QQ==; __uid=AATcZArVgS76EPn0FMaV4HEj; __itrace_wid=5829b95d-dac1-48d3-bfd5-f60cd9462786; __puus=7da0b96cb710fa1b376934485f977e05AATp/q8/QupT7IiBR1GWqZhxlIRT677smMvoHlLxQA0Lk6CkP0YJBOTl+p9DZgzlMz6w4hPXPgWsokukk8PW7ZfhFfPmv8tKMgLpCGLW+tk57luhNghmSdTeVPkAF59STtyCPBEtiNzNAd/zZJ6qILJDi5ywEBAAAg+gOyWHoLHNUR+QxeHRuQa8g5WWA95J8jebIlrr8rCvI1vjTbtiYktT\",\"token\":\"26fc6787afff43e78b78992e782502f1\"}"); + // spider.init(mockContext, ""); } - @org.junit.Test public void homeContent() throws Exception { String content = spider.homeContent(true); @@ -80,7 +77,7 @@ public class DdrkTest { @org.junit.Test public void playerContent() throws Exception { String froms = "第1季"; - String urls = "第01集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E01.mp4#第02集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E02.mp4#第03集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E03.mp4#第04集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E04.mp4#第05集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E05.mp4#第06集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E06.mp4#第07集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E07.mp4#第08集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E08.mp4#第09集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E09.mp4#第10集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E10.mp4#第11集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E11.mp4#第12集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E12.mp4#第13集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E13.mp4#第14集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E14.mp4#第15集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E15.mp4#第16集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E16.mp4#第17集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E17.mp4#第18集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E18.mp4#第19集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E19.mp4#第20集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E20.mp4#第21集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E21.mp4#第22集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E22.mp4#第23集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E23.mp4#第24集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E24.mp4"; + String urls = "第01集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E01.mp4#第02集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E02.mp4#第03集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E03.mp4#第04集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E04.mp4#第05集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E05.mp4#第06集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E06.mp4#第07集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E07.mp4#第08集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E08.mp4#第09集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E09.mp4#第10集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E10.mp4#第11集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E11.mp4#第12集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E12.mp4#第13集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E13.mp4#第14集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E14.mp4#第15集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E15.mp4#第16集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E16.mp4#第17集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E17.mp4#第18集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E18.mp4#第19集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E19.mp4#第20集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E20.mp4#第21集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E21.mp4#第22集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E22.mp4#第23集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E23.mp4#第24集$https://v.ddys.pro/v/Anime/The_Fable/The_Fable_S01E24.mp4"; for (int i = 0; i < urls.split("\\$\\$\\$").length; i++) { for (int i1 = 0; i1 < urls.split("\\$\\$\\$")[i].split("#").length; i1++) { String content = spider.playerContent(froms.split("\\$\\$\\$")[i], urls.split("\\$\\$\\$")[i].split("#")[i1].split("\\$")[1], new ArrayList<>()); diff --git a/app/src/test/java/MoggTest.java b/app/src/test/java/MoggTest.java new file mode 100644 index 00000000..2b695d89 --- /dev/null +++ b/app/src/test/java/MoggTest.java @@ -0,0 +1,100 @@ +import android.app.Application; +import com.github.catvod.server.Server; +import com.github.catvod.spider.Init; +import com.github.catvod.spider.Mogg; +import com.github.catvod.spider.Wogg; +import com.github.catvod.utils.Json; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import org.junit.Assert; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; + +import java.util.ArrayList; +import java.util.Arrays; + +@RunWith(RobolectricTestRunner.class) +public class MoggTest { + + private Application mockContext; + + private Mogg spider; + + @org.junit.Before + public void setUp() throws Exception { + mockContext = RuntimeEnvironment.application; + Init.init(mockContext); + spider = new Mogg(); + Server.get().start(); + // spider.init(mockContext, "{\"cookie\":\"b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; _UP_A4A_11_=wb9661c6dfb642f88f73d8e0c7edd398; b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; ctoken=wla6p3EUOLyn1FSB8IKp1SEW; grey-id=5583e32b-39df-4bf0-f39f-1adf83f604a2; grey-id.sig=p8ReBIMG2BeZu1sYvsuOAZxYbx-MVrsfKEiCv87MsTM; isQuark=true; isQuark.sig=hUgqObykqFom5Y09bll94T1sS9abT1X-4Df_lzgl8nM; _UP_F7E_8D_=ZkyvVHnrBLp1A1NFJIjWi0PwKLOVbxJPcg0RzQPI6KmBtV6ZMgPh38l93pgubgHDQqhaZ2Sfc0qv%2BRantbfg1mWGAUpRMP4RqXP78Wvu%2FCfvkWWGc5NhCTV71tGOIGgDBR3%2Bu6%2Fjj44KlE5biSNDOWW7Bigcz27lvOTidzNw8s%2FWtKAIxWbnCzZn4%2FJMBUub1SIMcW89g57k4mfPmDlCgpZKzxwl6beSfdtZ4RUWXmZOn5v5NkxVKhU4wR0Pq7NklczEGdRq2nIAcu7v22Uw2o%2FxMY0xBdeC9Korm5%2FNHnxl6K%2Bd6FXSoT9a3XIMQO359auZPiZWzrNlZe%2BqnOahXcx7KAhQIRqSOapSmL4ygJor4r5isJhRuDoXy7vJAVuH%2FRDtEJJ8rZTq0BdC23Bz%2B0MrsdgbK%2BiW; _UP_D_=pc; __wpkreporterwid_=3d3f74a7-99b7-4916-3f78-911fc2eb9d87; tfstk=fIoZNxjnbhKwPOu0TWZ4LsaRqirTcudSSmNbnxD0C5VgClMm8xMyB-GsnSu4tjpOflAOmSD-9PNiGl120XrgkVNb1SrqHbJBN3tSBAEYoQOWVUUg9qZ8n1bGGkD3CqGYINKSBABhjnXgp3_Vywz6gSc0Syj3BWf0mr2DLW24eZfiiovEKWefj1q0swq3E82iNEMinMy7SLrcpA4Fh3z_ZAViCfih3PbtdW5N_DuU77AaTijmYRkL2Wq54ENoy5a7ZXxCbok33XzS7QSZgxD-oyoVsdGotql0p2dVu7umC4nLStbiLmParc4FELHrI-c0u2dPVRrs8zoZWKCnIbNZrlHfUCMUz2z8KyXVSlgSFmUojh58OzeqTzgwaGll4YCYKwctDV5coP2LL79eKHxpNTXHmre1kZU32JPWCR_AkP2LL79eLZQY-WeUNdw1.; __pus=2051c82285199d8be553be41dd5a2100AAQ+mmv35G4FDDZ5x+3Mhe2OMbNgweQ1ODbW8zDt9YuP1LQVqHUuAAz9KWLsPjpNtim0AVGHusN4MCosTmbq/khM; __kp=e6604120-6051-11ef-bfe4-c31b6cdd0766; __kps=AATcZArVgS76EPn0FMaV4HEj; __ktd=sii/iz4ePzEaoVirXul7QQ==; __uid=AATcZArVgS76EPn0FMaV4HEj; __itrace_wid=5829b95d-dac1-48d3-bfd5-f60cd9462786; __puus=7da0b96cb710fa1b376934485f977e05AATp/q8/QupT7IiBR1GWqZhxlIRT677smMvoHlLxQA0Lk6CkP0YJBOTl+p9DZgzlMz6w4hPXPgWsokukk8PW7ZfhFfPmv8tKMgLpCGLW+tk57luhNghmSdTeVPkAF59STtyCPBEtiNzNAd/zZJ6qILJDi5ywEBAAAg+gOyWHoLHNUR+QxeHRuQa8g5WWA95J8jebIlrr8rCvI1vjTbtiYktT\",\"token\":\"26fc6787afff43e78b78992e782502f1\"}"); + spider.init(mockContext, "{\"uccookie\":\"_UP_28A_52_=381;_UP_BT_=html5;_UP_F7E_8D_=ZkyvVHnrBLp1A1NFJIjWi0PwKLOVbxJPcg0RzQPI6Kl8ttcYB1X9Nkx0DnGMyJVLgv0M%2FCztZQaIhZhKaI%2F0Fa%2F5Fqe1t%2BDWF1o9sO71vnupc%2Fvxa%2B78J%2B%2BRZYZzk2EJNXvW0Y4gaAMFHf67r%2BOPjtggEPU7aNnlZbsGKBzPbuW85OJ3M3Dyz9a0oAjFZucLNmfj8kwFS5su6ugGZUgH1RU4wR0Pq7NklczEGdRq2nIAcu7v22Uw2o%2FxMY0xBdeC9Korm5%2FNHnxl6K%2Bd6FXSoT9a3XIMQO359auZPiZWzrNlZe%2BqnOahXcx7KAhQIRqSHYYCfquwtPWx%2FgYBqTnLfzoXy7vJAVuH%2FRDtEJJ8rZTq0BdC23Bz%2B0MrsdgbK%2BiW;_UP_6D1_64_=069;_UP_A4A_11_=wb96b12a16f941809f5af993726ba192;_UP_D_=mobilectoken=oxJV13ITm7aa7_rsplIXC-_v;__pus=cef2cc2dfd5d8af70df36bcedf83995cAAT3ZYhqlLos+yCaVQYYC944c4HEQnHz8uEpdQner0OcqISOpBObxl2kck65MGceRIDBd+MLtDxsNqwXvgDIFpYU;__kp=0d340990-9b39-11ef-ae54-4f733858896a;__kps=AAQXoZxLp9Oe2Ps0d/hNBJl4;__ktd=2gPNadz6Z9c+2+FyQyQZUw==;__uid=AAQXoZxLp9Oe2Ps0d/hNBJl4;UDRIVE_TRANSFER_SESS=UpLXXX2HAXJNW0AHgDcMurpazcqTbU-EQWnKG6RKtkdhdqZgHGTM-BSulf_oo1nmMMjo6hFdByLlm-bEiwjByMbIIEehsxhuuV00b96SSaPExn0wMcQ8SmzJa-YwonEE2MEVWCHcRYuW4Z-ljMOgab7qaGtQUpqjkl-p6OTv23BW-4gM6y7DNKvGeaMv_3NX\"," + + "\"cookie\":\"b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; _UP_A4A_11_=wb9661c6dfb642f88f73d8e0c7edd398; b-user-id=89ede34e-0efc-e1dd-c997-f16aaa792d0c; ctoken=wla6p3EUOLyn1FSB8IKp1SEW; grey-id=5583e32b-39df-4bf0-f39f-1adf83f604a2; grey-id.sig=p8ReBIMG2BeZu1sYvsuOAZxYbx-MVrsfKEiCv87MsTM; isQuark=true; isQuark.sig=hUgqObykqFom5Y09bll94T1sS9abT1X-4Df_lzgl8nM; _UP_F7E_8D_=ZkyvVHnrBLp1A1NFJIjWi0PwKLOVbxJPcg0RzQPI6KmBtV6ZMgPh38l93pgubgHDQqhaZ2Sfc0qv%2BRantbfg1mWGAUpRMP4RqXP78Wvu%2FCfvkWWGc5NhCTV71tGOIGgDBR3%2Bu6%2Fjj44KlE5biSNDOWW7Bigcz27lvOTidzNw8s%2FWtKAIxWbnCzZn4%2FJMBUub1SIMcW89g57k4mfPmDlCgpZKzxwl6beSfdtZ4RUWXmZOn5v5NkxVKhU4wR0Pq7NklczEGdRq2nIAcu7v22Uw2o%2FxMY0xBdeC9Korm5%2FNHnxl6K%2Bd6FXSoT9a3XIMQO359auZPiZWzrNlZe%2BqnOahXcx7KAhQIRqSOapSmL4ygJor4r5isJhRuDoXy7vJAVuH%2FRDtEJJ8rZTq0BdC23Bz%2B0MrsdgbK%2BiW; _UP_D_=pc; __wpkreporterwid_=3d3f74a7-99b7-4916-3f78-911fc2eb9d87; tfstk=fIoZNxjnbhKwPOu0TWZ4LsaRqirTcudSSmNbnxD0C5VgClMm8xMyB-GsnSu4tjpOflAOmSD-9PNiGl120XrgkVNb1SrqHbJBN3tSBAEYoQOWVUUg9qZ8n1bGGkD3CqGYINKSBABhjnXgp3_Vywz6gSc0Syj3BWf0mr2DLW24eZfiiovEKWefj1q0swq3E82iNEMinMy7SLrcpA4Fh3z_ZAViCfih3PbtdW5N_DuU77AaTijmYRkL2Wq54ENoy5a7ZXxCbok33XzS7QSZgxD-oyoVsdGotql0p2dVu7umC4nLStbiLmParc4FELHrI-c0u2dPVRrs8zoZWKCnIbNZrlHfUCMUz2z8KyXVSlgSFmUojh58OzeqTzgwaGll4YCYKwctDV5coP2LL79eKHxpNTXHmre1kZU32JPWCR_AkP2LL79eLZQY-WeUNdw1.; __pus=2051c82285199d8be553be41dd5a2100AAQ+mmv35G4FDDZ5x+3Mhe2OMbNgweQ1ODbW8zDt9YuP1LQVqHUuAAz9KWLsPjpNtim0AVGHusN4MCosTmbq/khM; __kp=e6604120-6051-11ef-bfe4-c31b6cdd0766; __kps=AATcZArVgS76EPn0FMaV4HEj; __ktd=sii/iz4ePzEaoVirXul7QQ==; __uid=AATcZArVgS76EPn0FMaV4HEj; __itrace_wid=5829b95d-dac1-48d3-bfd5-f60cd9462786; __puus=7da0b96cb710fa1b376934485f977e05AATp/q8/QupT7IiBR1GWqZhxlIRT677smMvoHlLxQA0Lk6CkP0YJBOTl+p9DZgzlMz6w4hPXPgWsokukk8PW7ZfhFfPmv8tKMgLpCGLW+tk57luhNghmSdTeVPkAF59STtyCPBEtiNzNAd/zZJ6qILJDi5ywEBAAAg+gOyWHoLHNUR+QxeHRuQa8g5WWA95J8jebIlrr8rCvI1vjTbtiYktT\",\"token\":\"26fc6787afff43e78b78992e782502f1\"}"); + // spider.init(mockContext, ""); + } + + @org.junit.Test + public void homeContent() throws Exception { + String content = spider.homeContent(true); + JsonObject map = Json.safeObject(content); + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + System.out.println("homeContent--" + gson.toJson(map)); + + //Assert.assertFalse(map.getAsJsonArray("list").isEmpty()); + } + + @org.junit.Test + public void homeVideoContent() throws Exception { + String content = spider.homeVideoContent(); + JsonObject map = Json.safeObject(content); + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + System.out.println("homeVideoContent--" + gson.toJson(map)); + + // Assert.assertFalse(map.getAsJsonArray("list").isEmpty()); + } + + @org.junit.Test + public void categoryContent() throws Exception { + String content = spider.categoryContent("2", "2", true, null); + JsonObject map = Json.safeObject(content); + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + System.out.println("categoryContent--" + gson.toJson(map)); + Assert.assertFalse(map.getAsJsonArray("list").isEmpty()); + } + + @org.junit.Test + public void detailContent() throws Exception { + + String content = spider.detailContent(Arrays.asList("/index.php/vod/detail/id/851.html")); + System.out.println("detailContent--" + content); + + 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("uc原画1", "41763595fca647348731bc32ef5190b2++52a46a589a95ed45fd6977ebe531f125++5359743fc8104++bIVfJzodKqiL1Vt0bKX5kfANX1vvMrv6JCrX50GsClQ=", new ArrayList<>()); + System.out.println("playerContent--" + content); + 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.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()); + } + + +} \ No newline at end of file diff --git a/jar/custom_spider.jar b/jar/custom_spider.jar index 43bb594b..38c1f446 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 aa62507b..b4bb8e1f 100644 --- a/jar/custom_spider.jar.md5 +++ b/jar/custom_spider.jar.md5 @@ -1 +1 @@ -f8c05f9ff273fe1ee6bb259848082849 +2e7f38d5a8e6a366bc5687301dff1e8e diff --git a/json/index.json b/json/index.json index 9953b0b9..76d4b584 100644 --- a/json/index.json +++ b/json/index.json @@ -1,5 +1,5 @@ { - "spider": "https://ghp.ci/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/dev/jar/custom_spider.jar;md5;f8c05f9ff273fe1ee6bb259848082849", + "spider": "https://ghp.ci/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/dev/jar/custom_spider.jar;md5;2e7f38d5a8e6a366bc5687301dff1e8e", "lives": [ { "name": "直播ipv6", @@ -52,6 +52,15 @@ "changeable": 1, "ext": {} }, + { + "key": "木偶", + "name": "木偶哥哥", + "type": 3, + "api": "csp_Mogg", + "searchable": 1, + "changeable": 1, + "ext": {} + }, { "key": "KuaKeBa", "name": "夸克吧", diff --git a/json/index1.json b/json/index1.json index 7adb261b..6951875d 100644 --- a/json/index1.json +++ b/json/index1.json @@ -1,5 +1,5 @@ { - "spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;f8c05f9ff273fe1ee6bb259848082849", + "spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;2e7f38d5a8e6a366bc5687301dff1e8e", "lives": [ { "name": "直播ipv6", diff --git a/json/index2.json b/json/index2.json index b0d87271..0fc0f8a3 100644 --- a/json/index2.json +++ b/json/index2.json @@ -1,5 +1,5 @@ { - "spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;f8c05f9ff273fe1ee6bb259848082849", + "spider": "https://androidcatvodspider.pages.dev/jar/custom_spider.jar;md5;2e7f38d5a8e6a366bc5687301dff1e8e", "lives": [ { "name": "直播ipv6", @@ -97,6 +97,15 @@ "changeable": 1, "ext":{"cookie":"_UP_A4A_11_=wb965111521e45ffa80410c24a071a54; _UP_D_=pc; tfstk=fXFith4nnRk114LAjWc1TT-OQUXL5hGjqodxDjnVLDoBBchYujR4Drht3GaYxmqYlcPtWc34mknIMcFTB-Y_tuAv6G6_uIcxggIRw_U15jGV2EjCXmnslyoqlSMN9PGjgMEW0dR85uVOAjYmgwcEoqOqgIrqLyoIlq-ZuC738DgqgCJZgH8EuqxZNmAqqSPQTaC3h7bb2rFnSvW87D8jTW0iX0zasIR2zVDi4Poh2svabvzjnSTXixaaFogzbhS-Cry3xVcc9dlz--roR55Jj2wT8znUrEdYrfV3t-kh71znscDo-vYWpf24fSD_IE_78frQF0MNdMg367HmVvxFbyUnbY20XMOqX84UxYFpvQhbA-rqok-G4A9eUc4wG27YtK9jQ2gnVNJioG_mbu_h-wv5CAuIWgQh-K9jQ2gn2wbHFhMZRVIR.; __pus=c81f57897dafcb65d4ecb501bc299199AARcqF72zsatdbsCbiT3qVqsk36caaycoPQW7hz8rbEf+UY7f5aGgH1e90lsONAUwCAW8y27u5A/KXyYqkHCWgjS; __kp=99fa2760-1669-11ef-90cf-8f7a59c3b86e; __kps=AATSt4xuf6r6bqes3LdJvxvy; __ktd=c2e+aLICIvFoeklXXz36VA==; __uid=AATSt4xuf6r6bqes3LdJvxvy; Video-Auth=smob3MOUslklDq2MutANJYZCVo50sLv0GFelx3+cu1nK2fkdL2kvkdpT5yNOhNz0NLTyi5ThWRL47+ztJA4kXQ==; __puus=72f667c533c9a22496f88d2f1bb7ae71AAQ7mrvFw7s9AUPUXvnuGPkcDU3RRTVPdYaYQfsM9Cje2doYXgRZXbImg02EaUaEG+G9ikpo3xubGGdElArOuYvUtJzIXb6yHDnSZbtEUxkwvjfQRNEnDnVwLQ6LL2ORjRaxa9OUfwk/WppWvy6OcDqQtHYkaqB+Poxn5kFs7ZVdAtX7ZQks1czD+g9gAZjsbeBHxHQ1AP5MGc1s3M4RhwZQ","token":"26fc6787afff43e78b78992e782502f1"} }, + { + "key": "木偶", + "name": "木偶哥哥", + "type": 3, + "api": "csp_Mogg", + "searchable": 1, + "changeable": 1, + "ext": {} + }, { "key": "KuaKeBa", "name": "夸克吧",