A clean and minimal youtube frontend, without all the ads and whistles
JavaScript
refactor toInternalVideo
Christian Feia3d80190eef3
diff --git a/lib/youtube.js b/lib/youtube.jsindex 54c14d2..91573b4 100644--- a/lib/youtube.js+++ b/lib/youtube.js@@ -59,18 +59,18 @@ export async function getVideosFor(channelName) {function toInternalVideo(v) {if (!v || !v.richItemRenderer) return+ const data = v.richItemRenderer.content.videoRendererreturn {channelName,- title: v.richItemRenderer.content.videoRenderer.title?.runs[0].text,- url: `https://www.youtube.com/watch?v=${v.richItemRenderer.content.videoRenderer.videoId}`,- thumbnail: `https://img.youtube.com/vi/${v.richItemRenderer.content.videoRenderer.videoId}/mqdefault.jpg`,- // thumbnail: v.richItemRenderer.content.videoRenderer.thumbnail?.thumbnails[0].url,- description: v.richItemRenderer.content.videoRenderer.descriptionSnippet?.runs[0].text,- id: v.richItemRenderer.content.videoRenderer.videoId,- publishedTime: v.richItemRenderer.content.videoRenderer.publishedTimeText?.simpleText,- publishedAt: parseRelativeTime(v.richItemRenderer.content.videoRenderer.publishedTimeText?.simpleText),- viewCount: v.richItemRenderer.content.videoRenderer.viewCountText?.simpleText,- duration: v.richItemRenderer.content.videoRenderer.lengthText?.simpleText,+ title: data.title?.runs[0].text,+ url: `https://www.youtube.com/watch?v=${data.videoId}`,+ thumbnail: `https://img.youtube.com/vi/${data.videoId}/mqdefault.jpg`,+ description: data.descriptionSnippet?.runs[0].text,+ id: data.videoId,+ publishedTime: data.publishedTimeText?.simpleText,+ publishedAt: parseRelativeTime(data.publishedTimeText?.simpleText),+ viewCount: data.viewCountText?.simpleText,+ duration: data.lengthText?.simpleText,}}}