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

View File

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

Binary file not shown.

View File

@ -1 +1 @@
935c112210452fe47a01a3b733b45241 cc4fd0f3a5afb87946fe17b557c7a6e8