diff --git a/package.json b/package.json index cb43158..2e62eee 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "dependencies": { "axios": "^0.17.1", "he": "^1.1.1", - "lodash": "^4.17.4" + "lodash": "^4.17.4", + "striptags": "^3.1.0" } } diff --git a/src/index.js b/src/index.js index 28f48bf..dbdf9bf 100644 --- a/src/index.js +++ b/src/index.js @@ -3,6 +3,7 @@ import he from 'he'; import axios from 'axios'; import { find } from 'lodash'; +import striptags from 'striptags'; export async function getSubtitles({ videoID, @@ -51,7 +52,9 @@ export async function getSubtitles({ .replace(/&/gi, '&') .replace(/<\/?[^>]+(>|$)/g, ''); - const text = he.decode(htmlText); + const strippedText = striptags(htmlText); + + const text = he.decode(strippedText); return { start, dur, text }; });