A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
cleanup subs
Christian Fei7246159d0062
diff --git a/lib/subtitles-summary.js b/lib/subtitles-summary.jsindex 496f0ce..02ec6b9 100644--- a/lib/subtitles-summary.js+++ b/lib/subtitles-summary.js@@ -7,20 +7,20 @@ export async function summarizeVideo(id, repo, callback = () => {}) {try {const transcript = await getVideoSubtitles(id, callback)let cleanedTranscript = cleanTranscript(transcript)- console.log('cleanedTranscript.length', cleanedTranscript.length)repo.setVideoTranscript(id, cleanedTranscript)cleanedTranscript = cleanedTranscript.replace('\n', ' ')fs.writeFileSync(`./data/videos/${id}.en.txt`, cleanedTranscript)+ console.log('cleanedTranscript.length', cleanedTranscript.length)const userPrompt = `Extract the key points from the following video transcript:- ${cleanedTranscript.replace('\n', ' ')}`+ ${cleanedTranscript}`const systemPrompt = "You're a helpful assistant that sumarizes a video transcript in max 10 sentences, extracting the key points"const summary = await fetchCompletionLMSTUDIO(systemPrompt, userPrompt)repo.setVideoSummary(id, summary)- console.log('Download completed', summary)+ console.log('Summary completed')resolve({summary, transcript: cleanedTranscript})} catch (error) {console.error('Error summarizing video', id)diff --git a/lib/youtube.js b/lib/youtube.jsindex 019bf51..a38db3a 100644--- a/lib/youtube.js+++ b/lib/youtube.js@@ -23,7 +23,7 @@ export async function getVideoSubtitles (id, callback = () => {}) {try {const transcriptPath = `./data/videos/${id}.en.srt`if (!fs.existsSync(transcriptPath)) {- for await (const line of execa`yt-dlp --default-search ytsearch --skip-download --write-subs --write-auto-subs --sub-lang en --sub-format ttml --convert-subs srt "${id}" -o ./data/videos/${id}`.iterable()) {+ for await (const line of execa`yt-dlp --default-search ytsearch "${id}" -o ./data/videos/${id} --skip-download --write-subs --write-auto-subs --sub-lang en --sub-format ttml --convert-subs srt`.iterable()) {callback(line)}}