YouTube Downloader

Author: Maker - MH

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         YouTube Downloader
// @version      1.3
// @match        https://www.youtube.com/*
// @match      https://www.wheelofnames.fun/*
// @grant        GM_setClipboard
// @description  Author: Maker - MH
// @namespace https://greasyfork.org/users/1115232
// ==/UserScript==
 
document.addEventListener('keydown', function(event) {
  if (event.ctrlKey && event.shiftKey && event.key === 'Y') {
    event.preventDefault();
    GM_setClipboard(window.location.href);
    window.open('https://x2download.app/' + window.location.pathname);
  }
});
 
(function() {
  'use strict';
 
  function pasteTextAndClickButton() {
    var searchBox = document.getElementById('s_input');
    var button = document.querySelector('#search-form button');
 
    setTimeout(function() {
      navigator.clipboard.readText().then(function(pastedText) {
        searchBox.value = pastedText;
        button.click();
 
        setTimeout(function() {
          var downloadLink = document.getElementById('asuccess');
          if (downloadLink) {
            downloadLink.addEventListener('click', function() {
              setTimeout(function() {
                window.close();
              }, 8000);
            });
          }
        }, 2000);
      }).catch(function(error) {
        console.error('Error reading text from clipboard:', error);
      });
    }, 1000);
  }
 
  window.addEventListener('load', function() {
    pasteTextAndClickButton();
  });
})();