|
|
@@ -581,7 +581,7 @@ async function checkWapLogin(username, password, extData){
|
|
|
"LT": extData.lt,
|
|
|
"Referer": 'https://open.e.189.cn/',
|
|
|
"User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
|
|
|
- // "Cookie": magicJS.serializeCookies(cookieData),
|
|
|
+ // "Cookie": magicJS.serializeCookies(cookieData),//不要设置
|
|
|
},
|
|
|
body: ``,
|
|
|
};
|
|
|
@@ -642,14 +642,15 @@ async function getLoginScanUrl(url){
|
|
|
"Accept-Language": "zh-cn",
|
|
|
"Connection": "keep-alive",
|
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
|
+ 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Ecloud/10.1.4 (iPhone; 025EAA3307-34DD-47B0-94C1-62AC27D169B7; appStore) iOS/16.6.1',
|
|
|
},
|
|
|
body: body
|
|
|
}
|
|
|
magicJS.http.get(options).then(resp => {
|
|
|
const htmlText = resp.body;
|
|
|
try {
|
|
|
- // magicJS.logger.info(`页面数据:${htmlText}`);
|
|
|
- let urlMatch = htmlText.match(/<a id="j-tab-login-link"[^>]*href="([^"]+)"/); // 正则表达式匹配
|
|
|
+ magicJS.logger.info(`页面数据:${htmlText}`);
|
|
|
+ let urlMatch = htmlText.match(/saomaurl=([\s\S]*)/); // 正则表达式匹配
|
|
|
if(urlMatch){
|
|
|
resolve(urlMatch[1]);
|
|
|
}else{
|
|
|
@@ -666,9 +667,48 @@ async function getLoginScanUrl(url){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+async function getLoginScanJumpUrl(url){
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let body = ``;
|
|
|
+ let options = {
|
|
|
+ url: url,
|
|
|
+ headers: {
|
|
|
+ "Accept": "*/*",
|
|
|
+ "Accept-Encoding": "gzip, deflate, br",
|
|
|
+ "Accept-Language": "zh-cn",
|
|
|
+ "Connection": "keep-alive",
|
|
|
+ "Content-Type": "application/x-www-form-urlencoded",
|
|
|
+ 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Ecloud/10.1.4 (iPhone; 025EAA3307-34DD-47B0-94C1-62AC27D169B7; appStore) iOS/16.6.1',
|
|
|
+ },
|
|
|
+ body: body
|
|
|
+ }
|
|
|
|
|
|
-function scanLogin(){
|
|
|
+ magicJS.http.get(options).then(resp => {
|
|
|
+ const htmlText = resp.body;
|
|
|
+ try {
|
|
|
+ magicJS.logger.info(`页面数据:${htmlText}`);
|
|
|
+ magicJS.logger.info(`响应头部:${JSON.stringify(resp.headers)}`);
|
|
|
+ let urlMatch = htmlText.match(/https?:\/\/[^\s'"]+/); // 正则表达式匹配
|
|
|
+ if(urlMatch){
|
|
|
+ resolve(urlMatch[0]);
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ resolve();
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ const msg = `获取页面数据异常\n${JSON.stringify(err)}`;
|
|
|
+ magicJS.logger.error(msg);
|
|
|
+ reject(msg);
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
+function scanLogin(){
|
|
|
+ let sInitUrl = 'https://cloud.189.cn/api/portal/loginUrl.action?redirectURL=https://cloud.189.cn/web/redirect.html?returnURL=/main.action';
|
|
|
+ let jumpUrl = await getLoginScanUrl(sInitUrl);
|
|
|
+ if(jumpUrl){
|
|
|
+ await getLoginScanJumpUrl(jumpUrl);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Main();
|