diff --git a/app/scripts/scraper.js b/app/scripts/scraper.js index 129c90c..2c0fa15 100644 --- a/app/scripts/scraper.js +++ b/app/scripts/scraper.js @@ -133,7 +133,17 @@ function extractInfoFromTitle(body) { // is malformes and only the author is fetched // (usually the author is always present) let version = null; - if (matches.length >= 2) version = matches[matches.length - 2].replace(/[[\]]+/g, "").trim(); + if (matches.length >= 2) { + version = matches[matches.length - 2].replace(/[[\]]+/g, "").trim(); + + // If the version is in the format v1.0 remove the "v" + if (version[0].toUpperCase() === "V" && !isNaN(version[1])) { + const indexOfCharToRemove = 0; // The first letter + const tmp = version.split(""); // Convert to an array + tmp.splice(indexOfCharToRemove, 1); // Remove the first element + version = tmp.join(""); // Reconstruct the version + } + } else shared.logger.trace(`Malformed title: ${title}`); // Last element diff --git a/package.json b/package.json index 621ee58..099ba88 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "scripts": { "unit-test-mocha": "nyc --reporter=text mocha './test/index-test.js'", "report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov -t 38ad72bf-a29d-4c2e-9827-96cbe037afd2", - "test": "node ./test/user-test.js", + "run-example": "node ./app/example.js", "deploy": "npm pack" }, "engines": {