오윤석

리부트 캐릭터 가져오지 못하는 오류 수정

axios = require('axios');
const crwalCharacterCode = async function(nickname) {
const crwalCharacterCode = async function(nickname, isReboot = false) {
try {
const resp = await axios.get("https://maplestory.nexon.com/Ranking/World/Total?c=" + encodeURI(nickname));
const resp = await axios.get("https://maplestory.nexon.com/Ranking/World/Total?c=" + encodeURI(nickname) + "&w=" + (isReboot ? "0" : "254"));
const regex = new RegExp(`<dt><a href=\\"\\/Common\\/Character\\/Detail\\/[^\\?]+?\\?p=(.+?)\\"\\s+target=.+?\\/>${nickname}<\\/a><\\/dt>`);
const regexResult = regex.exec(resp.data);
if (!regexResult)
if (!regexResult) {
if (isReboot)
return -2;
else
return await crwalCharacterCode(nickname, true);
}
return regexResult[1];
} catch (error) {
......