diff --git a/howlongtobeatpy/howlongtobeatpy/HTMLRequests.py b/howlongtobeatpy/howlongtobeatpy/HTMLRequests.py index a42a46f..0f5e59c 100644 --- a/howlongtobeatpy/howlongtobeatpy/HTMLRequests.py +++ b/howlongtobeatpy/howlongtobeatpy/HTMLRequests.py @@ -75,7 +75,7 @@ def __extract_search_url_script(self, script_content: str): class SearchAuthToken: - search_url = "api/s" + search_url = "api/bleed" search_url_endpoint = "/init" auth_token = None auth_key = None @@ -105,8 +105,12 @@ class HTMLRequests: BASE_URL = 'https://howlongtobeat.com/' REFERER_HEADER = BASE_URL GAME_URL = BASE_URL + "game" - # Static search url to use in case it can't be extracted from JS code - SEARCH_URL = BASE_URL + "api/s/" + # Static search url used as a fallback if extraction from JS fails. + # HLTB rotates this name periodically (api/find -> api/finder -> api/bleed, + # current as of 2026-05). The runtime extraction in + # send_website_request_getcode is the source of truth — this is just + # a backstop. + SEARCH_URL = BASE_URL + "api/bleed" HTML_PARSER = 'html.parser' @staticmethod @@ -347,6 +351,13 @@ def send_website_request_getcode(parse_all_scripts: bool, user_agent): """ Function that send a request to howlongtobeat to scrape the correct search url @return: The search informations to use in the request + + Note: ``parse_all_scripts`` is kept for backward compatibility but no + longer changes which scripts are inspected. HLTB used to bundle the + relevant code under ``_app-*.js``, but the modern (Turbopack) build + emits opaque chunk names like ``0-~-0up.q3_p0.js``, so a name-based + filter is no longer reliable — we iterate every ``