XPath support ua and referer
This commit is contained in:
parent
68b72566b9
commit
c622122583
|
|
@ -96,6 +96,7 @@ public class Result {
|
|||
}
|
||||
|
||||
public Result header(HashMap<String, String> header) {
|
||||
if (header.isEmpty()) return this;
|
||||
this.header = new Gson().toJson(header);
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,7 +259,10 @@ public class XPath extends Spider {
|
|||
public String playerContent(String flag, String id, List<String> vipFlags) {
|
||||
String webUrl = rule.getPlayUrl().isEmpty() ? id : rule.getPlayUrl().replace("{playUrl}", id);
|
||||
SpiderDebug.log(webUrl);
|
||||
return Result.get().parse().url(webUrl).toString();
|
||||
HashMap<String, String> headers = new HashMap<>();
|
||||
if (rule.getPlayUa().length() > 0) headers.put("User-Agent", rule.getPlayUa());
|
||||
if (rule.getPlayReferer().length() > 0) headers.put("Referer", rule.getPlayReferer());
|
||||
return Result.get().parse().url(webUrl).header(headers).string();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -250,6 +250,10 @@ public class XPathRule {
|
|||
* 播放解析調用ua
|
||||
*/
|
||||
private String playUa;
|
||||
/**
|
||||
* 播放解析調用referer
|
||||
*/
|
||||
private String playReferer;
|
||||
|
||||
/**
|
||||
* 搜尋頁地址
|
||||
|
|
@ -391,6 +395,7 @@ public class XPathRule {
|
|||
rule.dtUrlNameR = getPattern(jsonObj, "dtUrlNameR");
|
||||
rule.playUrl = jsonObj.optString("playUrl");
|
||||
rule.playUa = jsonObj.optString("playUa");
|
||||
rule.playReferer = jsonObj.optString("playReferer");
|
||||
rule.searchUrl = jsonObj.optString("searchUrl");
|
||||
rule.scVodNode = jsonObj.optString("scVodNode").trim();
|
||||
rule.scVodName = jsonObj.optString("scVodName").trim();
|
||||
|
|
@ -644,6 +649,10 @@ public class XPathRule {
|
|||
return playUa;
|
||||
}
|
||||
|
||||
public String getPlayReferer() {
|
||||
return playReferer;
|
||||
}
|
||||
|
||||
public String getSearchUrl() {
|
||||
return searchUrl;
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
f3c52e97a91a4d972225a8e2f8c2d81e
|
||||
386bb130dd0ff7c26addc113ce7e5434
|
||||
|
|
|
|||
Loading…
Reference in New Issue