fix: update devil fruit extraction to handle redirects and ensure correct title retrieval
Some checks failed
Build Docker Image / build (push) Has been cancelled

This commit is contained in:
2026-03-14 15:41:20 +01:00
parent 66afda5101
commit 4e95abf09f

View File

@@ -611,9 +611,14 @@ async function extractDevilFruit($: cheerio.CheerioAPI): Promise<DevilFruitData
const cleanUrl = href.replace('/wiki/', '');
// Query the devil fruit page via API to get the correct HTML content (in case of redirect) and extract the type from there
const dfResponse = await fetchWithRetry(`${FANDOM_API_BASE}${cleanUrl}`);
const dfJsonData = await dfResponse.json();
const fruitTitle = dfJsonData.parse?.title || '';
return {
devilFruitId: normalizeId(cleanUrl),
devilFruitUrl: cleanUrl
devilFruitId: normalizeId(fruitTitle),
devilFruitUrl: fruitTitle
};
}