From 2e77d7f4974cf5b1da4dabfc2445ed370614e607 Mon Sep 17 00:00:00 2001 From: Maria Schreiber Date: Wed, 22 Nov 2017 18:44:29 -0500 Subject: [PATCH] fix: remove font tags --- src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 28f48bf..4a2ee81 100644 --- a/src/index.js +++ b/src/index.js @@ -46,10 +46,12 @@ export async function getSubtitles({ const [, start] = startRegex.exec(line); const [, dur] = durRegex.exec(line); + const fontTag = new RegExp('<'+'font'+'[^><]*>|<.'+'font'+'[^><]*>','g'); const htmlText = line .replace(//, '') .replace(/&/gi, '&') - .replace(/<\/?[^>]+(>|$)/g, ''); + .replace(/<\/?[^>]+(>|$)/g, '') + .replace(fontTag, ''); const text = he.decode(htmlText);