A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
video summary wip
Christian Feie0aca66b2e24
diff --git a/index.html b/index.htmlindex 718e879..fdce51c 100644--- a/index.html+++ b/index.html@@ -230,6 +230,7 @@appendChannelSectionTo(name, videos, $channelsContainer)}handleNewVideos(data.videos)+ window.videos = data.videosapplyFoldedChannels(store.get(store.foldedChannelsKey))}@@ -241,6 +242,7 @@} else {appendChannelSectionTo(data.name, data.videos, $channelsContainer)}+ window.videos[data.name] = data.videoshandleNewVideos(data.videos)}@@ -313,7 +315,7 @@$videoPlayer.addEventListener('close', () => $videoPlayer.querySelector('video')?.pause())// summary modal- const $summaryModal = document.querySelector('dialog#video-player')+ const $summaryModal = document.querySelector('dialog#summary')const $closeSummary = $summaryModal.querySelector("button")$closeSummary.addEventListener("click", () => $summaryModal.close())$summaryModal.addEventListener('close', () => {})@@ -532,8 +534,14 @@function showSummaryHandler (event) {event.preventDefault()const videoId = event.target.dataset.videoId- const summary = event.target.dataset.summary- console.log(summary)+ for (const [name, videos] of Object.entries(window.videos)) {+ const video = videos.find(video => video.id === videoId)+ if (video) {+ document.querySelector('dialog#summary').showModal()+ document.querySelector('dialog#summary div').innerText = video.summary+ return+ }+ }}</script></body>diff --git a/server.js b/server.jsindex 5db5ae0..219e481 100644--- a/server.js+++ b/server.js@@ -179,8 +179,7 @@ async function summarizeVideo(id, repo) {const {response} = await fetchAIResponse(`Summarize the following transcript of a YouTube video, avoid talking about the host and avoid describing the context, keep it short, to the point, and fit it in max 10 paragraphs: \n ${cleanedTranscript}`)console.log(response)repo.setVideoSummary(id, response)-- repo.setVideoDownloaded(id)+console.log('Download completed')} catch (error) {console.error('Error downloading video:', error)