mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-15 02:50:10 +01:00
parent
f787502755
commit
be3b0b4916
@ -47,10 +47,12 @@ class YoutubeTranscript {
|
|||||||
let transcript = "";
|
let transcript = "";
|
||||||
const chunks = transcriptXML.getElementsByTagName("text");
|
const chunks = transcriptXML.getElementsByTagName("text");
|
||||||
for (const chunk of chunks) {
|
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) {
|
} catch (e) {
|
||||||
throw new YoutubeTranscriptError(e);
|
throw new YoutubeTranscriptError(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user