同步带筛选的XPath类,XPathMac支持2.0.6新增的jx字段支持
This commit is contained in:
parent
93e8f23155
commit
e223ef0e53
|
@ -17,7 +17,7 @@ jobs:
|
||||||
cache: gradle
|
cache: gradle
|
||||||
|
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./buildAndGenJar.bat
|
run: ./buildAndGenJar.bat ec
|
||||||
|
|
||||||
- name: Update spider jar
|
- name: Update spider jar
|
||||||
uses: EndBug/add-and-commit@v7
|
uses: EndBug/add-and-commit@v7
|
||||||
|
|
4
XPath.md
4
XPath.md
|
@ -79,10 +79,10 @@
|
||||||
"key": "csp_xpath_tvci",
|
"key": "csp_xpath_tvci",
|
||||||
"name": "大师兄(XPath)",
|
"name": "大师兄(XPath)",
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"api": "csp_XPath",
|
"api": "csp_XPathFilter",
|
||||||
"searchable": 1,
|
"searchable": 1,
|
||||||
"quickSearch": 1,
|
"quickSearch": 1,
|
||||||
"filterable": 0,
|
"filterable": 1,
|
||||||
"ext": "https://cdn.jsdelivr.net/gh/lite-cucumber/CatVodTVSpider@master/xpath/tvci.json"
|
"ext": "https://cdn.jsdelivr.net/gh/lite-cucumber/CatVodTVSpider@master/xpath/tvci.json"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.github.catvod.crawler.SpiderDebug;
|
||||||
import com.github.catvod.crawler.SpiderReq;
|
import com.github.catvod.crawler.SpiderReq;
|
||||||
import com.github.catvod.crawler.SpiderReqResult;
|
import com.github.catvod.crawler.SpiderReqResult;
|
||||||
import com.github.catvod.crawler.SpiderUrl;
|
import com.github.catvod.crawler.SpiderUrl;
|
||||||
import com.github.catvod.okhttp.SpiderOKClient;
|
import com.github.catvod.utils.SpiderOKClient;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.github.catvod.crawler.SpiderDebug;
|
||||||
import com.github.catvod.crawler.SpiderReq;
|
import com.github.catvod.crawler.SpiderReq;
|
||||||
import com.github.catvod.crawler.SpiderReqResult;
|
import com.github.catvod.crawler.SpiderReqResult;
|
||||||
import com.github.catvod.crawler.SpiderUrl;
|
import com.github.catvod.crawler.SpiderUrl;
|
||||||
import com.github.catvod.okhttp.SSLSocketFactoryCompat;
|
import com.github.catvod.utils.SSLSocketFactoryCompat;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class XPathFilter extends XPath {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadRuleExt(String json) {
|
||||||
|
super.loadRuleExt(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String categoryUrl(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
||||||
|
String cateUrl = rule.getCateUrl();
|
||||||
|
if (filter && 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.length() > 0) {
|
||||||
|
cateUrl = cateUrl.replace("{" + key + "}", URLEncoder.encode(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cateUrl = cateUrl.replace("{cateId}", tid).replace("{catePg}", pg);
|
||||||
|
Matcher m = Pattern.compile("\\{(.*?)\\}").matcher(cateUrl);
|
||||||
|
while (m.find()) {
|
||||||
|
String n = m.group(0).replace("{", "").replace("}", "");
|
||||||
|
cateUrl = cateUrl.replace(m.group(0), "").replace("/" + n + "/", "");
|
||||||
|
}
|
||||||
|
return cateUrl;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import android.util.Base64;
|
||||||
|
|
||||||
import com.github.catvod.crawler.SpiderDebug;
|
import com.github.catvod.crawler.SpiderDebug;
|
||||||
import com.github.catvod.crawler.SpiderReqResult;
|
import com.github.catvod.crawler.SpiderReqResult;
|
||||||
|
import com.github.catvod.utils.VipCheck;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
@ -116,6 +117,7 @@ public class XPathMac extends XPath {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String playerContent(String flag, String id, List<String> vipFlags) {
|
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||||
fetchRule();
|
fetchRule();
|
||||||
|
@ -153,19 +155,27 @@ public class XPathMac extends XPath {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (videoUrl != null) {
|
if (videoUrl != null) {
|
||||||
// 是否使用应用内解析列表解析官源
|
// 适配2.0.6的调用应用内解析列表的支持, 需要配合直连分析和匹配官源解析一起使用,参考cjt影视和极品直连
|
||||||
if (vipFlags.contains(flag)) {
|
if (decodeVipFlag && VipCheck.isVip(videoUrl)) { // 使用jx:1
|
||||||
if (decodeVipFlag) {
|
try {
|
||||||
try {
|
JSONObject result = new JSONObject();
|
||||||
JSONObject result = new JSONObject();
|
result.put("parse", 1);
|
||||||
result.put("parse", 1);
|
result.put("jx", "1");
|
||||||
result.put("playUrl", "");
|
result.put("url", videoUrl);
|
||||||
result.put("url", videoUrl);
|
return result.toString();
|
||||||
result.put("header", "");
|
} catch (Exception e) {
|
||||||
return result.toString();
|
SpiderDebug.log(e);
|
||||||
} catch (Exception e) {
|
}
|
||||||
SpiderDebug.log(e);
|
} else if (decodeVipFlag && vipFlags.contains(flag)) { // 是否使用应用内解析列表解析官源
|
||||||
}
|
try {
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("parse", 1);
|
||||||
|
result.put("playUrl", "");
|
||||||
|
result.put("url", videoUrl);
|
||||||
|
result.put("header", "");
|
||||||
|
return result.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
SpiderDebug.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 如果是视频直连 直接返回免解
|
// 如果是视频直连 直接返回免解
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.github.catvod.spider;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class XPathMacFilter extends XPathMac {
|
||||||
|
@Override
|
||||||
|
protected String categoryUrl(String tid, String pg, boolean filter, HashMap<String, String> extend) {
|
||||||
|
String cateUrl = rule.getCateUrl();
|
||||||
|
if (filter && 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.length() > 0) {
|
||||||
|
cateUrl = cateUrl.replace("{" + key + "}", URLEncoder.encode(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cateUrl = cateUrl.replace("{cateId}", tid).replace("{catePg}", pg);
|
||||||
|
Matcher m = Pattern.compile("\\{(.*?)\\}").matcher(cateUrl);
|
||||||
|
while (m.find()) {
|
||||||
|
String n = m.group(0).replace("{", "").replace("}", "");
|
||||||
|
cateUrl = cateUrl.replace(m.group(0), "").replace("/" + n + "/", "");
|
||||||
|
}
|
||||||
|
return cateUrl;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ import com.github.catvod.crawler.SpiderDebug;
|
||||||
import com.github.catvod.crawler.SpiderReq;
|
import com.github.catvod.crawler.SpiderReq;
|
||||||
import com.github.catvod.crawler.SpiderReqResult;
|
import com.github.catvod.crawler.SpiderReqResult;
|
||||||
import com.github.catvod.crawler.SpiderUrl;
|
import com.github.catvod.crawler.SpiderUrl;
|
||||||
import com.github.catvod.okhttp.SpiderOKClient;
|
import com.github.catvod.utils.SpiderOKClient;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.github.catvod.okhttp;
|
package com.github.catvod.utils;
|
||||||
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.github.catvod.okhttp;
|
package com.github.catvod.utils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.github.catvod.utils;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
public class VipCheck {
|
||||||
|
public static boolean isVip(String url) {
|
||||||
|
// 适配2.0.6的调用应用内解析列表的支持, 需要配合直连分析一起使用,参考cjt影视和极品直连
|
||||||
|
try {
|
||||||
|
boolean isVip = false;
|
||||||
|
String host = Uri.parse(url).getHost();
|
||||||
|
String[] vipWebsites = new String[]{"iqiyi.com", "v.qq.com", "youku.com", "le.com", "tudou.com", "mgtv.com", "sohu.com", "acfun.cn", "bilibili.com", "baofeng.com", "pptv.com"};
|
||||||
|
for (int b = 0; b < vipWebsites.length; b++) {
|
||||||
|
if (host.contains(vipWebsites[b])) {
|
||||||
|
if ("iqiyi.com".equals(vipWebsites[b])) {
|
||||||
|
//爱奇艺需要特殊处理
|
||||||
|
if (url.contains("iqiyi.com/a_") || url.contains("iqiyi.com/w_") || url.contains("iqiyi.com/v_")) {
|
||||||
|
isVip = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isVip = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isVip;
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
call "%~dp0\gradlew" assembleRelease --no-daemon
|
call "%~dp0\gradlew" assembleRelease --no-daemon
|
||||||
|
|
||||||
call "%~dp0\jar\genJar.bat"
|
call "%~dp0\jar\genJar.bat" %1
|
||||||
|
|
||||||
pause
|
pause
|
Binary file not shown.
Binary file not shown.
|
@ -1 +1 @@
|
||||||
35ba854e305d50d6f3c1b4ecb60fac39
|
653675e17afe53425263a40c03db5723
|
||||||
|
|
|
@ -10,6 +10,10 @@ rd /s/q "%~dp0\spider.jar\smali\com\github\catvod\parser"
|
||||||
|
|
||||||
if not exist "%~dp0\spider.jar\smali\com\github\catvod\" md "%~dp0\spider.jar\smali\com\github\catvod\"
|
if not exist "%~dp0\spider.jar\smali\com\github\catvod\" md "%~dp0\spider.jar\smali\com\github\catvod\"
|
||||||
|
|
||||||
|
if "%1" == "ec" (
|
||||||
|
java -Dfile.encoding=utf-8 -jar "%~dp0\3rd\oss.jar" "%~dp0\Smali_classes"
|
||||||
|
)
|
||||||
|
|
||||||
move "%~dp0\Smali_classes\com\github\catvod\spider" "%~dp0\spider.jar\smali\com\github\catvod\"
|
move "%~dp0\Smali_classes\com\github\catvod\spider" "%~dp0\spider.jar\smali\com\github\catvod\"
|
||||||
move "%~dp0\Smali_classes\com\github\catvod\parser" "%~dp0\spider.jar\smali\com\github\catvod\"
|
move "%~dp0\Smali_classes\com\github\catvod\parser" "%~dp0\spider.jar\smali\com\github\catvod\"
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
"ua": "",
|
"ua": "",
|
||||||
"homeUrl": "https://cjt521.com",
|
"homeUrl": "https://cjt521.com",
|
||||||
"dcVipFlag": "true",
|
"dcVipFlag": "true",
|
||||||
"pCfgJs": "https://cjt521.com/static/js/playerconfig.js",
|
|
||||||
"pCfgJsR": "[\\W|\\S|.]*?MacPlayerConfig.player_list[\\W|\\S|.]*?=([\\W|\\S|.]*?),MacPlayerConfig.downer_list",
|
|
||||||
"dcShow2Vip": {},
|
|
||||||
"dcPlayUrl": "true",
|
"dcPlayUrl": "true",
|
||||||
"cateNode": "//div[contains(@class,'ec-allnav')]//ul/li/a[contains(@href, 'vod/type')]",
|
"cateNode": "//div[contains(@class,'ec-allnav')]//ul/li/a[contains(@href, 'vod/type')]",
|
||||||
"cateName": "/spam/text()",
|
"cateName": "/spam/text()",
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
"ua": "",
|
"ua": "",
|
||||||
"homeUrl": "https://www.jpysvip.net",
|
"homeUrl": "https://www.jpysvip.net",
|
||||||
"dcVipFlag": "true",
|
"dcVipFlag": "true",
|
||||||
"pCfgJs": "https://www.jpysvip.net/static/js/playerconfig.js",
|
|
||||||
"pCfgJsR": "[\\W|\\S|.]*?MacPlayerConfig.player_list[\\W|\\S|.]*?=([\\W|\\S|.]*?),MacPlayerConfig.downer_list",
|
|
||||||
"dcShow2Vip": {},
|
|
||||||
"dcPlayUrl": "true",
|
"dcPlayUrl": "true",
|
||||||
"cateNode": "//ul[contains(@class,'myui-header__menu')]/li[@class='dropdown-hover']//ul/li/a[contains(@href, 'vodtype') and not(contains(@href, '26'))]",
|
"cateNode": "//ul[contains(@class,'myui-header__menu')]/li[@class='dropdown-hover']//ul/li/a[contains(@href, 'vodtype') and not(contains(@href, '26'))]",
|
||||||
"cateName": "/text()",
|
"cateName": "/text()",
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue