This commit is contained in:
GH Action - Upstream Sync 2023-02-16 01:38:40 +00:00
commit 9eaffefb11
8 changed files with 1015 additions and 340 deletions

View File

@ -3,11 +3,14 @@ package com.github.catvod.spider;
import android.content.Context;
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.bean.xpath.Rule;
import com.github.catvod.crawler.Spider;
import com.github.catvod.crawler.SpiderDebug;
import com.github.catvod.net.OkHttp;
import com.github.catvod.utils.Trans;
import com.github.catvod.utils.Utils;
import org.json.JSONArray;
@ -23,6 +26,12 @@ import java.util.Set;
public class XPath extends Spider {
private HashMap<String, String> getHeaders() {
HashMap<String, String> headers = new HashMap<>();
headers.put("User-Agent", rule.getUa().isEmpty() ? Utils.CHROME : rule.getUa());
return headers;
}
@Override
public void init(Context context) {
super.init(context);
@ -35,97 +44,50 @@ public class XPath extends Spider {
@Override
public String homeContent(boolean filter) {
try {
fetchRule();
JSONObject result = new JSONObject();
JSONArray classes = new JSONArray();
if (rule.getCateManual().size() > 0) {
Set<String> keys = rule.getCateManual().keySet();
for (String k : keys) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("type_name", k);
jsonObject.put("type_id", rule.getCateManual().get(k));
classes.put(jsonObject);
}
fetchRule();
List<Vod> list = new ArrayList<>();
List<Class> classes = new ArrayList<>();
if (rule.getCateManual().size() > 0) {
Set<String> keys = rule.getCateManual().keySet();
for (String k : keys) {
classes.add(new Class(rule.getCateManual().get(k), k));
}
try {
String webUrl = rule.getHomeUrl();
JXDocument doc = JXDocument.create(fetch(webUrl));
if (rule.getCateManual().size() == 0) {
List<JXNode> navNodes = doc.selN(rule.getCateNode());
for (int i = 0; i < navNodes.size(); i++) {
String name = navNodes.get(i).selOne(rule.getCateName()).asString().trim();
name = rule.getCateNameR(name);
String id = navNodes.get(i).selOne(rule.getCateId()).asString().trim();
id = rule.getCateIdR(id);
JSONObject jsonObject = new JSONObject();
jsonObject.put("type_id", id);
jsonObject.put("type_name", name);
classes.put(jsonObject);
}
}
if (!rule.getHomeVodNode().isEmpty()) {
}
String webUrl = rule.getHomeUrl();
JXDocument doc = JXDocument.create(fetch(webUrl));
if (rule.getCateManual().size() == 0) {
List<JXNode> navNodes = doc.selN(rule.getCateNode());
for (int i = 0; i < navNodes.size(); i++) {
String name = navNodes.get(i).selOne(rule.getCateName()).asString().trim();
name = rule.getCateNameR(name);
String id = navNodes.get(i).selOne(rule.getCateId()).asString().trim();
id = rule.getCateIdR(id);
classes.add(new Class(id, name));
}
}
if (!rule.getHomeVodNode().isEmpty()) {
List<JXNode> vodNodes = doc.selN(rule.getHomeVodNode());
for (int i = 0; i < vodNodes.size(); i++) {
String name = vodNodes.get(i).selOne(rule.getHomeVodName()).asString().trim();
name = rule.getHomeVodNameR(name);
String id = vodNodes.get(i).selOne(rule.getHomeVodId()).asString().trim();
id = rule.getHomeVodIdR(id);
String pic = vodNodes.get(i).selOne(rule.getHomeVodImg()).asString().trim();
pic = rule.getHomeVodImgR(pic);
pic = Utils.fixUrl(webUrl, pic);
String mark = "";
if (!rule.getHomeVodMark().isEmpty()) {
try {
JSONArray videos = new JSONArray();
List<JXNode> vodNodes = doc.selN(rule.getHomeVodNode());
for (int i = 0; i < vodNodes.size(); i++) {
String name = vodNodes.get(i).selOne(rule.getHomeVodName()).asString().trim();
name = rule.getHomeVodNameR(name);
String id = vodNodes.get(i).selOne(rule.getHomeVodId()).asString().trim();
id = rule.getHomeVodIdR(id);
String pic = vodNodes.get(i).selOne(rule.getHomeVodImg()).asString().trim();
pic = rule.getHomeVodImgR(pic);
pic = Utils.fixUrl(webUrl, pic);
String mark = "";
if (!rule.getHomeVodMark().isEmpty()) {
try {
mark = vodNodes.get(i).selOne(rule.getHomeVodMark()).asString().trim();
mark = rule.getHomeVodMarkR(mark);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
JSONObject v = new JSONObject();
v.put("vod_id", id);
v.put("vod_name", name);
v.put("vod_pic", pic);
v.put("vod_remarks", mark);
videos.put(v);
}
result.put("list", videos);
mark = vodNodes.get(i).selOne(rule.getHomeVodMark()).asString().trim();
mark = rule.getHomeVodMarkR(mark);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
} catch (Exception e) {
SpiderDebug.log(e);
list.add(new Vod(id, name, pic, mark));
}
result.put("class", classes);
if (filter && rule.getFilter() != null) {
result.put("filters", rule.getFilter());
}
return result.toString();
} catch (
Exception e) {
SpiderDebug.log(e);
}
return "";
}
protected HashMap<String, String> getHeaders() {
HashMap<String, String> headers = new HashMap<>();
headers.put("User-Agent", rule.getUa().isEmpty() ? "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36" : rule.getUa());
return headers;
}
@Override
public String homeVideoContent() {
try {
fetchRule();
} catch (Exception e) {
SpiderDebug.log(e);
}
return "";
return Result.string(classes, list, rule.getFilter());
}
protected String categoryUrl(String tid, String pg, boolean filter, HashMap<String, String> extend) {
@ -134,190 +96,154 @@ public class XPath extends Spider {
@Override
public String categoryContent(String tid, String pg, boolean filter, HashMap<String, String> extend) {
try {
fetchRule();
String webUrl = categoryUrl(tid, pg, filter, extend);
JSONArray videos = new JSONArray();
JXDocument doc = JXDocument.create(fetch(webUrl));
List<JXNode> vodNodes = doc.selN(rule.getCateVodNode());
for (int i = 0; i < vodNodes.size(); i++) {
String name = vodNodes.get(i).selOne(rule.getCateVodName()).asString().trim();
name = rule.getCateVodNameR(name);
String id = vodNodes.get(i).selOne(rule.getCateVodId()).asString().trim();
id = rule.getCateVodIdR(id);
String pic = vodNodes.get(i).selOne(rule.getCateVodImg()).asString().trim();
pic = rule.getCateVodImgR(pic);
pic = Utils.fixUrl(webUrl, pic);
String mark = "";
if (!rule.getCateVodMark().isEmpty()) {
try {
mark = vodNodes.get(i).selOne(rule.getCateVodMark()).asString().trim();
mark = rule.getCateVodMarkR(mark);
} catch (Exception e) {
SpiderDebug.log(e);
}
fetchRule();
List<Vod> list = new ArrayList<>();
String webUrl = categoryUrl(tid, pg, filter, extend);
JXDocument doc = JXDocument.create(fetch(webUrl));
List<JXNode> vodNodes = doc.selN(rule.getCateVodNode());
for (int i = 0; i < vodNodes.size(); i++) {
String name = vodNodes.get(i).selOne(rule.getCateVodName()).asString().trim();
name = rule.getCateVodNameR(name);
String id = vodNodes.get(i).selOne(rule.getCateVodId()).asString().trim();
id = rule.getCateVodIdR(id);
String pic = vodNodes.get(i).selOne(rule.getCateVodImg()).asString().trim();
pic = rule.getCateVodImgR(pic);
pic = Utils.fixUrl(webUrl, pic);
String mark = "";
if (!rule.getCateVodMark().isEmpty()) {
try {
mark = vodNodes.get(i).selOne(rule.getCateVodMark()).asString().trim();
mark = rule.getCateVodMarkR(mark);
} catch (Exception e) {
SpiderDebug.log(e);
}
JSONObject v = new JSONObject();
v.put("vod_id", id);
v.put("vod_name", name);
v.put("vod_pic", pic);
v.put("vod_remarks", mark);
videos.put(v);
}
JSONObject result = new JSONObject();
result.put("page", pg);
result.put("pagecount", Integer.MAX_VALUE);
result.put("limit", 90);
result.put("total", Integer.MAX_VALUE);
result.put("list", videos);
return result.toString();
} catch (Exception e) {
SpiderDebug.log(e);
list.add(new Vod(id, name, pic, mark));
}
return "";
return Result.string(list);
}
@Override
public String detailContent(List<String> ids) {
try {
fetchRule();
String webUrl = rule.getDetailUrl().replace("{vid}", ids.get(0));
String webContent = fetch(webUrl);
JXDocument doc = JXDocument.create(webContent);
JXNode vodNode = doc.selNOne(rule.getDetailNode());
String cover = "", title = "", desc = "", category = "", area = "", year = "", remark = "", director = "", actor = "";
title = vodNode.selOne(rule.getDetailName()).asString().trim();
title = rule.getDetailNameR(title);
cover = vodNode.selOne(rule.getDetailImg()).asString().trim();
cover = rule.getDetailImgR(cover);
cover = Utils.fixUrl(webUrl, cover);
if (!rule.getDetailCate().isEmpty()) {
try {
category = vodNode.selOne(rule.getDetailCate()).asString().trim();
category = rule.getDetailCateR(category);
} catch (Exception e) {
SpiderDebug.log(e);
}
fetchRule();
String webUrl = rule.getDetailUrl().replace("{vid}", ids.get(0));
String webContent = fetch(webUrl);
JXDocument doc = JXDocument.create(webContent);
JXNode vodNode = doc.selNOne(rule.getDetailNode());
String cover = "", title = "", desc = "", category = "", area = "", year = "", remark = "", director = "", actor = "";
title = vodNode.selOne(rule.getDetailName()).asString().trim();
title = rule.getDetailNameR(title);
cover = vodNode.selOne(rule.getDetailImg()).asString().trim();
cover = rule.getDetailImgR(cover);
cover = Utils.fixUrl(webUrl, cover);
if (!rule.getDetailCate().isEmpty()) {
try {
category = vodNode.selOne(rule.getDetailCate()).asString().trim();
category = rule.getDetailCateR(category);
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!rule.getDetailYear().isEmpty()) {
try {
year = vodNode.selOne(rule.getDetailYear()).asString().trim();
year = rule.getDetailYearR(year);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
if (!rule.getDetailYear().isEmpty()) {
try {
year = vodNode.selOne(rule.getDetailYear()).asString().trim();
year = rule.getDetailYearR(year);
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!rule.getDetailArea().isEmpty()) {
try {
area = vodNode.selOne(rule.getDetailArea()).asString().trim();
area = rule.getDetailAreaR(area);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
if (!rule.getDetailArea().isEmpty()) {
try {
area = vodNode.selOne(rule.getDetailArea()).asString().trim();
area = rule.getDetailAreaR(area);
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!rule.getDetailMark().isEmpty()) {
try {
remark = vodNode.selOne(rule.getDetailMark()).asString().trim();
remark = rule.getDetailMarkR(remark);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
if (!rule.getDetailMark().isEmpty()) {
try {
remark = vodNode.selOne(rule.getDetailMark()).asString().trim();
remark = rule.getDetailMarkR(remark);
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!rule.getDetailActor().isEmpty()) {
try {
actor = vodNode.selOne(rule.getDetailActor()).asString().trim();
actor = rule.getDetailActorR(actor);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
if (!rule.getDetailActor().isEmpty()) {
try {
actor = vodNode.selOne(rule.getDetailActor()).asString().trim();
actor = rule.getDetailActorR(actor);
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!rule.getDetailDirector().isEmpty()) {
try {
director = vodNode.selOne(rule.getDetailDirector()).asString().trim();
director = rule.getDetailDirectorR(director);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
if (!rule.getDetailDirector().isEmpty()) {
try {
director = vodNode.selOne(rule.getDetailDirector()).asString().trim();
director = rule.getDetailDirectorR(director);
} catch (Exception e) {
SpiderDebug.log(e);
}
if (!rule.getDetailDesc().isEmpty()) {
try {
desc = vodNode.selOne(rule.getDetailDesc()).asString().trim();
desc = rule.getDetailDescR(desc);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
if (!rule.getDetailDesc().isEmpty()) {
try {
desc = vodNode.selOne(rule.getDetailDesc()).asString().trim();
desc = rule.getDetailDescR(desc);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
JSONObject vod = new JSONObject();
vod.put("vod_id", ids.get(0));
vod.put("vod_name", title);
vod.put("vod_pic", cover);
vod.put("type_name", category);
vod.put("vod_year", year);
vod.put("vod_area", area);
vod.put("vod_remarks", remark);
vod.put("vod_actor", actor);
vod.put("vod_director", director);
vod.put("vod_content", desc);
Vod vod = new Vod();
vod.setVodId(ids.get(0));
vod.setVodName(title);
vod.setVodPic(cover);
vod.setTypeName(category);
vod.setVodYear(year);
vod.setVodArea(area);
vod.setVodRemarks(remark);
vod.setVodActor(actor);
vod.setVodDirector(director);
vod.setVodContent(desc);
ArrayList<String> playFrom = new ArrayList<>();
ArrayList<String> playFrom = new ArrayList<>();
List<JXNode> fromNodes = doc.selN(rule.getDetailFromNode());
for (int i = 0; i < fromNodes.size(); i++) {
String name = fromNodes.get(i).selOne(rule.getDetailFromName()).asString().trim();
name = rule.getDetailFromNameR(name);
playFrom.add(name);
}
List<JXNode> fromNodes = doc.selN(rule.getDetailFromNode());
for (int i = 0; i < fromNodes.size(); i++) {
String name = fromNodes.get(i).selOne(rule.getDetailFromName()).asString().trim();
name = rule.getDetailFromNameR(name);
playFrom.add(name);
}
ArrayList<String> playList = new ArrayList<>();
List<JXNode> urlListNodes = doc.selN(rule.getDetailUrlNode());
for (int i = 0; i < urlListNodes.size(); i++) {
List<JXNode> urlNodes = urlListNodes.get(i).sel(rule.getDetailUrlSubNode());
List<String> vodItems = new ArrayList<>();
for (int j = 0; j < urlNodes.size(); j++) {
String name = urlNodes.get(j).selOne(rule.getDetailUrlName()).asString().trim();
name = rule.getDetailUrlNameR(name);
String id = urlNodes.get(j).selOne(rule.getDetailUrlId()).asString().trim();
id = rule.getDetailUrlIdR(id);
vodItems.add(name + "$" + id);
}
// 排除播放列表為空的播放源
if (vodItems.size() == 0 && playFrom.size() > i) {
playFrom.set(i, "");
}
playList.add(TextUtils.join("#", vodItems));
ArrayList<String> playList = new ArrayList<>();
List<JXNode> urlListNodes = doc.selN(rule.getDetailUrlNode());
for (int i = 0; i < urlListNodes.size(); i++) {
List<JXNode> urlNodes = urlListNodes.get(i).sel(rule.getDetailUrlSubNode());
List<String> vodItems = new ArrayList<>();
for (int j = 0; j < urlNodes.size(); j++) {
String name = urlNodes.get(j).selOne(rule.getDetailUrlName()).asString().trim();
name = rule.getDetailUrlNameR(name);
String id = urlNodes.get(j).selOne(rule.getDetailUrlId()).asString().trim();
id = rule.getDetailUrlIdR(id);
vodItems.add(Trans.get(name) + "$" + id);
}
// 排除播放列表為空的播放源
for (int i = playFrom.size() - 1; i >= 0; i--) {
if (playFrom.get(i).isEmpty())
playFrom.remove(i);
if (vodItems.size() == 0 && playFrom.size() > i) {
playFrom.set(i, "");
}
for (int i = playList.size() - 1; i >= 0; i--) {
if (playList.get(i).isEmpty())
playList.remove(i);
}
for (int i = playList.size() - 1; i >= 0; i--) {
if (i >= playFrom.size())
playList.remove(i);
}
String vod_play_from = TextUtils.join("$$$", playFrom);
String vod_play_url = TextUtils.join("$$$", playList);
vod.put("vod_play_from", vod_play_from);
vod.put("vod_play_url", vod_play_url);
JSONObject result = new JSONObject();
JSONArray list = new JSONArray();
list.put(vod);
result.put("list", list);
return result.toString();
} catch (Exception e) {
SpiderDebug.log(e);
playList.add(TextUtils.join("#", vodItems));
}
return "";
// 排除播放列表為空的播放源
for (int i = playFrom.size() - 1; i >= 0; i--) {
if (playFrom.get(i).isEmpty()) playFrom.remove(i);
}
for (int i = playList.size() - 1; i >= 0; i--) {
if (playList.get(i).isEmpty()) playList.remove(i);
}
for (int i = playList.size() - 1; i >= 0; i--) {
if (i >= playFrom.size()) playList.remove(i);
}
vod.setVodPlayFrom(TextUtils.join("$$$", playFrom));
vod.setVodPlayUrl(TextUtils.join("$$$", playList));
return Result.string(vod);
}
@Override
@ -332,79 +258,59 @@ public class XPath extends Spider {
}
@Override
public String searchContent(String key, boolean quick) {
try {
fetchRule();
if (rule.getSearchUrl().isEmpty()) {
return "";
}
String webUrl = rule.getSearchUrl().replace("{wd}", URLEncoder.encode(key));
String webContent = fetch(webUrl);
JSONObject result = new JSONObject();
JSONArray videos = new JSONArray();
if (rule.getSearchVodNode().startsWith("json:")) {
String[] node = rule.getSearchVodNode().substring(5).split(">");
JSONObject data = new JSONObject(webContent);
for (int i = 0; i < node.length; i++) {
if (i == node.length - 1) {
JSONArray vodArray = data.getJSONArray(node[i]);
for (int j = 0; j < vodArray.length(); j++) {
JSONObject vod = vodArray.getJSONObject(j);
String name = vod.optString(rule.getSearchVodName()).trim();
name = rule.getSearchVodNameR(name);
String id = vod.optString(rule.getSearchVodId()).trim();
id = rule.getSearchVodIdR(id);
String pic = vod.optString(rule.getSearchVodImg()).trim();
pic = rule.getSearchVodImgR(pic);
pic = Utils.fixUrl(webUrl, pic);
String mark = vod.optString(rule.getSearchVodMark()).trim();
mark = rule.getSearchVodMarkR(mark);
JSONObject v = new JSONObject();
v.put("vod_id", id);
v.put("vod_name", name);
v.put("vod_pic", pic);
v.put("vod_remarks", mark);
videos.put(v);
}
} else {
data = data.getJSONObject(node[i]);
public String searchContent(String key, boolean quick) throws Exception {
fetchRule();
if (rule.getSearchUrl().isEmpty()) return "";
String webUrl = rule.getSearchUrl().replace("{wd}", URLEncoder.encode(key));
String webContent = fetch(webUrl);
List<Vod> list = new ArrayList<>();
if (rule.getSearchVodNode().startsWith("json:")) {
String[] node = rule.getSearchVodNode().substring(5).split(">");
JSONObject data = new JSONObject(webContent);
for (int i = 0; i < node.length; i++) {
if (i == node.length - 1) {
JSONArray vodArray = data.getJSONArray(node[i]);
for (int j = 0; j < vodArray.length(); j++) {
JSONObject vod = vodArray.getJSONObject(j);
String name = vod.optString(rule.getSearchVodName()).trim();
name = rule.getSearchVodNameR(name);
String id = vod.optString(rule.getSearchVodId()).trim();
id = rule.getSearchVodIdR(id);
String pic = vod.optString(rule.getSearchVodImg()).trim();
pic = rule.getSearchVodImgR(pic);
pic = Utils.fixUrl(webUrl, pic);
String mark = vod.optString(rule.getSearchVodMark()).trim();
mark = rule.getSearchVodMarkR(mark);
list.add(new Vod(id, name, pic, mark));
}
}
} else {
JXDocument doc = JXDocument.create(webContent);
List<JXNode> vodNodes = doc.selN(rule.getSearchVodNode());
for (int i = 0; i < vodNodes.size(); i++) {
String name = vodNodes.get(i).selOne(rule.getSearchVodName()).asString().trim();
name = rule.getSearchVodNameR(name);
String id = vodNodes.get(i).selOne(rule.getSearchVodId()).asString().trim();
id = rule.getSearchVodIdR(id);
String pic = vodNodes.get(i).selOne(rule.getSearchVodImg()).asString().trim();
pic = rule.getSearchVodImgR(pic);
pic = Utils.fixUrl(webUrl, pic);
String mark = "";
if (!rule.getCateVodMark().isEmpty()) {
try {
mark = vodNodes.get(i).selOne(rule.getSearchVodMark()).asString().trim();
mark = rule.getSearchVodMarkR(mark);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
JSONObject v = new JSONObject();
v.put("vod_id", id);
v.put("vod_name", name);
v.put("vod_pic", pic);
v.put("vod_remarks", mark);
videos.put(v);
} else {
data = data.getJSONObject(node[i]);
}
}
result.put("list", videos);
return result.toString();
} catch (
Exception e) {
SpiderDebug.log(e);
} else {
JXDocument doc = JXDocument.create(webContent);
List<JXNode> vodNodes = doc.selN(rule.getSearchVodNode());
for (int i = 0; i < vodNodes.size(); i++) {
String name = vodNodes.get(i).selOne(rule.getSearchVodName()).asString().trim();
name = rule.getSearchVodNameR(name);
String id = vodNodes.get(i).selOne(rule.getSearchVodId()).asString().trim();
id = rule.getSearchVodIdR(id);
String pic = vodNodes.get(i).selOne(rule.getSearchVodImg()).asString().trim();
pic = rule.getSearchVodImgR(pic);
pic = Utils.fixUrl(webUrl, pic);
String mark = "";
if (!rule.getCateVodMark().isEmpty()) {
try {
mark = vodNodes.get(i).selOne(rule.getSearchVodMark()).asString().trim();
mark = rule.getSearchVodMarkR(mark);
} catch (Exception e) {
SpiderDebug.log(e);
}
}
list.add(new Vod(id, name, pic, mark));
}
}
return "";
return Result.string(list);
}
@Override
@ -412,20 +318,9 @@ public class XPath extends Spider {
return false;
}
private final String[] videoFormatList = new String[]{".m3u8", ".mp4", ".mpeg", ".flv"};
@Override
public boolean isVideoFormat(String url) {
url = url.toLowerCase();
if (url.contains("=http") || url.contains("=https") || url.contains("=https%3a%2f") || url.contains("=http%3a%2f")) {
return false;
}
for (String format : videoFormatList) {
if (url.contains(format)) {
return true;
}
}
return false;
return Utils.isVideoFormat(url);
}
protected String ext = null;
@ -447,7 +342,6 @@ public class XPath extends Spider {
}
protected void loadRuleExt(String json) {
}
protected String fetch(String webUrl) {

View File

@ -5,6 +5,7 @@ import android.text.TextUtils;
import android.util.Base64;
import com.github.catvod.crawler.SpiderDebug;
import com.github.catvod.utils.Trans;
import com.github.catvod.utils.Utils;
import com.google.gson.Gson;
@ -32,7 +33,7 @@ public class XPathMac extends XPath {
// 播放器配置js取值正則
private String playerConfigJsRegex = "[\\W|\\S|.]*?MacPlayerConfig.player_list[\\W|\\S|.]*?=([\\W|\\S|.]*?),MacPlayerConfig.downer_list";
// 站點里播放源對應的真實官源
private HashMap<String, String> show2VipFlag = new HashMap<>();
private final HashMap<String, String> show2VipFlag = new HashMap<>();
/**
* mac cms 直連和官源調用應用內播放列表支持
@ -55,7 +56,7 @@ public class XPathMac extends XPath {
Iterator<String> keys = dcShow2Vip.keys();
while (keys.hasNext()) {
String name = keys.next();
show2VipFlag.put(name.trim(), dcShow2Vip.getString(name).trim());
show2VipFlag.put(Trans.get(name.trim()), dcShow2Vip.getString(name).trim());
}
}
playerConfigJs = jsonObj.optString("pCfgJs").trim();
@ -78,18 +79,15 @@ public class XPathMac extends XPath {
while (keys.hasNext()) {
String key = keys.next();
JSONObject keyObj = jsonObject.optJSONObject(key);
if (keyObj == null)
continue;
if (keyObj == null) continue;
String show = keyObj.optString("show").trim();
if (show.isEmpty())
continue;
show2VipFlag.put(show, key);
if (show.isEmpty()) continue;
show2VipFlag.put(Trans.get(show), key);
}
} catch (Exception e) {
SpiderDebug.log(e);
}
}
// SpiderDebug.log(webContent);
}
return result;
}
@ -100,7 +98,7 @@ public class XPathMac extends XPath {
if (decodeVipFlag && result.length() > 0) {
try {
JSONObject jsonObject = new JSONObject(result);
String playFrom[] = jsonObject.optJSONArray("list").getJSONObject(0).optString("vod_play_from").split("\\$\\$\\$");
String[] playFrom = jsonObject.optJSONArray("list").getJSONObject(0).optString("vod_play_from").split("\\$\\$\\$");
if (playFrom.length > 0) {
for (int i = 0; i < playFrom.length; i++) {
if (show2VipFlag.containsKey(playFrom[i])) {

View File

@ -30,6 +30,7 @@ public class Utils {
}
public static boolean isVideoFormat(String url) {
if (url.contains("url=http") || url.contains(".js") || url.contains(".css") || url.contains(".html")) return false;
return Sniffer.RULE.matcher(url).find();
}

Binary file not shown.

View File

@ -1 +1 @@
5115b919853874c483c641dbfdf2b667
c8bba231546a63b3431cf31e5d856794

View File

@ -1,5 +1,5 @@
{
"spider": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;5115b919853874c483c641dbfdf2b667",
"spider": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;c8bba231546a63b3431cf31e5d856794",
"wallpaper": "https://gao.chuqiuyu.tk",
"lives": [
{

View File

@ -1,5 +1,5 @@
{
"spider": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;5115b919853874c483c641dbfdf2b667",
"spider": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/jar/custom_spider.jar;md5;c8bba231546a63b3431cf31e5d856794",
"wallpaper": "http://www.kf666888.cn/api/tvbox/img",
"lives": [
{
@ -40,6 +40,16 @@
"filterable": 1,
"changeable": 1
},
{
"key": "獨播",
"name": "獨播",
"type": 3,
"api": "csp_XPathMacFilter",
"searchable": 1,
"filterable": 1,
"changeable": 1,
"ext": "https://gh-proxy.com/https://raw.githubusercontent.com/FongMi/CatVodSpider/main/json/duboku.json"
},
{
"key": "快播",
"name": "快播",

772
json/duboku.json Normal file
View File

@ -0,0 +1,772 @@
{
"author": "takagen99",
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"homeUrl": "https://www.duboku.tv/",
"dcVipFlag": "true",
"dcPlayUrl": "true",
"cateNode": "//ul[contains(@class,'nav-menu')]/li/a[contains(@href, 'vodtype')]",
"cateName": "/text()",
"cateId": "/@href",
"cateIdR": "/vodtype/(\\w+).html",
"cateManual": {
"陆剧": "13",
"日韩剧": "15",
"短剧": "21",
"英美剧": "16",
"台泰剧": "14",
"港剧": "20",
"综艺": "3",
"动漫": "4"
},
"homeVodNode": "//ul[contains(@class,'myui-vodlist')]/li/div/a",
"homeVodName": "/@title",
"homeVodId": "/@href",
"homeVodIdR": "/voddetail/(\\w+).html",
"homeVodImg": "/@data-original",
"homeVodImgR": "\\S+(http\\S+)",
"homeVodMark": "//span[contains(@class,'pic-text')]/text()",
"cateUrl": "https://www.duboku.tv/vodshow/{cateId}-{area}-{by}------{catePg}---{year}.html",
"cateVodNode": "//ul[contains(@class,'myui-vodlist')]/li/div/a",
"cateVodName": "/@title",
"cateVodId": "/@href",
"cateVodIdR": "/voddetail/(\\w+).html",
"cateVodImg": "/@data-original",
"cateVodImgR": "\\S+(http\\S+)",
"cateVodMark": "//span[contains(@class,'pic-text')]/text()",
"dtUrl": "https://my.duboku.vip/voddetail/{vid}.html",
"dtNode": "//body",
"dtName": "//div[contains(@class,'myui-content__thumb')]/a/@title",
"dtNameR": "",
"dtImg": "//div[contains(@class,'myui-content__thumb')]/a/img/@data-original",
"dtImgR": "",
"dtCate": "//div[contains(@class,'myui-content__detail')]/p/span[contains(text(), '分类')]/following-sibling::a/text()",
"dtYear": "//div[contains(@class,'myui-content__detail')]/p/span[contains(text(), '年份')]/following-sibling::a/text()",
"dtArea": "//div[contains(@class,'myui-content__detail')]/p/span[contains(text(), '地区')]/following-sibling::a/text()",
"dtMark": "//div[contains(@class,'myui-content__detail')]/p/span[contains(text(), '更新')]/following-sibling::a/text()",
"dtDirector": "//div[contains(@class,'myui-content__detail')]/p/span[contains(text(), '导演')]/following-sibling::a/text()",
"dtActor": "//div[contains(@class,'myui-content__detail')]/p/span[contains(text(), '主演')]/following-sibling::a/text()",
"dtDesc": "//div[contains(@class,'myui-content__detail')]/p/span[contains(text(), '简介')]/following-sibling::a/text()",
"dtFromNode": "//ul[contains(@class,'nav-tabs')]/li/a",
"dtFromName": "/text()",
"dtFromNameR": "",
"dtUrlNode": "//ul[contains(@class,'myui-content__list')]",
"dtUrlSubNode": "/li/a",
"dtUrlId": "/@href",
"dtUrlIdR": "/vodplay/(\\S+).html",
"dtUrlName": "/text()",
"dtUrlNameR": "",
"playUrl": "https://my.duboku.vip/vodplay/{playUrl}.html",
"playUa": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"playReferer": "https://www.duboku.tv/",
"searchUrl": "https://my.duboku.vip/index.php/ajax/suggest?mid=1&wd={wd}&limit=10",
"scVodNode": "json:list",
"scVodName": "name",
"scVodId": "id",
"scVodIdR": "",
"scVodImg": "pic",
"scVodMark": "",
"filter": {
"13": [
{
"key": "year",
"name": "年份",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "2023",
"v": "2023"
},
{
"n": "2022",
"v": "2022"
},
{
"n": "2021",
"v": "2021"
},
{
"n": "2020",
"v": "2020"
},
{
"n": "2019",
"v": "2019"
},
{
"n": "2018",
"v": "2018"
},
{
"n": "2017",
"v": "2017"
}
]
},
{
"key": "by",
"name": "排序",
"value": [
{
"n": "排序",
"v": ""
},
{
"n": "时间",
"v": "time"
},
{
"n": "人气",
"v": "hits"
},
{
"n": "评分",
"v": "score"
}
]
}
],
"14": [
{
"key": "year",
"name": "年份",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "2023",
"v": "2023"
},
{
"n": "2022",
"v": "2022"
},
{
"n": "2021",
"v": "2021"
},
{
"n": "2020",
"v": "2020"
},
{
"n": "2019",
"v": "2019"
},
{
"n": "2018",
"v": "2018"
},
{
"n": "2017",
"v": "2017"
}
]
},
{
"key": "by",
"name": "排序",
"value": [
{
"n": "排序",
"v": ""
},
{
"n": "时间",
"v": "time"
},
{
"n": "人气",
"v": "hits"
},
{
"n": "评分",
"v": "score"
}
]
}
],
"16": [
{
"key": "year",
"name": "年份",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "2023",
"v": "2023"
},
{
"n": "2022",
"v": "2022"
},
{
"n": "2021",
"v": "2021"
},
{
"n": "2020",
"v": "2020"
},
{
"n": "2019",
"v": "2019"
},
{
"n": "2018",
"v": "2018"
},
{
"n": "2017",
"v": "2017"
}
]
},
{
"key": "by",
"name": "排序",
"value": [
{
"n": "排序",
"v": ""
},
{
"n": "时间",
"v": "time"
},
{
"n": "人气",
"v": "hits"
},
{
"n": "评分",
"v": "score"
}
]
}
],
"15": [
{
"key": "year",
"name": "年份",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "2023",
"v": "2023"
},
{
"n": "2022",
"v": "2022"
},
{
"n": "2021",
"v": "2021"
},
{
"n": "2020",
"v": "2020"
},
{
"n": "2019",
"v": "2019"
},
{
"n": "2018",
"v": "2018"
},
{
"n": "2017",
"v": "2017"
}
]
},
{
"key": "by",
"name": "排序",
"value": [
{
"n": "排序",
"v": ""
},
{
"n": "时间",
"v": "time"
},
{
"n": "人气",
"v": "hits"
},
{
"n": "评分",
"v": "score"
}
]
}
],
"2": [
{
"key": "cateId",
"name": "类型",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "陆剧",
"v": "13"
},
{
"n": "日韩剧",
"v": "15"
},
{
"n": "英美剧",
"v": "16"
},
{
"n": "台泰剧",
"v": "14"
},
{
"n": "港剧",
"v": "20"
}
]
},
{
"key": "area",
"name": "地区",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "内地",
"v": "内地"
},
{
"n": "韩国",
"v": "韩国"
},
{
"n": "香港",
"v": "香港"
},
{
"n": "台湾",
"v": "台湾"
},
{
"n": "美国",
"v": "美国"
},
{
"n": "英国",
"v": "英国"
},
{
"n": "巴西",
"v": "巴西"
},
{
"n": "西班牙",
"v": "西班牙"
},
{
"n": "泰国",
"v": "泰国"
},
{
"n": "德国",
"v": "德国"
},
{
"n": "法国",
"v": "法国"
},
{
"n": "日本",
"v": "日本"
},
{
"n": "荷兰",
"v": "荷兰"
}
]
},
{
"key": "year",
"name": "年份",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "2023",
"v": "2023"
},
{
"n": "2022",
"v": "2022"
},
{
"n": "2021",
"v": "2021"
},
{
"n": "2020",
"v": "2020"
},
{
"n": "2019",
"v": "2019"
},
{
"n": "2018",
"v": "2018"
},
{
"n": "2017",
"v": "2017"
}
]
},
{
"key": "by",
"name": "排序",
"value": [
{
"n": "排序",
"v": ""
},
{
"n": "时间",
"v": "time"
},
{
"n": "人气",
"v": "hits"
},
{
"n": "评分",
"v": "score"
}
]
}
],
"3": [
{
"key": "area",
"name": "地区",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "内地",
"v": "内地"
},
{
"n": "香港",
"v": "香港"
},
{
"n": "台湾",
"v": "台湾"
},
{
"n": "韩国",
"v": "韩国"
},
{
"n": "美国",
"v": "美国"
}
]
},
{
"key": "year",
"name": "年份",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "2023",
"v": "2023"
},
{
"n": "2022",
"v": "2022"
},
{
"n": "2021",
"v": "2021"
},
{
"n": "2020",
"v": "2020"
},
{
"n": "2019",
"v": "2019"
}
]
},
{
"key": "by",
"name": "排序",
"value": [
{
"n": "排序",
"v": ""
},
{
"n": "时间",
"v": "time"
},
{
"n": "人气",
"v": "hits"
},
{
"n": "评分",
"v": "score"
}
]
}
],
"4": [
{
"key": "area",
"name": "地区",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "国产",
"v": "国产"
},
{
"n": "日本",
"v": "日本"
},
{
"n": "美国",
"v": "美国"
},
{
"n": "法国",
"v": "法国"
},
{
"n": "其他",
"v": "其他"
}
]
},
{
"key": "year",
"name": "年份",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "2023",
"v": "2023"
},
{
"n": "2022",
"v": "2022"
},
{
"n": "2021",
"v": "2021"
},
{
"n": "2020",
"v": "2020"
},
{
"n": "2019",
"v": "2019"
},
{
"n": "2018",
"v": "2018"
},
{
"n": "2017",
"v": "2017"
}
]
},
{
"key": "by",
"name": "排序",
"value": [
{
"n": "排序",
"v": ""
},
{
"n": "时间",
"v": "time"
},
{
"n": "人气",
"v": "hits"
},
{
"n": "评分",
"v": "score"
}
]
}
],
"20": [
{
"key": "year",
"name": "年份",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "2023",
"v": "2023"
},
{
"n": "2022",
"v": "2022"
},
{
"n": "2021",
"v": "2021"
},
{
"n": "2020",
"v": "2020"
},
{
"n": "2019",
"v": "2019"
},
{
"n": "2018",
"v": "2018"
},
{
"n": "2017",
"v": "2017"
}
]
},
{
"key": "by",
"name": "排序",
"value": [
{
"n": "排序",
"v": ""
},
{
"n": "时间",
"v": "time"
},
{
"n": "人气",
"v": "hits"
},
{
"n": "评分",
"v": "score"
}
]
}
],
"21": [
{
"key": "year",
"name": "年份",
"value": [
{
"n": "全部",
"v": ""
},
{
"n": "2023",
"v": "2023"
},
{
"n": "2022",
"v": "2022"
},
{
"n": "2021",
"v": "2021"
},
{
"n": "2020",
"v": "2020"
},
{
"n": "2019",
"v": "2019"
},
{
"n": "2018",
"v": "2018"
},
{
"n": "2017",
"v": "2017"
}
]
},
{
"key": "by",
"name": "排序",
"value": [
{
"n": "排序",
"v": ""
},
{
"n": "时间",
"v": "time"
},
{
"n": "人气",
"v": "hits"
},
{
"n": "评分",
"v": "score"
}
]
}
]
}
}