1- import HTMLParser from 'node-html-parser'
2- import fetch from 'node-fetch'
3- import atob from 'atob'
1+ import HTMLParser from 'node-html-parser' ;
2+ import fetch from 'node-fetch' ;
3+ import atob from 'atob' ;
44
5- async function _fetchVariable ( ) {
6- let html = await fetch ( 'https://staging.replit.com/' , {
5+ async function fetchVariable ( ) {
6+ const html = await fetch ( 'https://staging.replit.com/' , {
77 method : 'GET' ,
88 headers : {
99 'X-Requested-With' : 'ReplAPI.it' ,
10- ' Referrer' : 'https://staging.replit.com/'
11- }
12- } ) . then ( res => res . text ( ) ) ;
13-
14- let root = HTMLParser . parse ( html , {
10+ Referrer : 'https://staging.replit.com/' ,
11+ } ,
12+ } ) . then ( ( res ) => res . text ( ) ) ;
13+
14+ const root = HTMLParser . parse ( html , {
1515 lowerCaseTagName : false ,
1616 comment : false ,
1717 blockTextElements : {
1818 script : true ,
1919 noscript : true ,
2020 style : true ,
21- pre : true
22- }
21+ pre : true ,
22+ } ,
2323 } ) ;
24-
25- return JSON . parse ( atob ( root . childNodes [ 1 ] . childNodes [ 0 ] . childNodes [ 1 ] . childNodes [ 0 ] . rawText . split ( "'" ) [ 1 ] . split ( "'" ) [ 0 ] ) )
24+
25+ return JSON . parse ( atob ( root . childNodes [ 1 ] . childNodes [ 0 ] . childNodes [ 1 ] . childNodes [ 0 ] . rawText . split ( "'" ) [ 1 ] . split ( "'" ) [ 0 ] ) ) ;
2626}
2727
2828export default class Languages {
@@ -31,12 +31,12 @@ export default class Languages {
3131 }
3232
3333 async getLang ( ) {
34- let langs = await _fetchVariable ( ) ;
34+ const langs = await fetchVariable ( ) ;
3535 return langs [ this . lang ] ;
3636 }
3737
3838 async getAllLangs ( ) {
39- let langs = await _fetchVariable ( ) ;
39+ const langs = await fetchVariable ( ) ;
4040 return langs ;
4141 }
42- }
42+ }
0 commit comments