Skip to content

Commit

Permalink
Add a todo for youtube plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
extesy committed Jun 13, 2022
1 parent c4cb44f commit 09eb7a6
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions plugins/youtube_a.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

1 comment on commit 09eb7a6

@GrosPoulet
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@extesy YouTube plug-in (#956) is not perfect, it does not deal with:

  • protected videos
  • throttling

Protection & throttling can be handled, but it is not a trivial task, more info here:
https://superuser.com/questions/773719/how-do-all-of-these-save-video-from-youtube-services-work (protected videos)
and here:
ytdl-org/youtube-dl#29326 (comment) (throttling)

BTW, it might not be a good idea to bypass them & push the extension to Chrome Web Store, waiting for Google to review it 😰

Please sign in to comment.