From 14c4cce88e9691d06ac4ef7cf525383a7fb68208 Mon Sep 17 00:00:00 2001 From: MillenniumEarl Date: Mon, 30 Nov 2020 13:22:35 +0100 Subject: [PATCH] More robust ID parser --- app/scripts/scraper.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/scripts/scraper.js b/app/scripts/scraper.js index 31fe883..1455f28 100644 --- a/app/scripts/scraper.js +++ b/app/scripts/scraper.js @@ -375,13 +375,12 @@ function isMod(prefix) { */ function extractIDFromURL(url) { // URL are in the format https://f95zone.to/threads/GAMENAME-VERSION-DEVELOPER.ID/ - const splitted = url.split("."); - - // We took the last part (clean it) - const value = splitted.pop().replace("/", "").trim(); + // or https://f95zone.to/threads/ID/ + const match = url.match(/(\.)?([0-9]+)(?!-)/); + if(!match) return -1; // Parse and return number - return parseInt(value, 10); + return parseInt(match[0], 10); } /**