mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[scraper] add html entities escape
This commit is contained in:
@@ -80,6 +80,14 @@ function escapeTitle(title) {
|
||||
.trim();
|
||||
}
|
||||
|
||||
function escapeHTML(title) {
|
||||
return title
|
||||
.replace(/'|'/g, '\'')
|
||||
.replace(/&|&/g, '&')
|
||||
.replace(/!/g, '!')
|
||||
.replace(/%/g, '%');
|
||||
}
|
||||
|
||||
async function getImdbId(info, type) {
|
||||
const name = escapeTitle(info.title);
|
||||
const year = info.year || info.date && info.date.slice(0, 4);
|
||||
@@ -121,4 +129,4 @@ async function getKitsuId(info) {
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports = { getMetadata, getImdbId, getKitsuId };
|
||||
module.exports = { getMetadata, getImdbId, getKitsuId, escapeHTML };
|
||||
|
||||
Reference in New Issue
Block a user