diff --git a/README.md b/README.md index 0615ffc..836efaa 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ https://github.com/CatVodTVOfficial/CatVodTVSpider | Jabel | 教学 | csp_Jable | 🟢 | | 7xiTv | 视频 | csp_QxiTv | 🟢 | | Ikanbot | 视频 | csp_Ikanbot | 🟢 | +| W55Movie | 视频 | csp_W55Movie | 🟢 | > jar脚本 ```shell diff --git a/app/src/main/java/com/github/catvod/debug/MainActivity.java b/app/src/main/java/com/github/catvod/debug/MainActivity.java index 6ffdd46..6444d6c 100644 --- a/app/src/main/java/com/github/catvod/debug/MainActivity.java +++ b/app/src/main/java/com/github/catvod/debug/MainActivity.java @@ -18,6 +18,7 @@ import com.github.catvod.spider.Jable; import com.github.catvod.spider.JavDb; import com.github.catvod.spider.JustLive; import com.github.catvod.spider.QxiTv; +import com.github.catvod.spider.W55Movie; import com.github.catvod.spider.Wogg; import com.github.catvod.spider.Zhaozy; import com.orhanobut.logger.AndroidLogAdapter; @@ -58,7 +59,7 @@ public class MainActivity extends Activity { private void initSpider() { try { Init.init(getApplicationContext()); - spider = new Ikanbot(); + spider = new W55Movie(); spider.init(this, ""); } catch (Throwable e) { e.printStackTrace(); @@ -83,7 +84,7 @@ public class MainActivity extends Activity { public void categoryContent() { try { - Logger.t("categoryContent").d(spider.categoryContent("movie", "1", true, new HashMap<>())); + Logger.t("categoryContent").d(spider.categoryContent("/vodshow/124", "2", true, new HashMap<>())); } catch (Throwable e) { e.printStackTrace(); } @@ -91,7 +92,7 @@ public class MainActivity extends Activity { public void detailContent() { try { - Logger.t("detailContent").d(spider.detailContent(Arrays.asList("838500"))); + Logger.t("detailContent").d(spider.detailContent(Arrays.asList("454873.html"))); } catch (Throwable e) { e.printStackTrace(); } @@ -99,7 +100,7 @@ public class MainActivity extends Activity { public void playerContent() { try { - Logger.t("playerContent").d(spider.playerContent("轉存原畫", "/vodplay/798347-2-9.html", new ArrayList<>())); + Logger.t("playerContent").d(spider.playerContent("轉存原畫", "454873-5-5.html", new ArrayList<>())); } catch (Throwable e) { e.printStackTrace(); } diff --git a/app/src/main/java/com/github/catvod/spider/QxiTv.java b/app/src/main/java/com/github/catvod/spider/QxiTv.java index 56054dc..dae298d 100644 --- a/app/src/main/java/com/github/catvod/spider/QxiTv.java +++ b/app/src/main/java/com/github/catvod/spider/QxiTv.java @@ -51,7 +51,7 @@ public class QxiTv extends Spider { String typeId = element.select("a").attr("href"); String typeName = element.select("span").text(); if (!"".equals(typeName)) { - classes.add(new Class(typeId, typeName)); + classes.add(new Class(typeId, typeName.replace(" 查看更多",""))); } } for (Element element : doc.select("a.public-list-exp")) { diff --git a/app/src/main/java/com/github/catvod/spider/W55Movie.java b/app/src/main/java/com/github/catvod/spider/W55Movie.java new file mode 100644 index 0000000..cc8b66b --- /dev/null +++ b/app/src/main/java/com/github/catvod/spider/W55Movie.java @@ -0,0 +1,229 @@ +package com.github.catvod.spider; + +import com.github.catvod.bean.Class; +import com.github.catvod.bean.Result; +import com.github.catvod.bean.Vod; +import com.github.catvod.crawler.Spider; +import com.github.catvod.net.OkHttp; +import com.github.catvod.utils.AESEncryption; +import com.github.catvod.utils.Util; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +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.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class W55Movie extends Spider { + + private static final String siteUrl = "https://5view.shop"; + private static final String cateUrl = siteUrl + "/index.php/api/vod"; + private static final String detailUrl = siteUrl + "/voddetail/"; + private static final String playUrl = siteUrl + "/vodplay/"; + private static final String searchUrl = siteUrl + "/vodsearch/page/1/wd/"; + + private HashMap getHeaders() { + HashMap headers = new HashMap<>(); + headers.put("User-Agent", Util.CHROME); + return headers; + } + + @Override + public String homeContent(boolean filter) throws Exception { + List list = new ArrayList<>(); + List classes = new ArrayList<>(); + String[] typeIdList = {"/label/netflix/page/","/vodshow/1","/vodshow/2","/vodshow/124","/vodshow/4","/vodshow/3"}; + String[] typeNameList = {"Netflix","电影","连续剧","福利","动漫","综艺"}; + for (int i = 0; i < typeNameList.length; i++) { + classes.add(new Class(typeIdList[i], typeNameList[i])); + } + Document doc = Jsoup.parse(OkHttp.string(siteUrl, getHeaders())); + for (Element element : doc.select("a.module-poster-item")) { + try { + String pic = element.select("img").attr("data-original"); + String url = element.attr("href"); + String name = element.attr("title"); + if (!pic.startsWith("http")) { + pic = siteUrl + pic; + } + String id = url.split("/")[2]; + list.add(new Vod(id, name, pic)); + } catch (Exception e) { + } + } + return Result.string(classes, list); + } + + public String MD5(String string) { + // 创建 MD5 实例 + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + // 计算 MD5 哈希值 + byte[] hashBytes = md.digest(string.getBytes()); + + // 将字节数组转换为十六进制字符串表示 + StringBuilder hexString = new StringBuilder(); + for (byte hashByte : hashBytes) { + String hex = Integer.toHexString(0xff & hashByte); + if (hex.length() == 1) { + hexString.append('0'); + } + hexString.append(hex); + } + + // 输出加密后的 MD5 字符串 + System.out.println("MD5 加密: " + hexString.toString()); + return hexString.toString(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return ""; + } + + @Override + public String categoryContent(String tid, String pg, boolean filter, HashMap extend) throws Exception { + List list = new ArrayList<>(); + if (tid.startsWith("/label/")){ + tid = tid + pg + ".html"; + }else { + tid = tid + "--------" + pg + "---.html"; + } + String target = siteUrl + tid; + Document doc = Jsoup.parse(OkHttp.string(target, getHeaders())); + for (Element element : doc.select("a.module-poster-item")) { + try { + String pic = element.select("img").attr("data-original"); + String url = element.attr("href"); + String name = element.attr("title"); + if (!pic.startsWith("http")) { + pic = siteUrl + pic; + } + String id = url.split("/")[2]; + list.add(new Vod(id, name, pic)); + } catch (Exception e) { + } + } + + Integer total = (Integer.parseInt(pg) + 1) * 20; + return Result.string(Integer.parseInt(pg), Integer.parseInt(pg) + 1, 20, total, list); + } + + @Override + public String detailContent(List ids) throws Exception { + Document doc = Jsoup.parse(OkHttp.string(detailUrl.concat(ids.get(0)), getHeaders())); + String name = doc.select("h1").text(); + String pic = doc.select("img.ls-is-cached").attr("data-original"); + Elements desc = doc.select("div.module-info-tag-link"); + String year = desc.get(0).select("a").text(); + String area = desc.get(1).select("a").text(); + String tags = desc.get(2).select("a").text(); + String content = doc.select("meta[name=description]").attr("content"); + + // 播放源 + Elements tabs = doc.select("div.module-tab-item"); + Elements list = doc.select("div.module-play-list-content"); + String PlayFrom = ""; + String PlayUrl = ""; + for (int i = 0; i < tabs.size(); i++) { + String tabName = tabs.get(i).text(); + if (!"".equals(PlayFrom)) { + PlayFrom = PlayFrom + "$$$" + tabName; + } else { + PlayFrom = PlayFrom + tabName; + } + Elements li = list.get(i).select("a"); + String liUrl = ""; + for (int i1 = 0; i1 < li.size(); i1++) { + if (!"".equals(liUrl)) { + liUrl = liUrl + "#" + li.get(i1).text() + "$" + li.get(i1).attr("href").replace("/vodplay/",""); + } else { + liUrl = liUrl + li.get(i1).text() + "$" + li.get(i1).attr("href").replace("/vodplay/",""); + } + } + if (!"".equals(PlayUrl)) { + PlayUrl = PlayUrl + "$$$" + liUrl; + } else { + PlayUrl = PlayUrl + liUrl; + } + } + + Vod vod = new Vod(); + vod.setVodId(ids.get(0)); + vod.setVodPic(pic); + vod.setVodYear(year); + vod.setVodArea(area); + vod.setVodTag(tags); + vod.setVodContent(content); + vod.setVodName(name); + vod.setVodPlayFrom(PlayFrom); + vod.setVodPlayUrl(PlayUrl); + return Result.string(vod); + } + + @Override + public String searchContent(String key, boolean quick) throws Exception { + List list = new ArrayList<>(); + Document doc = Jsoup.parse(OkHttp.string(searchUrl.concat(URLEncoder.encode(key)).concat(".html"), getHeaders())); + for (Element element : doc.select("a.public-list-exp")) { + try { + String pic = element.select("img").attr("data-src"); + String url = element.attr("href"); + String name = element.attr("title"); + if (!pic.startsWith("http")) { + pic = siteUrl + pic; + } + String id = url.split("/")[2]; + list.add(new Vod(id, name, pic)); + } catch (Exception e) { + } + } + return Result.string(list); + } + + @Override + public String playerContent(String flag, String id, List vipFlags) throws Exception { + String target = playUrl.concat(id); + Document doc = Jsoup.parse(OkHttp.string(target)); + String regex = "\"url\\\":\\\"(.*?)\\\",\\\"url_next\\\":\\\"(.*?)\\\""; + + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(doc.html()); + String url = ""; + String url_next = ""; + if (matcher.find()) { + url = matcher.group(1); + url_next = matcher.group(2); + } + String encrytStr = "{\"url\":\"" + url + "\",\"next_url\":\"" + url_next + "\"}"; + // 加密 + String encrypt = AESEncryption.encrypt(encrytStr); + String encodeURI = AESEncryption.encodeURIComponent(encrypt); + // 请求获取url + String data = OkHttp.string("https://player.ddzyku.com:3653/getUrls?data=" + encodeURI); + // 解密 + String decrypted = AESEncryption.decrypt(data); + Gson gson = new Gson(); + JsonObject jsonObject = gson.fromJson(decrypted, JsonObject.class); + JsonObject dataObject = jsonObject.getAsJsonObject("data"); + String url1 = ""; + // Ensure the field exists before accessing it + if (dataObject != null && dataObject.has("url")) { + url1 = dataObject.get("url").getAsString(); + } else { + System.out.println("Invalid JSON format or missing 'url' field."); + } + return Result.get().url(url1).header(getHeaders()).string(); + } +} diff --git a/app/src/main/java/com/github/catvod/utils/AESEncryption.java b/app/src/main/java/com/github/catvod/utils/AESEncryption.java new file mode 100644 index 0000000..aa8e781 --- /dev/null +++ b/app/src/main/java/com/github/catvod/utils/AESEncryption.java @@ -0,0 +1,78 @@ +package com.github.catvod.utils; + +import android.util.Base64; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +public class AESEncryption { + + private static final String keyString = "a67e9a3a85049339"; + private static final String ivString = "86ad9b37cc9f5b9501b3cecc7dc6377c"; + + public static String encrypt(String word) { + try { + byte[] keyBytes = keyString.getBytes("UTF-8"); + SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES"); + + byte[] ivBytes = hexStringToByteArray(ivString); + IvParameterSpec ivSpec = new IvParameterSpec(ivBytes); + + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); + cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); + + byte[] encrypted = cipher.doFinal(word.getBytes("UTF-8")); + + return Base64.encodeToString(encrypted, Base64.DEFAULT); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public static String decrypt(String word) { + try { + byte[] keyBytes = keyString.getBytes("UTF-8"); + SecretKeySpec keySpec = new SecretKeySpec(keyBytes, "AES"); + + byte[] ivBytes = hexStringToByteArray(ivString); + IvParameterSpec ivSpec = new IvParameterSpec(ivBytes); + + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); + cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); + + byte[] decoded = Base64.decode(word, Base64.DEFAULT); + byte[] decrypted = cipher.doFinal(decoded); + + return new String(decrypted, "UTF-8"); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + private static byte[] hexStringToByteArray(String hexString) { + int len = hexString.length(); + byte[] data = new byte[len / 2]; + + for (int i = 0; i < len; i += 2) { + data[i / 2] = (byte) ((Character.digit(hexString.charAt(i), 16) << 4) + + Character.digit(hexString.charAt(i + 1), 16)); + } + + return data; + } + + public static String encodeURIComponent(String value) { + try { + return URLEncoder.encode(value, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("Error encoding URL component", e); + } + } +} \ No newline at end of file diff --git a/jar/custom_spider.jar b/jar/custom_spider.jar index 49127d5..e7c0eef 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 dc77e25..48150b7 100644 --- a/jar/custom_spider.jar.md5 +++ b/jar/custom_spider.jar.md5 @@ -1 +1 @@ -d48ddef356bac9a563e4dd6af44b28fd +3ec28751a5a9a4b999cdb063e063e456 diff --git a/json/index.json b/json/index.json index 5b692da..19a7141 100644 --- a/json/index.json +++ b/json/index.json @@ -45,6 +45,14 @@ "api": "csp_Ikanbot", "searchable": 1, "filterable": 1 + },, + { + "key": "W55Movie", + "name": "W55Movie", + "type": 3, + "api": "csp_W55Movie", + "searchable": 0, + "filterable": 1 }, { "key": "J91",