Hey everyone. Unfortunately I don't have a development environment for Decky plugins so I'll just paste some code here.
This should fix the plugin theoritically:
async function fetchSearchKey() {
try {
const url = 'https://howlongtobeat.com';
const response = await fetchNoCors(url);
if (response.status === 200) {
const html = await response.text();
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const scripts = doc.querySelectorAll('script');
for (const script of scripts) {
if (script.src.includes('_app-')) {
const scriptUrl = url + new URL(script.src).pathname;
const scriptResponse = await fetchNoCors(scriptUrl);
if (scriptResponse.status === 200) {
const scriptText = await scriptResponse.text();
// Updated pattern to match multiple .concat calls
const pattern =
/\/api\/search\/"\.concat\("([a-zA-Z0-9]+)"\)\.concat\("([a-zA-Z0-9]+)"\)/;
const matches = scriptText.match(pattern);
if (matches && matches[1] && matches[2]) {
// Combine key fragments from matches
const apiKey = `${matches[1]}${matches[2]}`;
console.log('HLTB API Key:', apiKey);
return apiKey;
}
}
}
}
console.error('HLTB - failed to get API key!');
} else {
console.error('HLTB', response);
}
} catch (error) {
console.error('Error fetching HLTB API key:', error);
}
return null;
}
Hey everyone. Unfortunately I don't have a development environment for Decky plugins so I'll just paste some code here.
This should fix the plugin theoritically: