Skip to content

Commit a746c98

Browse files
authored
Merge pull request #38 from rarDevelopment/master
another fix for the url changing
2 parents 6be69cd + b9ca77c commit a746c98

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

howlongtobeatpy/howlongtobeatpy/HTMLRequests.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SearchModifiers(Enum):
2727
class HTMLRequests:
2828
BASE_URL = 'https://howlongtobeat.com/'
2929
REFERER_HEADER = BASE_URL
30-
SEARCH_URL = BASE_URL + "api/find"
30+
SEARCH_URL = BASE_URL + "api/lookup"
3131
GAME_URL = BASE_URL + "game"
3232

3333
@staticmethod
@@ -116,7 +116,7 @@ def send_web_request(game_name: str, search_modifiers: SearchModifiers = SearchM
116116
if api_key_result is None:
117117
api_key_result = HTMLRequests.send_website_request_getcode(True)
118118
# Make the request
119-
# The main method currently is the call to api/find/key
119+
# The main method currently is the call to api/lookup/key
120120
search_url_with_key = HTMLRequests.SEARCH_URL + "/" + api_key_result
121121
payload = HTMLRequests.get_search_request_data(game_name, search_modifiers, page, None)
122122
resp = requests.post(search_url_with_key, headers=headers, data=payload, timeout=60)
@@ -145,7 +145,7 @@ async def send_async_web_request(game_name: str, search_modifiers: SearchModifie
145145
if api_key_result is None:
146146
api_key_result = await HTMLRequests.async_send_website_request_getcode(True)
147147
# Make the request
148-
# The main method currently is the call to api/find/key
148+
# The main method currently is the call to api/lookup/key
149149
search_url_with_key = HTMLRequests.SEARCH_URL + "/" + api_key_result
150150
payload = HTMLRequests.get_search_request_data(game_name, search_modifiers, page, None)
151151
async with aiohttp.ClientSession() as session:
@@ -253,8 +253,8 @@ def extract_api_from_script(script_content: str):
253253
if matches:
254254
key = ''.join(matches)
255255
return key
256-
# Test 2 - The API Key is in format fetch("/api/find/".concat("X").concat("Y")...
257-
concat_api_key_pattern = r'\/api\/find\/"(?:\.concat\("[^"]*"\))*'
256+
# Test 2 - The API Key is in format fetch("/api/lookup/".concat("X").concat("Y")...
257+
concat_api_key_pattern = r'\/api\/lookup\/"(?:\.concat\("[^"]*"\))*'
258258
matches = re.findall(concat_api_key_pattern, script_content)
259259
if matches:
260260
matches = str(matches).split('.concat')
@@ -267,7 +267,7 @@ def extract_api_from_script(script_content: str):
267267
@staticmethod
268268
def send_website_request_getcode(parse_all_scripts: bool):
269269
"""
270-
Function that send a request to howlongtobeat to scrape the /api/find key
270+
Function that send a request to howlongtobeat to scrape the /api/lookup key
271271
@return: The string key to use
272272
"""
273273
# Make the post request and return the result if is valid
@@ -294,7 +294,7 @@ def send_website_request_getcode(parse_all_scripts: bool):
294294
@staticmethod
295295
async def async_send_website_request_getcode(parse_all_scripts: bool):
296296
"""
297-
Function that send a request to howlongtobeat to scrape the /api/find key
297+
Function that send a request to howlongtobeat to scrape the /api/lookup key
298298
@return: The string key to use
299299
"""
300300
# Make the post request and return the result if is valid

0 commit comments

Comments
 (0)