From 09eb7a6a385e2c4146baa083187e44e7c219a7ad Mon Sep 17 00:00:00 2001 From: Oleg Anashkin Date: Sun, 12 Jun 2022 19:48:41 -0700 Subject: [PATCH] Add a todo for youtube plugin --- plugins/youtube_a.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/plugins/youtube_a.js b/plugins/youtube_a.js index 1d32d49d5..5960ca3ba 100644 --- a/plugins/youtube_a.js +++ b/plugins/youtube_a.js @@ -40,9 +40,24 @@ hoverZoomPlugins.push({ if (match && match.length >= 2) { const json = JSON.parse(match[1]); const formats = json.streamingData.formats; -// const adaptiveFormats = json.streamingData.adaptiveFormats; - let src = getSource(formats, "mp4", "hd1080") || getSource(formats, "webm", "hd1080"); -// || getSource(adaptiveFormats, "webm", "hd720") || getSource(adaptiveFormats, "mp4", "hd720"); + const adaptiveFormats = json.streamingData.adaptiveFormats; + let src = getSource(formats, "mp4", "hd1080") || getSource(formats, "webm", "hd1080") + || getSource(adaptiveFormats, "webm", "hd720") || getSource(adaptiveFormats, "mp4", "hd720"); + // TODO: Figure out how to decode youtube signature for embedded players + // if (!src.url && src.signatureCipher) { + // let parts = src.signatureCipher.split('&'); + // let sig = null; + // for (const part of parts) { + // console.log(part); + // let sides = part.split('='); + // if (sides[0] === 's') { + // sig = decodeURIComponent(sides[1]); + // } + // if (sides[0] === 'url') { + // src.url = decodeURIComponent(sides[1]); + // } + // } + // } if (src && src.url) { link.data().hoverZoomSrc = [start ? src.url + '#t=' + start : src.url]; link.addClass('hoverZoomLink');