Thursday, March 19, 2020

Bookmarklet to download YouTube videos

Drag this link onto your bookmark toolbar. Click it when you're watching a YouTube video.


What goes on when you click the bookmarklet?


The bookmarklet merely opens a new tab and changes the "www.youtube.com" portion of the URL to "www.youtubepp.com". This directs you to a third party website called Y2mate.com that will create a free download link of the YouTube video you are watching.


Javascript code:


javascript:(function(){
    var download_url = window.location.href ;
    var isyt = download_url.indexOf("youtube.com");
    if (isyt != -1 && download_url.indexOf("youtubepp.com") == -1){
        var final = download_url.replace("youtube.com", "youtubepp.com");
        window.open(final);
    }   else {
         alert ("You have to be on youtube.com for this to work!");
}})();

Relevant links:


https://mrcoles.com/bookmarklet/ converts Javascript into a bookmarklet URL
https://meyerweb.com/eric/tools/dencoder/ decodes a URL into Javascript

No comments:

Post a Comment

You can add Images, Colored Text and more to your comment.
See instructions at http://macrolayer.blogspot.com..