|
|
@@ -36,9 +36,9 @@ async function Main() {
|
|
|
function checkHandleRequest(){
|
|
|
}
|
|
|
|
|
|
-function findAll(regexPattern, string) {
|
|
|
+function findAll(regexPattern, text) {
|
|
|
const re = new RegExp(regexPattern, 'g'); // 'g' 标志表示全局搜索
|
|
|
- let matches = string.match(re);
|
|
|
+ let matches = text.match(re);
|
|
|
return matches || [];
|
|
|
}
|
|
|
|
|
|
@@ -59,10 +59,10 @@ async function getLoginJumpUrl(){
|
|
|
}
|
|
|
|
|
|
magicJS.http.get(options).then(resp => {
|
|
|
- const data = resp.body;
|
|
|
+ const htmlText = resp.body;
|
|
|
try {
|
|
|
// magicJS.logger.info(`页面数据:${data}`);
|
|
|
- let urlMatch = data.match(/https?:\/\/[^\s'"]+/); // 正则表达式匹配
|
|
|
+ let urlMatch = htmlText.match(/https?:\/\/[^\s'"]+/); // 正则表达式匹配
|
|
|
if(urlMatch){
|
|
|
resolve(urlMatch[0]);
|
|
|
}
|
|
|
@@ -93,10 +93,10 @@ async function getLoginAccoutUrl(url){
|
|
|
body: body
|
|
|
}
|
|
|
magicJS.http.get(options).then(resp => {
|
|
|
- const data = resp.body;
|
|
|
+ const htmlText = resp.body;
|
|
|
try {
|
|
|
// magicJS.logger.info(`页面数据:${data}`);
|
|
|
- let urlMatch = data.match(/<a id="j-tab-login-link"[^>]*href="([^"]+)"/); // 正则表达式匹配
|
|
|
+ let urlMatch = htmlText.match(/<a id="j-tab-login-link"[^>]*href="([^"]+)"/); // 正则表达式匹配
|
|
|
if(urlMatch){
|
|
|
resolve(urlMatch[1]);
|
|
|
}
|
|
|
@@ -141,10 +141,21 @@ function getLoginData(url){
|
|
|
body: body
|
|
|
}
|
|
|
magicJS.http.get(options).then(resp => {
|
|
|
- const data = resp.body;
|
|
|
+ const htmlText = resp.body;
|
|
|
try {
|
|
|
- magicJS.logger.info(`接口数据:${data}`);
|
|
|
- resolve();
|
|
|
+ // magicJS.logger.info(`接口数据:${htmlText}`);
|
|
|
+ let captchaToken = findAll(`captchaToken' value='(.+?)'`, htmlText)[0];
|
|
|
+ let lt = findAll(`lt = "(.+?)"`, htmlText)[0];
|
|
|
+ let paramId = findAll(`paramId = "(.+?)"`, htmlText)[0];
|
|
|
+ let j_rsakey = findAll(`j_rsaKey" value="(\S+)"`, htmlText)[0];
|
|
|
+ let retData = {
|
|
|
+ captchaToken: captchaToken,
|
|
|
+ lt: lt,
|
|
|
+ paramId: paramId,
|
|
|
+ j_rsakey: j_rsakey,
|
|
|
+ };
|
|
|
+ magicJS.logger.error(JSON.stringify(retData));
|
|
|
+ resolve(retData);
|
|
|
} catch (err) {
|
|
|
resolve();
|
|
|
}
|