修复蓝奏云pan解析错误的问题#12

This commit is contained in:
qaiu
2023-08-20 10:29:00 +08:00
parent 6d3335d086
commit aea97caed1
2 changed files with 49 additions and 37 deletions

View File

@@ -65,7 +65,8 @@ public class LzTool extends PanBase implements IPanTool {
*/ */
/** /**
* 解析器 * 蓝奏云解析器
*
* @return url String * @return url String
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -79,20 +80,25 @@ public class LzTool extends PanBase implements IPanTool {
// 匹配iframe // 匹配iframe
Pattern compile = Pattern.compile("src=\"(/fn\\?[a-zA-Z\\d_+/=]{16,})\""); Pattern compile = Pattern.compile("src=\"(/fn\\?[a-zA-Z\\d_+/=]{16,})\"");
Matcher matcher = compile.matcher(html); Matcher matcher = compile.matcher(html);
// 没有Iframe说明是加密分享, 匹配sign通过密码请求下载页面
if (!matcher.find()) { if (!matcher.find()) {
// 没有Iframe说明是加密分享, 匹配sign通过密码请求下载页面 // 处理一下JS
// 去TMD正则
String jsText = getJsText(html); String jsText = getJsText(html);
try {
ScriptObjectMirror scriptMirror = JsExecUtils.executeDynamicJs(jsText, "down_p");
System.out.println(scriptMirror);
if (jsText == null) {
fail(SHARE_URL_PREFIX + " -> " + sUrl + ": js脚本匹配失败, 可能分享已失效");
return;
}
jsText = jsText.replace("document.getElementById('pwd').value", "\"" + pwd + "\"");
jsText = jsText.substring(0, jsText.indexOf("document.getElementById('rpt')"));
try {
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, "down_p");
getDownURL(promise, sUrl, client, (Map<String, String>) scriptObjectMirror.get("data"));
} catch (ScriptException | NoSuchMethodException e) { } catch (ScriptException | NoSuchMethodException e) {
fail(e, "js引擎执行失败"); fail(e, "js引擎执行失败");
return; return;
} }
// getDownURL(promise, sUrl, client, sign);
return; return;
} }
String iframePath = matcher.group(1); String iframePath = matcher.group(1);
@@ -103,7 +109,7 @@ public class LzTool extends PanBase implements IPanTool {
// Matcher matcher2 = Pattern.compile("'sign'\s*:\s*'(\\w+)'").matcher(html2); // Matcher matcher2 = Pattern.compile("'sign'\s*:\s*'(\\w+)'").matcher(html2);
String jsText = getJsText(html2); String jsText = getJsText(html2);
if (jsText == null) { if (jsText == null) {
fail(SHARE_URL_PREFIX + iframePath + " -> " + sUrl + ": sign正则匹配失败, 可能分享已失效"); fail(SHARE_URL_PREFIX + iframePath + " -> " + sUrl + ": js脚本匹配失败, 可能分享已失效");
return; return;
} }
try { try {
@@ -131,8 +137,8 @@ public class LzTool extends PanBase implements IPanTool {
private void getDownURL(Promise<String> promise, String key, WebClient client, Map<String, ?> signMap) { private void getDownURL(Promise<String> promise, String key, WebClient client, Map<String, ?> signMap) {
MultiMap map = MultiMap.caseInsensitiveMultiMap(); MultiMap map = MultiMap.caseInsensitiveMultiMap();
signMap.forEach((k,v)->{ signMap.forEach((k, v) -> {
map.set(k,v.toString()); map.set(k, v.toString());
}); });
MultiMap headers = MultiMap.caseInsensitiveMultiMap(); MultiMap headers = MultiMap.caseInsensitiveMultiMap();
var userAgent2 = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, " + var userAgent2 = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, " +

View File

@@ -5,36 +5,42 @@
var signObj; var signObj;
/* var $, jQuery;
var $,jQuery;
$ = jQuery = function(){ $ = jQuery = function () {
return new jQuery.fn.init(); return new jQuery.fn.init();
}
jQuery.fn = jQuery.prototype = {
init:function(){
return {
focus: function(a) {
}
}
}
}
jQuery.fn.init.prototype = jQuery.fn;
*/
// 伪装ajax函数获取关键数据
var $ = {
ajax: function(obj) {
signObj = obj
}
} }
jQuery.fn = jQuery.prototype = {
init: function () {
return {
focus: function (a) {
},
keyup: function(a) {
},
ajax: function (obj) {
signObj = obj
}
}
},
}
jQuery.fn.init.prototype = jQuery.fn;
// 伪装jquery.ajax函数获取关键数据
$.ajax = function (obj) {
signObj = obj
}
var document = { var document = {
getElementById: function (v) { getElementById: function (v) {
return { return {
value : v value: 'v'
} }
} },
} }