@rich-automation/lotto 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.URLS = void 0;
|
|
4
4
|
exports.URLS = {
|
|
5
|
-
MAIN: 'https://dhlottery.co.kr/main',
|
|
6
|
-
LOGIN: 'https://dhlottery.co.kr/login',
|
|
5
|
+
MAIN: 'https://www.dhlottery.co.kr/main',
|
|
6
|
+
LOGIN: 'https://www.dhlottery.co.kr/login',
|
|
7
7
|
LOTTO_645: 'https://ol.dhlottery.co.kr/olotto/game/game645.do',
|
|
8
|
-
CHECK_WINNING: 'https://dhlottery.co.kr/qr.do'
|
|
8
|
+
CHECK_WINNING: 'https://www.dhlottery.co.kr/qr.do'
|
|
9
9
|
};
|
package/lib/cjs/lottoService.js
CHANGED
|
@@ -89,13 +89,32 @@ class LottoService {
|
|
|
89
89
|
yield this.browserController.cleanPages([0]);
|
|
90
90
|
return page.getCookies();
|
|
91
91
|
}
|
|
92
|
+
// 디버깅 정보 수집
|
|
93
|
+
const debugInfo = {
|
|
94
|
+
currentUrl,
|
|
95
|
+
isStillOnLoginPage: currentUrl.includes(urls_1.URLS.LOGIN),
|
|
96
|
+
hasErrorPopup: yield page.exists(selectors_1.SELECTORS.LOGIN_ERROR_POPUP),
|
|
97
|
+
hasLoginButton: yield page.exists(selectors_1.SELECTORS.LOGIN_BUTTON),
|
|
98
|
+
hasIdInput: yield page.exists(selectors_1.SELECTORS.ID_INPUT),
|
|
99
|
+
errorPopupMessage: null
|
|
100
|
+
};
|
|
101
|
+
// 에러 팝업 메시지 추출 시도
|
|
102
|
+
if (debugInfo.hasErrorPopup) {
|
|
103
|
+
try {
|
|
104
|
+
const messages = yield page.querySelectorAll(selectors_1.SELECTORS.LOGIN_ERROR_POPUP, elems => elems.map(el => el.innerHTML.replace(/<[^>]*>/g, ' ').trim()));
|
|
105
|
+
debugInfo.errorPopupMessage = messages.join(' | ');
|
|
106
|
+
}
|
|
107
|
+
catch (_a) {
|
|
108
|
+
debugInfo.errorPopupMessage = '[failed to extract]';
|
|
109
|
+
}
|
|
110
|
+
}
|
|
92
111
|
// 실패: 로그인 에러 팝업 확인
|
|
93
112
|
if (yield page.exists(selectors_1.SELECTORS.LOGIN_ERROR_POPUP, constants_1.CONST.LOGIN_ERROR_MESSAGE)) {
|
|
94
|
-
this.logger.info('[signIn]', 'failed', 'credentials incorrect');
|
|
113
|
+
this.logger.info('[signIn]', 'failed', 'credentials incorrect', debugInfo);
|
|
95
114
|
throw lottoError_1.default.CredentialsIncorrect();
|
|
96
115
|
}
|
|
97
116
|
// 기타 실패
|
|
98
|
-
this.logger.
|
|
117
|
+
this.logger.warn('[signIn]', 'failed', 'unknown reason', debugInfo);
|
|
99
118
|
throw lottoError_1.default.CredentialsIncorrect();
|
|
100
119
|
});
|
|
101
120
|
this.purchase = (amount = 5) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const URLS = {
|
|
2
|
-
MAIN: 'https://dhlottery.co.kr/main',
|
|
3
|
-
LOGIN: 'https://dhlottery.co.kr/login',
|
|
2
|
+
MAIN: 'https://www.dhlottery.co.kr/main',
|
|
3
|
+
LOGIN: 'https://www.dhlottery.co.kr/login',
|
|
4
4
|
LOTTO_645: 'https://ol.dhlottery.co.kr/olotto/game/game645.do',
|
|
5
|
-
CHECK_WINNING: 'https://dhlottery.co.kr/qr.do'
|
|
5
|
+
CHECK_WINNING: 'https://www.dhlottery.co.kr/qr.do'
|
|
6
6
|
};
|
package/lib/esm/lottoService.js
CHANGED
|
@@ -83,13 +83,32 @@ export class LottoService {
|
|
|
83
83
|
yield this.browserController.cleanPages([0]);
|
|
84
84
|
return page.getCookies();
|
|
85
85
|
}
|
|
86
|
+
// 디버깅 정보 수집
|
|
87
|
+
const debugInfo = {
|
|
88
|
+
currentUrl,
|
|
89
|
+
isStillOnLoginPage: currentUrl.includes(URLS.LOGIN),
|
|
90
|
+
hasErrorPopup: yield page.exists(SELECTORS.LOGIN_ERROR_POPUP),
|
|
91
|
+
hasLoginButton: yield page.exists(SELECTORS.LOGIN_BUTTON),
|
|
92
|
+
hasIdInput: yield page.exists(SELECTORS.ID_INPUT),
|
|
93
|
+
errorPopupMessage: null
|
|
94
|
+
};
|
|
95
|
+
// 에러 팝업 메시지 추출 시도
|
|
96
|
+
if (debugInfo.hasErrorPopup) {
|
|
97
|
+
try {
|
|
98
|
+
const messages = yield page.querySelectorAll(SELECTORS.LOGIN_ERROR_POPUP, elems => elems.map(el => el.innerHTML.replace(/<[^>]*>/g, ' ').trim()));
|
|
99
|
+
debugInfo.errorPopupMessage = messages.join(' | ');
|
|
100
|
+
}
|
|
101
|
+
catch (_a) {
|
|
102
|
+
debugInfo.errorPopupMessage = '[failed to extract]';
|
|
103
|
+
}
|
|
104
|
+
}
|
|
86
105
|
// 실패: 로그인 에러 팝업 확인
|
|
87
106
|
if (yield page.exists(SELECTORS.LOGIN_ERROR_POPUP, CONST.LOGIN_ERROR_MESSAGE)) {
|
|
88
|
-
this.logger.info('[signIn]', 'failed', 'credentials incorrect');
|
|
107
|
+
this.logger.info('[signIn]', 'failed', 'credentials incorrect', debugInfo);
|
|
89
108
|
throw LottoError.CredentialsIncorrect();
|
|
90
109
|
}
|
|
91
110
|
// 기타 실패
|
|
92
|
-
this.logger.
|
|
111
|
+
this.logger.warn('[signIn]', 'failed', 'unknown reason', debugInfo);
|
|
93
112
|
throw LottoError.CredentialsIncorrect();
|
|
94
113
|
});
|
|
95
114
|
this.purchase = (amount = 5) => __awaiter(this, void 0, void 0, function* () {
|