mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
updates horriblesubs scraper to split multiple season entries
This commit is contained in:
@@ -67,18 +67,18 @@ function _requestMetadata(url) {
|
||||
});
|
||||
}
|
||||
|
||||
function escapeTitle(title, hyphenEscape = true) {
|
||||
function escapeTitle(title) {
|
||||
return title.toLowerCase()
|
||||
.normalize('NFKD') // normalize non-ASCII characters
|
||||
.replace(/[\u0300-\u036F]/g, '')
|
||||
.replace(/&/g, 'and')
|
||||
.replace(hyphenEscape ? /[.,_+ -]+/g : /[.,_+ ]+/g, ' ') // replace dots, commas or underscores with spaces
|
||||
.replace(/[^\w- ()]/gi, '') // remove all non-alphanumeric chars
|
||||
.replace(/[;, ~\-]+/g, ' ') // replace dots, commas or underscores with spaces
|
||||
.replace(/[^\w ()+#@!']+/g, '') // remove all non-alphanumeric chars
|
||||
.trim();
|
||||
}
|
||||
|
||||
async function getImdbId(info, type) {
|
||||
const name = escapeTitle(info.title).toLowerCase();
|
||||
const name = escapeTitle(info.title);
|
||||
const year = info.year || info.date && info.date.slice(0, 4);
|
||||
const key = `${name}_${year}_${type}`;
|
||||
|
||||
@@ -100,7 +100,7 @@ async function getImdbId(info, type) {
|
||||
}
|
||||
|
||||
async function getKitsuId(info) {
|
||||
const title = escapeTitle(info.title).toLowerCase().replace(/[;]+/g, ' ').replace(/[,%']+/g, '');
|
||||
const title = escapeTitle(info.title);
|
||||
const season = info.season > 1 ? ` S${info.season}` : '';
|
||||
const query = `${title}${season}`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user