Skip to content

armgit / my-yt

Public Imported from GitHub
0

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

JavaScript

update all videos upon summary

Christian Feie576f1caf105
diff --git a/client/main.js b/client/main.js
index bbcf382..0f5b766 100644
--- a/client/main.js
+++ b/client/main.js
@@ -183,22 +183,20 @@ eventSource.onmessage = (message) => {
window.videos = data.videos
}
if (data.type === 'summary' && data.videoId && data.summary && data.transcript) {
- const $video = document.querySelector(`[data-video-id="${data.videoId}"]`)
- if ($video) {
+ ;[...document.querySelectorAll(`[data-video-id="${data.videoId}"]`)].forEach($video => {
const videoData = JSON.parse($video.dataset['data'])
Object.assign(videoData, { summary: data.summary, transcript: data.transcript })
$video.dataset['data'] = JSON.stringify(videoData)
updateSummarizedVideos([data.videoId])
- }
+ })
}
if (data.type === 'downloaded' && data.videoId) {
- const $video = document.querySelector(`[data-video-id="${data.videoId}"]`)
- if ($video) {
+ ;[...document.querySelectorAll(`[data-video-id="${data.videoId}"]`)].forEach($video => {
const videoData = JSON.parse($video.dataset['data'])
videoData.downloaded = true
$video.dataset['data'] = JSON.stringify(videoData)
updateDownloadedVideos([data.videoId])
- }
+ })
}
} catch (err) {
console.error('sse parse error', err)