@@ -107,6 +107,7 @@ class HTMLRequests:
107107 GAME_URL = BASE_URL + "game"
108108 # Static search url to use in case it can't be extracted from JS code
109109 SEARCH_URL = BASE_URL + "api/s/"
110+ HTML_PARSER = 'html.parser'
110111
111112 @staticmethod
112113 def get_search_request_headers (auth_struct , user_agent ):
@@ -266,7 +267,7 @@ def __cut_game_title(page_source: str):
266267 if page_source is None or len (page_source ) == 0 :
267268 return None
268269
269- soup = BeautifulSoup (page_source , 'html.parser' )
270+ soup = BeautifulSoup (page_source , HTMLRequests . HTML_PARSER )
270271 title_tag = soup .title
271272 title_text = title_tag .string
272273
@@ -352,7 +353,7 @@ def send_website_request_getcode(parse_all_scripts: bool, user_agent):
352353 resp = requests .get (HTMLRequests .BASE_URL , headers = headers , timeout = 60 )
353354 if resp .status_code == 200 and resp .text is not None :
354355 # Parse the HTML content using BeautifulSoup
355- soup = BeautifulSoup (resp .text , 'html.parser' )
356+ soup = BeautifulSoup (resp .text , HTMLRequests . HTML_PARSER )
356357 # Find all <script> tags with a src attribute containing the substring
357358 scripts = soup .find_all ('script' , src = True )
358359 if parse_all_scripts :
@@ -382,7 +383,7 @@ async def async_send_website_request_getcode(parse_all_scripts: bool, user_agent
382383 if resp is not None and resp .status == 200 :
383384 resp_text = await resp .text ()
384385 # Parse the HTML content using BeautifulSoup
385- soup = BeautifulSoup (resp_text , 'html.parser' )
386+ soup = BeautifulSoup (resp_text , HTMLRequests . HTML_PARSER )
386387 # Find all <script> tags with a src attribute containing the substring
387388 scripts = soup .find_all ('script' , src = True )
388389 if parse_all_scripts :
0 commit comments