From 7a8445ba2d3382123f6b6152d6b8c9fddae29919 Mon Sep 17 00:00:00 2001 From: "samuele.berlusconi" Date: Thu, 22 Oct 2020 14:06:23 +0200 Subject: [PATCH] The games version is now parsed from the title --- app/scripts/game-scraper.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/scripts/game-scraper.js b/app/scripts/game-scraper.js index af4785d..67ba911 100644 --- a/app/scripts/game-scraper.js +++ b/app/scripts/game-scraper.js @@ -45,6 +45,7 @@ module.exports.getGameInfo = async function (browser, url) { info = await parsePrefixes(page, info); // Fill status/engines/isMod const structuredText = await getMainPostStructuredText(page); const overview = getOverview(structuredText, info.isMod); + const parsedInfos = parseConversationPage(structuredText); const previewSource = getGamePreviewSource(page); const changelog = getLastChangelog(page); @@ -55,12 +56,12 @@ module.exports.getGameInfo = async function (browser, url) { info.tags = await tags; info.f95url = await redirectUrl; info.overview = overview; - info.version = info.isMod ? cleanFSString(parsedInfos.MOD_VERSION) : cleanFSString(parsedInfos.VERSION); info.lastUpdate = info.isMod ? parsedInfos.UPDATED : parsedInfos.THREAD_UPDATED; info.previewSource = await previewSource; info.changelog = await changelog; + info.version = await getGameVersionFromTitle(browser, info); //let downloadData = getGameDownloadLink(page); //info.downloadInfo = await downloadData; @@ -101,7 +102,7 @@ module.exports.getGameVersionFromTitle = async function (browser, info) { let version = title.substring(startIndex, endIndex).trim().toUpperCase(); if (version.startsWith("V")) version = version.replace("V", ""); // Replace only the first occurrence await page.close(); - return version; + return cleanFSString(version); }; //#region Private methods