-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Looks like howlongtobeat changed the api yet again, despite them changing it like 2 days ago...
First of all, they returned to the api_key solution, however this time it consists of two concats instead of one.
/api/search/".concat("7b0f03b2").concat("54cc3099")
Here's the quick code I whipped to make the send_website_request_getcode
retriever work again:
if script_resp.status_code == 200 and script_resp.text is not None:
pattern = r'\/api\/search\/"(?:\.concat\("[^"]*"\))*'
matches = re.findall(pattern, script_resp.text)
matches = str(matches).split('.concat')
matches = [re.sub(r'["\(\)\[\]\']', '', match) for match in matches[1:]]
key = ''.join(matches)
return key
Also the headers and payload changed ever so slightly. Those worked for me:
headers = {
'Host': 'howlongtobeat.com',
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Referer': 'https://howlongtobeat.com',
'Content-Type': 'application/json',
'Origin': 'https://howlongtobeat.com',
'Connection': 'keep-alive'
}
payload = {
'searchType': "games",
'searchTerms': game_name.split(),
'searchPage': page,
'size': 20,
'searchOptions': {
'games': {
'userId': 0,
'platform': "",
'sortCategory': "popular",
'rangeCategory': "main",
'rangeTime': {
'min': 0,
'max': 0
},
'gameplay': {
'perspective': "",
'flow': "",
'genre': "",
'subGenre': ""
},
'modifier': search_modifiers.value,
},
'users': {
'sortCategory': "postcount"
},
'lists': {
'sortCategory': "follows"
},
'filter': "",
'sort': 0,
'randomizer': 0
}
}
I guess the freshly added solution should still be kept, in case they change the api yet again. Possibly first try the api key, then the custom userId in case the key doesn't work?
ceryl-bruitzman-topicus
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working