Skip to content
Snippets Groups Projects
Unverified Commit be3b0b49 authored by Sean Hatfield's avatar Sean Hatfield Committed by GitHub
Browse files

Youtube loader whitespace fix (#2051)

youtube loader whitespace fix
parent f7875027
No related branches found
No related tags found
No related merge requests found
......@@ -47,10 +47,12 @@ class YoutubeTranscript {
let transcript = "";
const chunks = transcriptXML.getElementsByTagName("text");
for (const chunk of chunks) {
transcript += chunk.textContent;
// Add space after each text chunk
transcript += chunk.textContent + " ";
}
return transcript;
// Trim extra whitespace
return transcript.trim().replace(/\s+/g, " ");
} catch (e) {
throw new YoutubeTranscriptError(e);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment