[scraper] do not escape hyphen when searching for id

This commit is contained in:
TheBeastLT
2020-03-28 23:58:31 +01:00
parent 34486230ea
commit ee8897a088
3 changed files with 6 additions and 6 deletions

4
package-lock.json generated
View File

@@ -1620,8 +1620,8 @@
} }
}, },
"parse-torrent-title": { "parse-torrent-title": {
"version": "git://github.com/TheBeastLT/parse-torrent-title.git#826ee1a8a832e8c18fcc0703f5b56a8b9acd4283", "version": "git://github.com/TheBeastLT/parse-torrent-title.git#299b6818907542086ce5d88f11f9359efa145928",
"from": "git://github.com/TheBeastLT/parse-torrent-title.git#826ee1a8a832e8c18fcc0703f5b56a8b9acd4283", "from": "git://github.com/TheBeastLT/parse-torrent-title.git#299b6818907542086ce5d88f11f9359efa145928",
"requires": { "requires": {
"moment": "^2.24.0" "moment": "^2.24.0"
} }

View File

@@ -32,7 +32,7 @@
"node-schedule": "^1.3.2", "node-schedule": "^1.3.2",
"nodejs-bing": "^0.1.0", "nodejs-bing": "^0.1.0",
"parse-torrent": "^6.1.2", "parse-torrent": "^6.1.2",
"parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#826ee1a8a832e8c18fcc0703f5b56a8b9acd4283", "parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#299b6818907542086ce5d88f11f9359efa145928",
"peer-search": "^0.6.x", "peer-search": "^0.6.x",
"pg": "^7.8.2", "pg": "^7.8.2",
"pg-hstore": "^2.3.2", "pg-hstore": "^2.3.2",

View File

@@ -83,8 +83,8 @@ function escapeTitle(title) {
.normalize('NFKD') // normalize non-ASCII characters .normalize('NFKD') // normalize non-ASCII characters
.replace(/[\u0300-\u036F]/g, '') .replace(/[\u0300-\u036F]/g, '')
.replace(/&/g, 'and') .replace(/&/g, 'and')
.replace(/[;, ~\-]+/g, ' ') // replace dots, commas or underscores with spaces .replace(/[;, ~]+/g, ' ') // replace dots, commas or underscores with spaces
.replace(/[^\w ()+#@!']+/g, '') // remove all non-alphanumeric chars .replace(/[^\w \-()+#@!']+/g, '') // remove all non-alphanumeric chars
.trim(); .trim();
} }
@@ -119,7 +119,7 @@ async function getImdbId(info, type) {
async function getKitsuId(info) { async function getKitsuId(info) {
const title = escapeTitle(info.title); const title = escapeTitle(info.title);
const year = info.year ? ` ${info.year} ` : ''; const year = info.year ? ` ${info.year}` : '';
const season = info.season > 1 ? ` S${info.season}` : ''; const season = info.season > 1 ? ` S${info.season}` : '';
const query = `${title}${year}${season}`; const query = `${title}${year}${season}`;