Skip to content

Commit 493e1a7

Browse files
committed
예시 코드 업데이트
1 parent 7458d43 commit 493e1a7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

example/naver/reactivelyPrintPaymentHistory.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import puppeteer from "puppeteer";
2-
import { NaverApp } from "trackpurchase";
2+
import { NaverApp } from ".";
33

44
import readline from "readline";
55
import { concat, defer, filter, from, tap } from "rxjs";
6+
import { CaptchaStatus } from "app/naver";
67

78
const printNaverPayHistory = async (id: string, password: string) => {
89
const MOBILE_UA =
@@ -38,6 +39,22 @@ const printNaverPayHistory = async (id: string, password: string) => {
3839
});
3940
}
4041
}),
42+
tap((event) => {
43+
function instanceOfCaptchaStatus(object: any): object is CaptchaStatus {
44+
if (object) {
45+
return "imageData" in object && "question" in object;
46+
}
47+
return false;
48+
}
49+
50+
if (instanceOfCaptchaStatus(event)) {
51+
console.log(`encodedImage: ${event.imageData}`);
52+
console.log(`question: ${event.question}`);
53+
rl.question("captcha code: ", (code) => {
54+
module.pageInteractor.fillCaptchaInput(code, password);
55+
});
56+
}
57+
}),
4158
filter((event) => event instanceof Array)
4259
);
4360
final$.subscribe((event) => {

0 commit comments

Comments
 (0)