修复爱看机器人
This commit is contained in:
parent
76ede2c74b
commit
b917e81634
|
|
@ -0,0 +1,210 @@
|
||||||
|
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.ProxyVideo;
|
||||||
|
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.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class Ikanbot extends Spider {
|
||||||
|
|
||||||
|
private static final String siteUrl = "https://v.ikanbot.com";
|
||||||
|
private static final String cateUrl = siteUrl + "/hot";
|
||||||
|
private static final String detailUrl = siteUrl + "/play/";
|
||||||
|
private static final String searchUrl = siteUrl + "/search?q=";
|
||||||
|
|
||||||
|
private HashMap<String, String> getHeaders() {
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("User-Agent", Util.CHROME);
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Vod> parseVods(Document doc) {
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
for (Element element : doc.select("a.item")) {
|
||||||
|
String pic = element.select("img").attr("data-src");
|
||||||
|
String url = element.attr("href");
|
||||||
|
String name = element.select("img").attr("alt");
|
||||||
|
String id = url.split("/")[2];
|
||||||
|
list.add(new Vod(id, name, ProxyVideo.buildCommonProxyUrl(pic, Util.webHeaders(pic))));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String homeContent(boolean filter) throws Exception {
|
||||||
|
List<Class> classes = new ArrayList<>();
|
||||||
|
String[] typeIdList = {"/index-movie-热门", "/index-tv-热门", "/index-tv-国产剧", "/index-tv-韩剧"};
|
||||||
|
String[] typeNameList = {"热门电影", "热门剧集", "国产剧", "韩剧"};
|
||||||
|
for (int i = 0; i < typeNameList.length; i++) {
|
||||||
|
classes.add(new Class(typeIdList[i], typeNameList[i]));
|
||||||
|
}
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(siteUrl + "/billboard.html", getHeaders()));
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
for (Element element : doc.select("div.item-root")) {
|
||||||
|
String pic = element.select("img").attr("data-src");
|
||||||
|
String url = element.select("a").attr("href");
|
||||||
|
String name = element.select("img").attr("alt");
|
||||||
|
try {
|
||||||
|
String id = url.split("/")[2];
|
||||||
|
list.add(new Vod(id, name, ProxyVideo.buildCommonProxyUrl(pic, Util.webHeaders(pic))));
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.string(classes, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) throws Exception {
|
||||||
|
String target = cateUrl + tid;
|
||||||
|
if (!"1".equals(pg)) {
|
||||||
|
target = target + "-p-" + pg;
|
||||||
|
}
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(target.concat(".html"), getHeaders()));
|
||||||
|
List<Vod> list = parseVods(doc);
|
||||||
|
Integer total = (Integer.parseInt(pg) + 1) * 24;
|
||||||
|
return Result.get().vod(list).page(Integer.parseInt(pg), Integer.parseInt(pg) + 1, 24, total).string();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String detailContent(List<String> 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("meta[property=og:image]").attr("content");
|
||||||
|
Elements desc = doc.select("div.detail > h3");
|
||||||
|
String year = desc.get(1).text();
|
||||||
|
String area = desc.get(2).text();
|
||||||
|
String actor = desc.get(3).text();
|
||||||
|
|
||||||
|
String current_id = doc.select("input#current_id").attr("value");
|
||||||
|
String e_token = doc.select("input#e_token").attr("value");
|
||||||
|
String mtype = doc.select("input#mtype").attr("value");
|
||||||
|
String tks = get_tks(current_id, e_token);
|
||||||
|
String url = siteUrl + "/api/getResN?videoId=" + ids.get(0) + "&mtype=" + mtype + " &token=" + tks;
|
||||||
|
String data = OkHttp.string(url, getHeaders());
|
||||||
|
Gson gson = new Gson();
|
||||||
|
JsonObject jsonObject = gson.fromJson(data, JsonObject.class);
|
||||||
|
JsonArray array = jsonObject.getAsJsonObject("data").getAsJsonArray("list");
|
||||||
|
String PlayFrom = "";
|
||||||
|
String PlayUrl = "";
|
||||||
|
for (JsonElement element : array) {
|
||||||
|
|
||||||
|
// 使用正则表达式匹配 "flag" 和 "url"
|
||||||
|
Pattern pattern = Pattern.compile("\\\"flag\\\":\\\"(.*?)\\\",\\\"url\\\":\\\"(.*?)\\\"");
|
||||||
|
Matcher matcher = pattern.matcher(String.valueOf(element.getAsJsonObject().get("resData")).replace("\\", ""));
|
||||||
|
String flag = "";
|
||||||
|
String liUrl = "";
|
||||||
|
// 提取匹配到的内容
|
||||||
|
if (matcher.find()) {
|
||||||
|
flag = matcher.group(1);
|
||||||
|
liUrl = matcher.group(2);
|
||||||
|
}
|
||||||
|
if (!"".equals(PlayFrom)) {
|
||||||
|
PlayFrom = PlayFrom + "$$$" + flag;
|
||||||
|
} else {
|
||||||
|
PlayFrom = PlayFrom + flag;
|
||||||
|
}
|
||||||
|
if (!"".equals(PlayUrl)) {
|
||||||
|
PlayUrl = PlayUrl + "$$$" + liUrl.replace("$" + flag, "");
|
||||||
|
} else {
|
||||||
|
PlayUrl = PlayUrl + liUrl.replace("$" + flag, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
// PlayUrl += String.valueOf(element.getAsJsonObject().get("resData")).replace("\\","").replace("\\\"","\"");
|
||||||
|
}
|
||||||
|
Vod vod = new Vod();
|
||||||
|
vod.setVodId(ids.get(0));
|
||||||
|
vod.setVodPic(ProxyVideo.buildCommonProxyUrl(pic, Util.webHeaders(pic)));
|
||||||
|
vod.setVodYear(year);
|
||||||
|
vod.setVodActor(actor);
|
||||||
|
vod.setVodArea(area);
|
||||||
|
vod.setVodName(name);
|
||||||
|
vod.setVodPlayFrom(PlayFrom);
|
||||||
|
vod.setVodPlayUrl(PlayUrl.replace("##", "#").replace("#$$$", "$$$"));
|
||||||
|
return Result.string(vod);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String searchContent(String key, boolean quick) throws Exception {
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(searchUrl.concat(URLEncoder.encode(key)), getHeaders()));
|
||||||
|
List<Vod> list = new ArrayList<>();
|
||||||
|
for (Element element : doc.select("a.cover-link")) {
|
||||||
|
String pic = element.select("img").attr("data-src");
|
||||||
|
String url = element.attr("href");
|
||||||
|
String name = element.select("img").attr("alt");
|
||||||
|
String id = url.split("/")[2];
|
||||||
|
|
||||||
|
list.add(new Vod(id, name, ProxyVideo.buildCommonProxyUrl(pic, Util.webHeaders(pic))));
|
||||||
|
}
|
||||||
|
return Result.string(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String playerContent(String flag, String id, List<String> vipFlags) throws Exception {
|
||||||
|
return Result.get().url(id).header(getHeaders()).string();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// function get_tks() {
|
||||||
|
// const _0xf07220 = _0xf746;
|
||||||
|
// let _0x35162d = document['getElementById'] ('current_id').value 'current_id'
|
||||||
|
// , _0xf25678 = document['getElementById'] ('e_token').value;
|
||||||
|
// 'e_token'
|
||||||
|
// if (!_0x35162d || !_0xf25678)
|
||||||
|
// return;
|
||||||
|
// let _0x3882a3 = _0x35162d['length'], _0x52a097 = _0x35162d['substring']
|
||||||
|
// (_0x3882a3 - 4, _0x3882a3)
|
||||||
|
// ,_0x2d9d1b = [];
|
||||||
|
// for (let _0x570711 = 0x0; _0x570711 < _0x52a097['length']; _0x570711++) {
|
||||||
|
// let _0x23e537 = parseInt(_0x52a097[_0x570711]), _0x48b93d = _0x23e537 % 0x3 + 0x1;
|
||||||
|
// _0x2d9d1b[_0x570711] = _0xf25678['substring'] (_0x48b93d, _0x48b93d + 0x8),
|
||||||
|
// _0xf25678 = _0xf25678['substring'] (_0x48b93d + 0x8, _0xf25678['length']);
|
||||||
|
// }
|
||||||
|
// v_tks = _0x2d9d1b['join'] ('');
|
||||||
|
// }
|
||||||
|
|
||||||
|
public String get_tks(String current_id, String e_token) {
|
||||||
|
// String current_id = "798347";
|
||||||
|
// String e_token = "mre0530ce88964487488y67d38c0a1uj7fd15cb8";
|
||||||
|
System.out.printf("current_id " + current_id);
|
||||||
|
System.out.printf("e_token " + e_token);
|
||||||
|
if ("".equals(current_id) || "".equals(e_token)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String[] list = new String[4];
|
||||||
|
int idLength = current_id.length();
|
||||||
|
String subString = current_id.substring(idLength - 4, idLength);
|
||||||
|
for (int i = 0; i < subString.length(); i++) {
|
||||||
|
int num = Character.getNumericValue(subString.charAt(i));
|
||||||
|
int begin = num % 3 + 1;
|
||||||
|
list[i] = e_token.substring(begin, begin + 8);
|
||||||
|
e_token = e_token.substring(begin + 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder v_tks = new StringBuilder();
|
||||||
|
for (String string : list) {
|
||||||
|
v_tks.append(string);
|
||||||
|
}
|
||||||
|
return v_tks.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -16,13 +16,20 @@ import com.github.catvod.spider.Init;
|
||||||
import org.mozilla.universalchardet.UniversalDetector;
|
import org.mozilla.universalchardet.UniversalDetector;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
import java.net.URI;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import okhttp3.Cookie;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.internal.http.HttpHeaders;
|
||||||
|
import okhttp3.internal.http2.Header;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
|
|
||||||
public static final Pattern RULE = Pattern.compile("http((?!http).){12,}?\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)\\?.*|http((?!http).){12,}\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)|http((?!http).)*?video/tos*");
|
public static final Pattern RULE = Pattern.compile("http((?!http).){12,}?\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)\\?.*|http((?!http).){12,}\\.(m3u8|mp4|mkv|flv|mp3|m4a|aac)|http((?!http).)*?video/tos*");
|
||||||
|
|
@ -31,6 +38,7 @@ public class Util {
|
||||||
public static final String ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
|
public static final String ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
|
||||||
public static final List<String> MEDIA = Arrays.asList("mp4", "mkv", "wmv", "flv", "avi", "iso", "mpg", "ts", "mp3", "aac", "flac", "m4a", "ape", "ogg");
|
public static final List<String> MEDIA = Arrays.asList("mp4", "mkv", "wmv", "flv", "avi", "iso", "mpg", "ts", "mp3", "aac", "flac", "m4a", "ape", "ogg");
|
||||||
public static final List<String> SUB = Arrays.asList("srt", "ass", "ssa", "vtt");
|
public static final List<String> SUB = Arrays.asList("srt", "ass", "ssa", "vtt");
|
||||||
|
private static HashMap<String, String> webHttpHeaderMap;
|
||||||
|
|
||||||
public static boolean isVip(String url) {
|
public static boolean isVip(String url) {
|
||||||
List<String> hosts = Arrays.asList("iqiyi.com", "v.qq.com", "youku.com", "le.com", "tudou.com", "mgtv.com", "sohu.com", "acfun.cn", "bilibili.com", "baofeng.com", "pptv.com");
|
List<String> hosts = Arrays.asList("iqiyi.com", "v.qq.com", "youku.com", "le.com", "tudou.com", "mgtv.com", "sohu.com", "acfun.cn", "bilibili.com", "baofeng.com", "pptv.com");
|
||||||
|
|
@ -53,7 +61,8 @@ public class Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isVideoFormat(String url) {
|
public static boolean isVideoFormat(String url) {
|
||||||
if (url.contains("url=http") || url.contains(".js") || url.contains(".css") || url.contains(".html")) return false;
|
if (url.contains("url=http") || url.contains(".js") || url.contains(".css") || url.contains(".html"))
|
||||||
|
return false;
|
||||||
return RULE.matcher(url).find();
|
return RULE.matcher(url).find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,4 +222,36 @@ public class Util {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param referer
|
||||||
|
* @param cookie 多个cookie name=value;name2=value2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static HashMap<String, String> webHeaders(String referer, String cookie) {
|
||||||
|
HashMap<String, String> map = webHeaders(referer);
|
||||||
|
map.put("Cookie", cookie);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<String, String> webHeaders(String referer) {
|
||||||
|
if (webHttpHeaderMap == null || webHttpHeaderMap.isEmpty()) {
|
||||||
|
synchronized (Util.class) {
|
||||||
|
if (webHttpHeaderMap == null || webHttpHeaderMap.isEmpty()) {
|
||||||
|
webHttpHeaderMap = new HashMap<>();
|
||||||
|
webHttpHeaderMap.put("Content-Type", "text/plain;charset=UTF-8");
|
||||||
|
webHttpHeaderMap.put("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
|
||||||
|
webHttpHeaderMap.put("Connection", "keep-alive");
|
||||||
|
webHttpHeaderMap.put("User-Agent", CHROME);
|
||||||
|
webHttpHeaderMap.put("Accept", "*/*");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
URI uri = URI.create(referer);
|
||||||
|
String u = uri.getScheme() + "://" + uri.getHost();
|
||||||
|
webHttpHeaderMap.put("Referer", u);
|
||||||
|
webHttpHeaderMap.put("Origin", u);
|
||||||
|
return webHttpHeaderMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
import android.app.Application;
|
||||||
|
|
||||||
|
import com.github.catvod.spider.DaGongRen;
|
||||||
|
import com.github.catvod.spider.Ikanbot;
|
||||||
|
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;
|
||||||
|
import org.robolectric.RuntimeEnvironment;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
public class IkanbotTest {
|
||||||
|
// @Mock
|
||||||
|
private Application mockContext;
|
||||||
|
|
||||||
|
private Ikanbot spider;
|
||||||
|
|
||||||
|
@org.junit.Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
mockContext = RuntimeEnvironment.application;
|
||||||
|
Init.init(mockContext);
|
||||||
|
spider = new Ikanbot();
|
||||||
|
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("/index-movie-热门", "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("853785"));
|
||||||
|
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 froms = "gsm3u8$$$xlm3u8$$$jsm3u8$$$tpm3u8$$$wolong$$$bfzym3u8$$$lzm3u8$$$1080zyk$$$kcm3u8$$$kuaikan$$$tkm3u8$$$sdm3u8$$$wjm3u8$$$hhm3u8$$$ikm3u8$$$snm3u8$$$hym3u8$$$ffm3u8$$$fsm3u8$$$zuidam3u8$$$jinyingm3u8$$$ukm3u8$$$bjm3u8$$$360zy$$$hw8$$$subm3u8$$$yhm3u8";
|
||||||
|
String urls = "正片$https://v.gsuus.com/play/5eVR4Qoe/index.m3u8$$$正片$https://play.xluuss.com/play/NbWV5qoa/index.m3u8$$$正片$https://vv.jisuzyv.com/play/QeZ1k0gd/index.m3u8$$$犯罪都市4$https://sd8.taopianplay1.com:43333/c56b1bc09da3/HD/2024-07-19/1/de5459c7a07b/ff4eb0c51ec7/playlist.m3u8$$$正片$https://cdn.wlcdn99.com:777/6c7f15f2/index.m3u8$$$中字$https://s3.bfengbf.com/video/fanzuidushi4/中字/index.m3u8$$$HD中字$https://v.cdnlz21.com/20240701/790_6dc95607/index.m3u8$$$HD人工中文$https://svip.high22-playback.com/20240701/4372_9052ee7b/index.m3u8$$$中字$https://v1.longshengtea.com/yyv1/202405/18/FLxwP9Hqmp1/video/index.m3u8#HD$https://v8.longshengtea.com/yyv8/202407/01/3XNQBep5ix14/video/index.m3u8$$$俄版机翻中字$https://vip.kuaikan-play3.com/20240710/BainGasF/index.m3u8#俄语机翻中字$https://vip.kuaikan-play2.com/20240522/BAEnKmHY/index.m3u8#正片$https://vip.kuaikan-play3.com/20240710/EmydKWIH/index.m3u8$$$HD$https://v10.dious.cc/20240716/9M2dnF2Z/index.m3u8$$$中字$https://v1.fentvoss.com/sdv1/202405/18/FLxwP9Hqmp1/video/index.m3u8#HD$https://v8.fentvoss.com/sdv8/202407/01/3XNQBep5ix14/video/index.m3u8$$$HD$https://v11.tlkqc.com/wjv11/202407/02/H9pYM8zuu383/video/index.m3u8$$$正片$https://play.hhuus.com/play/QbY8j5Ya/index.m3u8$$$正片$https://bfikuncdn.com/20240716/i9cQ7Ayr/index.m3u8$$$HD$https://v8.mzxay.com/202407/01/3XNQBep5ix14/video/index.m3u8$$$正片$https://1080p.huyall.com/play/BeXWg5Vd/index.m3u8$$$HD中字$https://super.ffzy-online6.com/20240702/33974_183d0e8f/index.m3u8$$$HD$https://s10.fsvod1.com/20240716/PqZ8bfiD/index.m3u8$$$中字$https://v1.daayee.com/yyv1/202405/18/FLxwP9Hqmp1/video/index.m3u8#HD$https://v8.daayee.com/yyv8/202407/01/3XNQBep5ix14/video/index.m3u8$$$正片$https://hd.ijycnd.com/play/BeXWg5Vd/index.m3u8$$$720P$https://ukzy.ukubf3.com/20240702/rrroUpHe/index.m3u8$$$HD$https://v1.hdslb.pro/share/ydXlDNTEWgM46Bmx$$$犯罪都市4$https://vod.lyhuicheng.com/20240606/8w8PDkzh/index.m3u8$$$俄版机翻中字$https://m3u.nikanba.live/share/f3533edd778d62b756c4d2278c8252a6.m3u8#正片$https://m3u.nikanba.live/share/725902890b41ec1e1ea688afb0adf555.m3u8$$$正片$https://play.subokk.com/play/NbWV5qoa/index.m3u8$$$HD$https://vod12.wgslsw.com/20240708/H9pYM8zuu383/index.m3u8#";
|
||||||
|
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);
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
import android.app.Application;
|
||||||
|
|
||||||
|
import com.github.catvod.spider.DaGongRen;
|
||||||
|
import com.github.catvod.spider.Init;
|
||||||
|
import com.github.catvod.spider.Ysj;
|
||||||
|
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 YsjTest {
|
||||||
|
// @Mock
|
||||||
|
private Application mockContext;
|
||||||
|
|
||||||
|
private Ysj spider;
|
||||||
|
|
||||||
|
@org.junit.Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
mockContext = RuntimeEnvironment.application;
|
||||||
|
Init.init(mockContext);
|
||||||
|
spider = new Ysj();
|
||||||
|
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("943.html", "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("92856-1-1.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 froms = "\uE62F 闪电资源";
|
||||||
|
String urls = "HD$92856-1-1.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);
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
438408397ac27c14336f47bc41b743fb
|
01e1c90f1873a3e193bc494b9eab2d83
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "../jar/custom_spider.jar;md5;438408397ac27c14336f47bc41b743fb",
|
"spider": "../jar/custom_spider.jar;md5;01e1c90f1873a3e193bc494b9eab2d83",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "直播ipv6",
|
"name": "直播ipv6",
|
||||||
|
|
@ -113,20 +113,13 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"key": "Ysj",
|
"key": "ikanbot",
|
||||||
"name": "\uD83C\uDF0F\uFE0F 异世界动漫 | 动漫",
|
"name": "🤖┃爱看机器人┃🤖",
|
||||||
|
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"api": "csp_Ysj",
|
"api": "csp_Ikanbot",
|
||||||
"searchable": 1,
|
|
||||||
"filterable": 1
|
"ext": "{\"box\": \"TVBox\", \"danmu\": false}"
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "FirstAid",
|
|
||||||
"name": "\uD83D\uDCAA 健康 | 视频",
|
|
||||||
"type": 3,
|
|
||||||
"api": "csp_FirstAid",
|
|
||||||
"searchable": 1,
|
|
||||||
"filterable": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "nangua",
|
"key": "nangua",
|
||||||
|
|
@ -137,15 +130,16 @@
|
||||||
"timeout": 30,
|
"timeout": 30,
|
||||||
"ext": "{\"box\": \"TVBox\", \"danmu\": false}"
|
"ext": "{\"box\": \"TVBox\", \"danmu\": false}"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"key": "ikanbot",
|
"key": "Ysj",
|
||||||
"name": "🤖┃爱看机器人┃🤖",
|
"name": "\uD83C\uDF0F\uFE0F 异世界动漫 | 动漫(不稳定)",
|
||||||
"playerType": 0,
|
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"api": "./js/ikanbot.js",
|
"api": "csp_Ysj",
|
||||||
"timeout": 30,
|
"searchable": 1,
|
||||||
"ext": "{\"box\": \"TVBox\", \"danmu\": false}"
|
"filterable": 1
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"key": "QxiTv",
|
"key": "QxiTv",
|
||||||
"name": "\uD83E\uDD70 7喜 | 影视(不稳定)",
|
"name": "\uD83E\uDD70 7喜 | 影视(不稳定)",
|
||||||
"type": 3,
|
"type": 3,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue