Showing
1 changed file
with
8 additions
and
4 deletions
1 | axios = require('axios'); | 1 | axios = require('axios'); |
2 | 2 | ||
3 | -const crwalCharacterCode = async function(nickname) { | 3 | +const crwalCharacterCode = async function(nickname, isReboot = false) { |
4 | try { | 4 | try { |
5 | - const resp = await axios.get("https://maplestory.nexon.com/Ranking/World/Total?c=" + encodeURI(nickname)); | 5 | + const resp = await axios.get("https://maplestory.nexon.com/Ranking/World/Total?c=" + encodeURI(nickname) + "&w=" + (isReboot ? "0" : "254")); |
6 | 6 | ||
7 | const regex = new RegExp(`<dt><a href=\\"\\/Common\\/Character\\/Detail\\/[^\\?]+?\\?p=(.+?)\\"\\s+target=.+?\\/>${nickname}<\\/a><\\/dt>`); | 7 | const regex = new RegExp(`<dt><a href=\\"\\/Common\\/Character\\/Detail\\/[^\\?]+?\\?p=(.+?)\\"\\s+target=.+?\\/>${nickname}<\\/a><\\/dt>`); |
8 | const regexResult = regex.exec(resp.data); | 8 | const regexResult = regex.exec(resp.data); |
9 | 9 | ||
10 | - if (!regexResult) | 10 | + if (!regexResult) { |
11 | - return -2; | 11 | + if (isReboot) |
12 | + return -2; | ||
13 | + else | ||
14 | + return await crwalCharacterCode(nickname, true); | ||
15 | + } | ||
12 | 16 | ||
13 | return regexResult[1]; | 17 | return regexResult[1]; |
14 | } catch (error) { | 18 | } catch (error) { | ... | ... |
-
Please register or login to post a comment