@@ -7,8 +7,8 @@ puppeteer.use(StealthPlugin());
7
7
8
8
export class LeetCodeBrowser extends LeetCodeEvents {
9
9
private static defaultOptions : PuppeteerLaunchOptions = { } ;
10
- private baseURL : string = "https://leetcode.com/" ;
11
- private loginURL : string = "https://leetcode.com/accounts/login" ;
10
+ private static baseURL : string = "https://leetcode.com/" ;
11
+ private static loginURL : string = "https://leetcode.com/accounts/login" ;
12
12
private constructor ( private options : PuppeteerLaunchOptions , private browser : Browser , private page : Page ) {
13
13
super ( ) ;
14
14
this . addBrowserEventListeners ( browser ) ;
@@ -24,7 +24,7 @@ export class LeetCodeBrowser extends LeetCodeEvents {
24
24
}
25
25
26
26
public async goTo ( path : String ) : Promise < void > {
27
- const urlPath = `${ this . baseURL } problems/${ path } ` ;
27
+ const urlPath = `${ LeetCodeBrowser . baseURL } problems/${ path } ` ;
28
28
try {
29
29
await this . page . goto ( urlPath , { waitUntil : "networkidle0" } ) ;
30
30
} catch ( error ) {
@@ -46,7 +46,7 @@ export class LeetCodeBrowser extends LeetCodeEvents {
46
46
47
47
const inputDelay = 100 ;
48
48
49
- await this . page . goto ( this . loginURL , { waitUntil : "networkidle0" } ) ;
49
+ await this . page . goto ( LeetCodeBrowser . loginURL , { waitUntil : "networkidle0" } ) ;
50
50
await this . page . type ( loginInputID , username , { delay : inputDelay } ) ;
51
51
await this . page . type ( passwordInputID , password , { delay : inputDelay } ) ;
52
52
try {
@@ -55,7 +55,7 @@ export class LeetCodeBrowser extends LeetCodeEvents {
55
55
this . page . click ( submitBtnID , { delay : inputDelay } ) ,
56
56
] ) ;
57
57
if ( response ) {
58
- if ( response . url ( ) === this . baseURL ) {
58
+ if ( response . url ( ) === LeetCodeBrowser . baseURL ) {
59
59
console . log ( "Logged into leetcode!" ) ;
60
60
return ;
61
61
}
0 commit comments