mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-15 00:12:38 +02:00
Clean Anilist HTML
This commit is contained in:
@@ -116,4 +116,16 @@ module.exports = class Util {
|
||||
if (no.includes(choice)) return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
static cleanAnilistHTML(html) {
|
||||
let clean = html
|
||||
.replace(/(<br>)+/g, '\n')
|
||||
.replace(/'/g, '\'')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/<\/?i>/g, '*')
|
||||
.replace(/~!|!~/g, '||');
|
||||
const spoilers = (clean.substr(0, 1997).match(/\|\|/g) || []).length;
|
||||
if (spoilers !== 0 && (spoilers && (spoilers % 2))) clean += '||';
|
||||
return clean;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user