-
Notifications
You must be signed in to change notification settings - Fork 0
Description
First of all, thank you for your 评分对比助手 script, it's great. Unfortunately, it has some problems.
The extraction of the VNDB score appears to be broken. But it can be fixed by replacing const s = vote.match(/average (\d+(\.\d+))/);
with const s = vote.match(/(\d+(\.\d+)?)(?= average)/);
Additionally, the search logic requires enhancement as it is currently unable to retrieve game pages on EGS and VNDB when there are discrepancies such as between = and =, 2 and 2, Ⅲ and III, - and -, etc. I managed to slightly improve results by modifying normalizeQuery
function:
let newQuery = query
.replace(/([^~]*~[^~]*~[^~]*)/g, function(match) { return match.replace(/~|~/g, ' '); })
.replace(/=|=/g, ' ')
.replace(/0/g, '0')
.replace(/1/g, '1')
.replace(/2/g, '2')
.replace(/3/g, '3')
.replace(/4/g, '4')
.replace(/5/g, '5')
.replace(/6/g, '6')
.replace(/7/g, '7')
.replace(/8/g, '8')
.replace(/9/g, '9')
.replace(/Ⅰ/g, 'I')
.replace(/Ⅱ/g, 'II')
.replace(/Ⅲ/g, 'III')
.replace(/Ⅳ/g, 'IV')
.replace(/Ⅴ/g, 'V')
.replace(/Ⅵ/g, 'VI')
.replace(/Ⅶ/g, 'VII')
.replace(/Ⅷ/g, 'VIII')
.replace(/Ⅸ/g, 'IX')
.replace(/Ⅹ/g, 'X')
.replace(/-|-/g, ' ')
.replace(/\s{2,}/g, ' ')
.replace(/~/g, '~')
.trim();
return newQuery;
}
In addition to this, sometimes when fetching scores for some visual novels from EGS, the script fetches them from a random port of said visual novel that has a significantly smaller number of votes. The expected behavior should be either to fetch the score from the entry with the most number of votes or not to fetch scores automatically at all and prompt a user to press ‘Click to search’ instead.
See: https://vndb.org/v7302
https://vndb.org/v18498
https://vndb.org/v22783
https://vndb.org/v15473
https://vndb.org/v751
https://vndb.org/v57
https://vndb.org/v12849
https://vndb.org/v5154
https://vndb.org/v19684
https://vndb.org/v20424
https://vndb.org/v13666
https://vndb.org/v17
https://vndb.org/v7723
https://vndb.org/v29444
Another problem I encountered is also with fetching scores from EGS. It keeps fetching the 中央値 even when score: (_b = (_a = $q('#average > td')) === null || _a === void 0 ? void 0 : _a.textContent.trim()) !== null && _b !== void 0 ? _b : 0,
is set.
Upon further investigation, it seems the script fetches a score number from the search page instead of the game page, and the search page only has the 中央値 value. When a user opens the game page on their own, the score number on other sites successfully updates to the average value. So, as I see it, the problem is that the score fetching is happening in the getSearchItem$1
function instead of the getSearchResult$1
function.