Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

chore: rm callback null when not needed

Christian Feid5db58facca9
diff --git a/lib/subtitles-summary.js b/lib/subtitles-summary.js
index 242a5e0..1e7d612 100644
--- a/lib/subtitles-summary.js
+++ b/lib/subtitles-summary.js
@@ -11,7 +11,7 @@ export async function summarizeVideo (id, repo, llmSettings = {}, callback = ()
repo.setVideoTranscript(id, cleanedTranscript)
cleanedTranscript = cleanedTranscript.replace('\n', ' ')
fs.writeFileSync(`./data/videos/${id}.en.txt`, cleanedTranscript)
- callback(null, 'prompting llm') // eslint-disable-line
+ callback('prompting llm') // eslint-disable-line
const userPrompt = `
Extract the key points from the following video transcript:
@@ -22,7 +22,7 @@ ${cleanedTranscript}`.trim()
Begin by summarizing it into a single paragraph, followed by a longer summary that expands on the key points.
Do not describe or mention the video itself. Simply summarize the points it makes. Focus on the overall or underlying takeaway, cause, reason.`
const summary = await llm.summarize(systemPrompt, userPrompt, llmSettings)
- callback(null, 'received summary') // eslint-disable-line
+ callback('received summary') // eslint-disable-line
repo.setVideoSummary(id, summary)
resolve({ summary, transcript: cleanedTranscript })
} catch (error) {
diff --git a/lib/youtube.js b/lib/youtube.js
index 74a38d8..52785ed 100644
--- a/lib/youtube.js
+++ b/lib/youtube.js
@@ -63,7 +63,7 @@ export async function getVideoSubtitles (id, callback = () => {}) {
if (!fs.existsSync(transcriptPath)) {
for await (const line of ytdlp.subtitles(id)) {
console.log(line)
- callback(null, line)
+ callback(line)
}
}
normalizeSubtitleFiles(id)