Fix xpath mac bug

This commit is contained in:
FongMi 2023-02-16 00:01:30 +08:00
parent 49e3d8d8d8
commit 08163cde4b
4 changed files with 10 additions and 10 deletions

View File

@ -10,6 +10,7 @@ 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;
@ -222,7 +223,7 @@ public class XPath extends Spider {
name = rule.getDetailUrlNameR(name);
String id = urlNodes.get(j).selOne(rule.getDetailUrlId()).asString().trim();
id = rule.getDetailUrlIdR(id);
vodItems.add(name + "$" + id);
vodItems.add(Trans.get(name) + "$" + id);
}
// 排除播放列表為空的播放源
if (vodItems.size() == 0 && playFrom.size() > i) {

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,12 +79,10 @@ 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);
@ -99,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])) {

Binary file not shown.

View File

@ -1 +1 @@
935c112210452fe47a01a3b733b45241
cc4fd0f3a5afb87946fe17b557c7a6e8