低端影视
This commit is contained in:
parent
d7141d287b
commit
cc090a5fe3
|
|
@ -0,0 +1,429 @@
|
||||||
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
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.crawler.SpiderDebug;
|
||||||
|
import com.github.catvod.net.OkHttp;
|
||||||
|
import com.github.catvod.utils.Util;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.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.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demo for self study
|
||||||
|
* <p>
|
||||||
|
* Source from Author: CatVod
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Ddrk extends Spider {
|
||||||
|
|
||||||
|
private static final String siteUrl = "https://ddys.pro";
|
||||||
|
private static final String siteHost = "ddys.pro";
|
||||||
|
|
||||||
|
protected JSONObject filterConfig;
|
||||||
|
|
||||||
|
protected Pattern regexCategory = Pattern.compile("/category/(\\S+)/");
|
||||||
|
protected Pattern regexVid = Pattern.compile("https://ddys.pro/(\\S+)/");
|
||||||
|
|
||||||
|
protected Pattern regexPage = Pattern.compile("\\S+/page/(\\S+)\\S+");
|
||||||
|
protected Pattern m = Pattern.compile("\\S+(http\\S+g)");
|
||||||
|
protected Pattern mark = Pattern.compile("\\S+(.*)");
|
||||||
|
|
||||||
|
// protected Pattern t = Pattern.compile("(\\S+)");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 爬虫headers
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected HashMap<String, String> getHeaders(String url) {
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.62 Safari/537.36");
|
||||||
|
headers.put("Referer", siteUrl);
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static HashMap<String, String> Headers() {
|
||||||
|
HashMap<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36");
|
||||||
|
headers.put("Referer", siteUrl);
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分类数据 + 首页最近更新视频列表数据
|
||||||
|
*
|
||||||
|
* @param filter 是否开启筛选 关联的是 软件设置中 首页数据源里的筛选开关
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String homeContent(boolean filter) {
|
||||||
|
|
||||||
|
List<Vod> vods = new ArrayList<>();
|
||||||
|
String url = siteUrl + '/';
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(url, getHeaders(url)));
|
||||||
|
Elements elements = doc.select("li.menu-item a");
|
||||||
|
List<Class> classes = new ArrayList<>();
|
||||||
|
ArrayList<String> allClass = new ArrayList<>();
|
||||||
|
for (Element ele : elements) {
|
||||||
|
String name = ele.attr("title");
|
||||||
|
boolean show = !filter || (name.equals("热映中") || name.equals("欧美剧") || name.equals("日剧") || name.equals("韩剧") || name.equals("华语剧") || name.equals("其他地区") || name.equals("全部") || name.equals("欧美电影") || name.equals("日韩电影") || name.equals("华语电影") || name.equals("新番") || name.equals("动画") || name.equals("纪录片") || name.equals("综艺"));
|
||||||
|
if (allClass.contains(name)) show = false;
|
||||||
|
if (show) {
|
||||||
|
allClass.add(name);
|
||||||
|
Matcher mather = regexCategory.matcher(ele.attr("href"));
|
||||||
|
if (!mather.find()) continue;
|
||||||
|
// 把分类的id和名称取出来加到列表里
|
||||||
|
String id = mather.group(1).trim();
|
||||||
|
|
||||||
|
classes.add(new Class(id, name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 取首页推荐视频列表
|
||||||
|
Elements list = doc.select("div.post-box-container");
|
||||||
|
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
Element vod = list.get(i);
|
||||||
|
String title = vod.selectFirst(".post-box-title > a").text();
|
||||||
|
String id = vod.selectFirst(".post-box-title > a").attr("href");
|
||||||
|
String imageHtml = vod.selectFirst("div.post-box-image").attr("style");
|
||||||
|
String image = "";
|
||||||
|
String regex = "url\\((.*?)\\)";
|
||||||
|
|
||||||
|
Pattern pattern = Pattern.compile(regex);
|
||||||
|
Matcher matcher = pattern.matcher(imageHtml);
|
||||||
|
if (matcher.find()) {
|
||||||
|
image = matcher.group(1);
|
||||||
|
}
|
||||||
|
vods.add(new Vod(id, title, image));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return Result.string(classes, vods, filterConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分类信息数据
|
||||||
|
*
|
||||||
|
* @param tid 分类id
|
||||||
|
* @param pg 页数
|
||||||
|
* @param filter 同homeContent方法中的filter
|
||||||
|
* @param extend 筛选参数{k:v, k1:v1}
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
||||||
|
String url = "";
|
||||||
|
try {
|
||||||
|
if (extend != null && extend.size() > 0) {
|
||||||
|
for (Iterator<String> it = extend.keySet().iterator(); it.hasNext(); ) {
|
||||||
|
String key = it.next();
|
||||||
|
String value = extend.get(key);
|
||||||
|
if (value != null && value.length() != 0 && value != " ") {
|
||||||
|
url = siteUrl + "/category/" + tid + "/" + value;
|
||||||
|
} else {
|
||||||
|
url = siteUrl + "/category/" + tid;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
url = siteUrl + "/category/" + tid;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
if (pg.equals("1")) {
|
||||||
|
url = url + "/";
|
||||||
|
} else {
|
||||||
|
url = url + "/page/" + pg + "/";
|
||||||
|
}
|
||||||
|
//System.out.println(url);
|
||||||
|
String html = OkHttp.string(url, getHeaders(url));
|
||||||
|
Document doc = Jsoup.parse(html);
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
int pageCount = 0;
|
||||||
|
int page = -1;
|
||||||
|
|
||||||
|
// 取页码相关信息
|
||||||
|
Elements pageInfo = doc.select("div.nav-links");
|
||||||
|
if (pageInfo.size() == 0) {
|
||||||
|
page = Integer.parseInt(pg);
|
||||||
|
pageCount = page;
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < pageInfo.size(); i++) {
|
||||||
|
Element li = pageInfo.get(i);
|
||||||
|
Element a = li.selectFirst("a");
|
||||||
|
if (a == null) continue;
|
||||||
|
String wy = doc.select("div.nav-links a").last().attr("href");
|
||||||
|
String span = doc.select("span.current").text().trim();
|
||||||
|
if (page == -1) {
|
||||||
|
page = Integer.parseInt(span);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
page = 0;
|
||||||
|
}
|
||||||
|
Matcher matcher = regexPage.matcher(wy);
|
||||||
|
if (matcher.find()) {
|
||||||
|
//System.out.println("尾页" + matcher.group(1));
|
||||||
|
pageCount = Integer.parseInt(matcher.group(1));
|
||||||
|
} else {
|
||||||
|
pageCount = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONArray videos = new JSONArray();
|
||||||
|
if (!html.contains("没有找到您想要的结果哦")) {
|
||||||
|
// 取当前分类页的视频列表
|
||||||
|
Elements list = doc.select("div.post-box-container");
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
Element vod = list.get(i);
|
||||||
|
String a = vod.selectFirst(".post-box-title a").text();
|
||||||
|
if (a.contains("(")) {
|
||||||
|
String[] item = a.split("\\(");
|
||||||
|
String title = item[0];
|
||||||
|
String remark = item[1].replace(")", "");
|
||||||
|
String cover = doReplaceRegex(m, vod.selectFirst(".post-box-image").attr("style"));
|
||||||
|
|
||||||
|
String id = vod.selectFirst(".post-box-title a").attr("href");
|
||||||
|
JSONObject v = new JSONObject();
|
||||||
|
v.put("vod_id", id);
|
||||||
|
v.put("vod_name", title);
|
||||||
|
v.put("vod_pic", cover);
|
||||||
|
v.put("vod_remarks", remark);
|
||||||
|
videos.put(v);
|
||||||
|
} else {
|
||||||
|
String title = a;
|
||||||
|
String cover = doReplaceRegex(m, vod.selectFirst(".post-box-image").attr("style"));
|
||||||
|
String remark = doReplaceRegex(mark, vod.selectFirst(".post-box-title a").text());
|
||||||
|
Matcher matcher = regexVid.matcher(vod.selectFirst(".post-box-title a").attr("href"));
|
||||||
|
if (!matcher.find()) continue;
|
||||||
|
String id = matcher.group(1);
|
||||||
|
JSONObject v = new JSONObject();
|
||||||
|
v.put("vod_id", id);
|
||||||
|
v.put("vod_name", title);
|
||||||
|
v.put("vod_pic", cover);
|
||||||
|
v.put("vod_remarks", remark);
|
||||||
|
videos.put(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.put("page", page);
|
||||||
|
result.put("pagecount", pageCount);
|
||||||
|
result.put("limit", 24);
|
||||||
|
result.put("total", pageCount <= 1 ? videos.length() : pageCount * 24);
|
||||||
|
|
||||||
|
result.put("list", videos);
|
||||||
|
return result.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频详情信息
|
||||||
|
*
|
||||||
|
* @param ids 视频id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String detailContent(List<String> ids) {
|
||||||
|
try {
|
||||||
|
// 视频详情url
|
||||||
|
String url = ids.get(0);
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(url, getHeaders(url)));
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
JSONObject vodList = new JSONObject();
|
||||||
|
|
||||||
|
// 取基本数据
|
||||||
|
String cover = doc.select("div.post img").attr("src");
|
||||||
|
String ab = doc.select("h1.post-title").text();
|
||||||
|
if (ab.contains("(")) {
|
||||||
|
String[] b = ab.split("\\(");
|
||||||
|
String title = b[0];
|
||||||
|
String remark = b[1].replace("(", "");
|
||||||
|
vodList.put("vod_name", title);
|
||||||
|
vodList.put("vod_remarks", remark);
|
||||||
|
} else {
|
||||||
|
vodList.put("vod_name", ab);
|
||||||
|
String remark = doc.select("time").text().trim();
|
||||||
|
vodList.put("vod_remarks", "全");
|
||||||
|
}
|
||||||
|
String str2 = doc.select("div.abstract").text().replace(" ", "");
|
||||||
|
String replace = str2.replace("<br>", "");
|
||||||
|
String text = replace.replace("<p></p>", "");
|
||||||
|
Pattern categorys = Pattern.compile("类型:(.*)制");
|
||||||
|
String category = doReplaceRegex(categorys, text);
|
||||||
|
Pattern a = Pattern.compile("年份:(.*)简");
|
||||||
|
String year = doReplaceRegex(a, text);
|
||||||
|
Pattern b = Pattern.compile("地区:(.*)年份");
|
||||||
|
String area = doReplaceRegex(b, text);
|
||||||
|
Pattern c = Pattern.compile("演员:(.*)类");
|
||||||
|
String actor = doReplaceRegex(c, text);
|
||||||
|
Pattern d = Pattern.compile("导演:(.*)演");
|
||||||
|
String director = doReplaceRegex(d, text);
|
||||||
|
Pattern e = Pattern.compile("简介:(.*)");
|
||||||
|
String desc = doReplaceRegex(e, text);
|
||||||
|
|
||||||
|
|
||||||
|
vodList.put("vod_id", ids.get(0));
|
||||||
|
vodList.put("vod_pic", cover);
|
||||||
|
vodList.put("type_name", category);
|
||||||
|
vodList.put("vod_year", year);
|
||||||
|
vodList.put("vod_area", area);
|
||||||
|
vodList.put("vod_actor", actor);
|
||||||
|
vodList.put("vod_director", director);
|
||||||
|
vodList.put("vod_content", desc);
|
||||||
|
|
||||||
|
List<String> vodItems = new ArrayList<>();
|
||||||
|
List<String> vodItems2 = new ArrayList<>();
|
||||||
|
Map<String, String> vod_play = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
Elements allScript = doc.select(".wp-playlist-script");
|
||||||
|
String sourceName = "第1季";
|
||||||
|
for (int j = 0; j < allScript.size(); j++) {
|
||||||
|
String scContent = allScript.get(j).html().trim();
|
||||||
|
int start = scContent.indexOf('{');
|
||||||
|
int end = scContent.lastIndexOf('}') + 1;
|
||||||
|
String json = scContent.substring(start, end);
|
||||||
|
JSONObject UJson = new JSONObject(json);
|
||||||
|
JSONArray Track = UJson.getJSONArray("tracks");
|
||||||
|
for (int k = 0; k < Track.length(); k++) {
|
||||||
|
JSONObject src = Track.getJSONObject(k);
|
||||||
|
String adk = src.getString("src1");
|
||||||
|
String vodName = src.getString("caption");
|
||||||
|
String playURL = siteUrl + "/getvddr/video?id=" + adk + "&type=mix";
|
||||||
|
String zm = siteUrl + "/subddr/" + src.getString("subsrc");
|
||||||
|
String pzm = playURL + "|" + zm;
|
||||||
|
vodItems.add(vodName + "$" + pzm);
|
||||||
|
}
|
||||||
|
vod_play.put(sourceName, TextUtils.join("#", vodItems));
|
||||||
|
}
|
||||||
|
Elements sources = doc.select(".post-page-numbers");
|
||||||
|
if (!sources.isEmpty()) for (int i = 0; i < sources.size(); i++) {
|
||||||
|
Element source = sources.get(i);
|
||||||
|
sourceName = "第" + source.text() + "季";
|
||||||
|
String Purl = siteUrl + "/" + ids.get(0) + "/" + source.text() + "/";
|
||||||
|
Document docs = Jsoup.parse(OkHttp.string(Purl, getHeaders(Purl)));
|
||||||
|
Elements allScripts = docs.select(".wp-playlist-script");
|
||||||
|
for (int j = 0; j < allScripts.size(); j++) {
|
||||||
|
String scContent = allScripts.get(j).html().trim();
|
||||||
|
int start = scContent.indexOf('{');
|
||||||
|
int end = scContent.lastIndexOf('}') + 1;
|
||||||
|
String json = scContent.substring(start, end);
|
||||||
|
JSONObject UJson = new JSONObject(json);
|
||||||
|
JSONArray Track = UJson.getJSONArray("tracks");
|
||||||
|
for (int k = 0; k < Track.length(); k++) {
|
||||||
|
JSONObject src = Track.getJSONObject(k);
|
||||||
|
String adk = src.getString("src1");
|
||||||
|
String vodName = src.getString("caption");
|
||||||
|
String playURL = siteUrl + "/getvddr/video?id=" + adk + "&type=mix";
|
||||||
|
String zm = siteUrl + "/subddr/" + src.getString("subsrc");
|
||||||
|
String pzm = playURL + "|" + zm;
|
||||||
|
vodItems2.add(vodName + "$" + pzm);
|
||||||
|
}
|
||||||
|
vod_play.put(sourceName, TextUtils.join("#", vodItems2));
|
||||||
|
}
|
||||||
|
vodItems2.removeAll(vodItems2);
|
||||||
|
}
|
||||||
|
|
||||||
|
String vod_play_from = TextUtils.join("$$$", vod_play.keySet());
|
||||||
|
String vod_play_url = TextUtils.join("$$$", vod_play.values());
|
||||||
|
vodList.put("vod_play_from", vod_play_from);
|
||||||
|
vodList.put("vod_play_url", vod_play_url);
|
||||||
|
|
||||||
|
JSONArray list = new JSONArray();
|
||||||
|
list.put(vodList);
|
||||||
|
result.put("list", list);
|
||||||
|
return result.toString();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取视频播放信息
|
||||||
|
*
|
||||||
|
* @param flag 播放源
|
||||||
|
* @param id 视频id
|
||||||
|
* @param vipFlags 所有可能需要vip解析的源
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||||
|
|
||||||
|
String[] item = id.split("\\|");
|
||||||
|
String playUrl = item[0];
|
||||||
|
String ZiMu = item[1];
|
||||||
|
|
||||||
|
String content = OkHttp.string(playUrl, getHeaders(playUrl));
|
||||||
|
|
||||||
|
String RealUrl = "";
|
||||||
|
String regex = "\"src0\":\"(.*?)\",";
|
||||||
|
|
||||||
|
Pattern pattern = Pattern.compile(regex);
|
||||||
|
Matcher matcher = pattern.matcher(content);
|
||||||
|
if (matcher.find()) {
|
||||||
|
RealUrl = matcher.group(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.get().url(siteUrl + RealUrl.replace("\\/", "/")).header(Headers()).string();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String searchContent(String key, boolean quick) {
|
||||||
|
|
||||||
|
String url = "https://ddys.pro/?s=" + URLEncoder.encode(key) + "&post_type=post";
|
||||||
|
Document doc = Jsoup.parse(OkHttp.string(url, getHeaders(url)));
|
||||||
|
List<Vod> vods = new ArrayList<>();
|
||||||
|
Elements elements = doc.select("h2.post-title > a");
|
||||||
|
for (int i = 0; i < elements.size(); i++) {
|
||||||
|
String id = elements.get(i).attr("href");
|
||||||
|
String name = elements.get(i).text();
|
||||||
|
vods.add(new Vod(id, name, ""));
|
||||||
|
}
|
||||||
|
return Result.string(vods);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String doReplaceRegex(Pattern pattern, String src) {
|
||||||
|
if (pattern == null) return src;
|
||||||
|
try {
|
||||||
|
Matcher matcher = pattern.matcher(src);
|
||||||
|
if (matcher.find()) {
|
||||||
|
return matcher.group(1).trim();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
|
}
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
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;
|
||||||
|
import org.robolectric.RuntimeEnvironment;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
public class DdrkTest {
|
||||||
|
// @Mock
|
||||||
|
private Application mockContext;
|
||||||
|
|
||||||
|
private Ddrk spider;
|
||||||
|
|
||||||
|
@org.junit.Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
mockContext = RuntimeEnvironment.application;
|
||||||
|
Init.init(mockContext);
|
||||||
|
spider = new Ddrk();
|
||||||
|
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("drama/western-drama", "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("https://ddys.pro/the-fable/"));
|
||||||
|
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 = "第1季";
|
||||||
|
String urls = "第01集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfOrVlYXtr0IrFW8lVeTT91H%2BUSu5z72Gkx6JAGA8EXlJLvetAfVTXXDhxuKCGJ6Q3Ngws821BcBwndpb%2B2GPjbo%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E01.ddr#第02集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfML0vn1KlTxF0sG%2BEHO21R1cpLbSt%2BXLLxl1R4ROccMqgxKrfB%2BNEqcywjLdgdnFeNOYu8Jp86q1LceYrzyfRNA%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E02.ddr#第03集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfLSbJjBcNaYf0d9KYtSt4Dc4guy5jGVmk1NGoRUN%2FTKNo3wIPi9zaht0T3iaVrIG9aowYlrg4M3ZhF5tpKa5a3Q%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E03.ddr#第04集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfOhtDTTFt4SsSqDAXc29K%2FjRaWjRW4rFJYEkL3dGQ8lunDdVoVDCdwLM3MRdkE5GKZiwJnFV4yokt%2FJTlu6W9B0%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E04.ddr#第05集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfOekWLffYiwPueR2d%2F2jlsdoB2MFrn7KZ7RZxnTO2Cl79FQ6JxdhLFZVKQMUfXjl61OPbX6mB2pwuMC8EZDTZM0%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E05.ddr#第06集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfBlB%2BSpxUCnlGPrINcu%2F1SBXw9E48vZepi2rbznJEL%2B7KaG%2FemNxcMt6i2tonlv%2Fj7Yiciu6%2FJp%2FnYHm9azBMMg%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E06.ddr#第07集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfA3oc9ABVnVTvqzAM188IauJwfyfj0mjiLGQipukzelI2Q3Wr%2F8jwBx1eB8yXqjb8GyGOSE4HjylzNNZEeNIPOE%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E07.ddr#第08集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfJOKQJ6QC7TwGBw%2B7XCHqWtRHmOW78EwIA2WdpWoLK6LZMorbbBF7F8CY0%2F8%2BybxkKutVTxcbwJHLYeq5KfaWXE%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E08.ddr#第09集$https://ddys.pro/getvddr/video?id\u003dKqivU7FCez3AzaByqNMjDfGnF9itLkgWcRnE0NAeMTe7Z8DVPXWR%2FJvYQBGf52fOhv3jBlQ5LihxM6O5JO%2FANOmvP8XvKojMNTHvRaasviQ%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E09.ddr#第10集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfFuxdVAN%2F0ZWpHmPYouX2tGpQafvtO9opv55jVEdqxgnUQwDcXdACwZgP4oMbk0O41aQjab0YOv7F6a2%2BcyCxfk%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E10.ddr#第11集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfB7AzCUzGnvni8EaQgDUAeruvMOEP%2By29vrNL0bgRjV9I4o2IIifgYqTV8EVqhjFogonUNDLNcMFJ5w408hLH3k%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E11.ddr#第12集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfNEKVB%2FplZ4P8g2xyropO3Y344w4x0tjIUr6ZONvPl8QALRIdahfpQFpp5qbK4ufOGYGLHq6zXREpfmhWe0HAkI%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E12.ddr#第13集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfBFMTt9r5WqhZpmc4QQgU0iRjSqc8YQDAEEFCzIar44C%2FwGy4p9PfsBWfynJpu42%2BRv4DgCcpqB%2BXLsv8X24NDQ%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E13.ddr#第14集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfNSmR2YMg3lNOPuwjam%2BOxI4BpWDMdwFRRHLh4PixAzLN5296mDjoA763gkjeEDNYsn6HIU597ge05ZI%2BgWizC8%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E14.ddr#第15集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfI4TiWm%2FCMVOWx2lxRgpl%2BVtwmPeyHyP%2FtdIdfekVgRV69u4HkYZYbLrCHFMLabFTSn3jdgVM5TyCIjypo9O%2F0E%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E15.ddr#第16集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfMieUkuUIEB34HJ4yRt0c18%2F%2BfEyUXCCGYReb9sKVXc8X%2FfcV1nHUDLMb9HeDSZSuf14zDDFEk9DHQNpUgvFa8A%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E16.ddr#第17集$https://ddys.pro/getvddr/video?id\u003dfBG%2Flj6cvF9dk4FfQ5csfKeqB9W4XjNkL%2FsKDi7jnfOhHRtJsT4E1o9nXo8o28wnphO1591NKKbPAWn8Sf%2FFcmrKbymYzH4wwwzlKCL1IQY%3D\u0026type\u003dmix|https://ddys.pro/subddr//v/Anime/The_Fable/The_Fable_S01E17.ddr";
|
||||||
|
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<>());
|
||||||
|
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 @@
|
||||||
e3bc7843d766de40c20a38dd72c989cd
|
10c3ce1b9c5b8dd9f5d3ef1b88f42f19
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "../jar/custom_spider.jar;md5;e3bc7843d766de40c20a38dd72c989cd",
|
"spider": "../jar/custom_spider.jar;md5;10c3ce1b9c5b8dd9f5d3ef1b88f42f19",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "直播ipv6",
|
"name": "直播ipv6",
|
||||||
|
|
@ -127,6 +127,14 @@
|
||||||
"searchable": 1,
|
"searchable": 1,
|
||||||
"filterable": 0,
|
"filterable": 0,
|
||||||
"ext": "https://www.libvio.app"
|
"ext": "https://www.libvio.app"
|
||||||
|
}, {
|
||||||
|
"key": "Ddrk",
|
||||||
|
"name": "低端影视",
|
||||||
|
"type": 3,
|
||||||
|
"api": "csp_Ddrk",
|
||||||
|
"searchable": 1,
|
||||||
|
"filterable": 0
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "Ysj",
|
"key": "Ysj",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue