Skip to content

armgit / my-yt

Public Imported from GitHub
0

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

JavaScript

clean logs

Christian Fei1e084a53da02
diff --git a/lib/llm.js b/lib/llm.js
index 82a4e72..3417851 100644
--- a/lib/llm.js
+++ b/lib/llm.js
@@ -23,7 +23,6 @@ export async function fetchAIResponseLMSTUDIO (system, prompt, model = "llama-3.
throw new Error(`HTTP error! Status: ${response.status}`)
}
const data = await response.json()
- // console.log(JSON.stringify(data, null, 2))
let message = data.choices[data.choices.length - 1]?.message?.content || ''
message = message.replace('<|eot_id|>', '')
return message
diff --git a/lib/repository.js b/lib/repository.js
index bb95580..0f88ebe 100644
--- a/lib/repository.js
+++ b/lib/repository.js
@@ -22,7 +22,6 @@ export default class Repository {
getChannels () { return this.channels }
addChannel (name) {
- console.log('addChannel', name)
this.channels.push({name})
this.saveChannels()
}
@@ -37,7 +36,6 @@ export default class Repository {
return this.videos[name]
}
saveChannelVideos(channelName, videos) {
- console.log('saveChannelVideos', channelName, videos.length)
this.videos[channelName] = videos
this.saveVideos()
}
@@ -46,7 +44,6 @@ export default class Repository {
}
setVideoTranscript(id, transcript) {
const video = this.getVideo(id)
- console.log('setVideoTranscript', id, transcript.length)
if (!video) return
this.videos[video.channelName] = this.videos[video.channelName].map(v => {
if (v.id === id) return Object.assign(v, {transcript})
@@ -56,7 +53,6 @@ export default class Repository {
}
setVideoSummary(id, summary) {
const video = this.getVideo(id)
- console.log('setVideoSummary', id, summary.length)
if (!video) return
this.videos[video.channelName] = this.videos[video.channelName].map(v => {
if (v.id === id) return Object.assign(v, {summary})
@@ -66,7 +62,6 @@ export default class Repository {
}
setVideoDownloaded(id) {
const video = this.getVideo(id)
- console.log('setVideoDownloaded', id)
if (!video) return
this.videos[video.channelName] = this.videos[video.channelName].map(v => {
if (v.id === id) return Object.assign(v, {downloaded: true})
diff --git a/lib/server.js b/lib/server.js
index b927f60..b3e221e 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -160,7 +160,6 @@ async function updateAndPersistVideos (repo, callback = () => {}) {
}
async function updateAndPersistVideosForChannel(name, repo, callback = () => {}) {
- console.log('updating videos for', name)
let videos = await getVideosFor(name)
if (videos) {
videos = videos.map(v => patchVideo(v, repo))
diff --git a/lib/subtitles-summary.js b/lib/subtitles-summary.js
index c2a43d2..9fdc901 100644
--- a/lib/subtitles-summary.js
+++ b/lib/subtitles-summary.js
@@ -16,10 +16,8 @@ export async function summarizeVideo(id, repo, callback = () => {}) {
Extract the key points from the following video transcript:
${cleanedTranscript.replace('\n', ' ')}`
- // console.log('userPrompt', userPrompt)
const systemPrompt = "You're a helpful assistant that sumarizes a video transcript in max 10 sentences, extracting the key points"
const summary = await fetchAIResponseLMSTUDIO(systemPrompt, userPrompt)
- // console.log('summary', summary)
repo.setVideoSummary(id, summary)
console.log('Download completed')
diff --git a/lib/youtube.js b/lib/youtube.js
index 5675a97..0377b45 100644
--- a/lib/youtube.js
+++ b/lib/youtube.js
@@ -5,7 +5,6 @@ export async function downloadVideo(id, repo, callback = () => {}) {
try {
for await (const line of execa`yt-dlp -f mp4 ${id} -o ./data/videos/${id}.mp4`.iterable()) {
callback(line)
- console.log(line)
}
repo.setVideoDownloaded(id)
@@ -18,7 +17,6 @@ export async function downloadVideo(id, repo, callback = () => {}) {
export async function getVideoSubtitles (id, callback = () => {}) {
for await (const line of execa`yt-dlp --skip-download --write-subs --write-auto-subs --sub-lang en --sub-format ttml --convert-subs srt --default-search ytsearch ${id} -o ./data/videos/${id}-sub`.iterable()) {
callback(line)
- console.log(line)
}
const transcriptPath = `./data/videos/${id}-sub.en.srt`
const transcript = fs.readFileSync(transcriptPath, 'utf-8')