youTube Download Button Replacer with yt1s

Replaces the original Premium Download Button with third party website with free downloading

  1. // ==UserScript==
  2. // @name youTube Download Button Replacer with yt1s
  3. // @namespace johnnyScripts
  4. // @match https://www.youtube.com/watch
  5. // @match https://*.youtube.com/*
  6. // @grant GM_addStyle
  7. // @run-at document-start
  8. // @version 1.1.2
  9. // @author johnny
  10. // @license MIT
  11. // @description Replaces the original Premium Download Button with third party website with free downloading
  12. // @description:pt-BR Substitui o botão de download premium original por um site de terceiros com download gratuito
  13. // @description:ar يستبدل زر التنزيل المميز الأصلي بموقع ويب تابع لجهة خارجية مع تنزيل مجاني
  14. // @description:bg Заменя оригиналния бутон за премиум изтегляне с уебсайт на трета страна с безплатно изтегляне
  15. // @description:cs Nahrazuje původní tlačítko Premium Stáhnout webovou stránkou třetí strany s bezplatným stahováním
  16. // @description:da Erstatter den oprindelige Premium Download-knap med en tredjeparts hjemmeside med gratis download
  17. // @description:de Ersetzt den originalen Premium-Download-Button durch eine Drittanbieter-Website mit kostenlosem Download
  18. // @description:el Αντικαθιστά το αρχικό κουμπί Premium Λήψη με ιστότοπο τρίτου μέρους με δωρεάν λήψη
  19. // @description:eo Anstataŭigas la originalan Premium Elŝuto-Butonon per retejo de tria partio kun senpaga elŝuto
  20. // @description:es Reemplaza el botón de descarga Premium original con un sitio web de terceros con descarga gratuita
  21. // @description:fi Korvaa alkuperäisen Premium-latauspainikkeen kolmannen osapuolen verkkosivustolla, jossa on ilmainen lataus
  22. // @description:fr Remplace le bouton de téléchargement Premium original par un site tiers avec téléchargement gratuit
  23. // @description:fr-CA Remplace le bouton de téléchargement Premium original par un site tiers avec téléchargement gratuit
  24. // @description:he מחליף את כפתור ההורדה המקורי של Premium באתר צד שלישי עם הורדה בחינם
  25. // @description:hu Helyettesíti az eredeti prémium letöltés gombot egy harmadik fél weboldalával, amely ingyenes letöltést biztosít
  26. // @description:id Mengganti tombol unduhan Premium asli dengan situs web pihak ketiga dengan pengunduhan gratis
  27. // @description:it Sostituisce il pulsante di download Premium originale con un sito web di terze parti con download gratuito
  28. // @description:ja 元のプレミアムダウンロードボタンを無料ダウンロードができるサードパーティのウェブサイトに置き換えます
  29. // @description:ko 원본 프리미엄 다운로드 버튼을 무료 다운로드가 가능한 제3자 웹사이트로 교체합니다
  30. // @description:nb Erstatter den originale Premium Download-knappen med en tredjeparts nettside med gratis nedlasting
  31. // @description:nl Vervangt de originele Premium-downloadknop door een externe website met gratis download
  32. // @description:pl Zastępuje oryginalny przycisk Premium do pobierania stroną trzeciej firmy z darmowym pobieraniem
  33. // @description:ro Înlocuiește butonul original Premium de descărcare cu un site web terț cu descărcare gratuită
  34. // @description:ru Заменяет оригинальную кнопку премиум-скачивания на сайт третьей стороны с бесплатным скачиванием
  35. // @description:sk Nahrádza pôvodné tlačidlo Premium na stiahnutie webovou stránkou tretej strany s bezplatným sťahovaním
  36. // @description:sr Zamenjuje originalno Premium dugme za preuzimanje sa web-sajt treće strane sa besplatnim preuzimanjem
  37. // @description:sv Ersätter den ursprungliga Premium-hämtningsknappen med en tredjepartswebbplats med gratis nedladdning
  38. // @description:th แทนที่ปุ่มดาวน์โหลดพรีเมียมดั้งเดิมด้วยเว็บไซต์ของบุคคลที่สามที่มีการดาวน์โหลดฟรี
  39. // @description:tr Orijinal Premium İndir düğmesini ücretsiz indirme sağlayan üçüncü taraf bir web sitesi ile değiştirir
  40. // @description:uk Замінює оригінальну кнопку Premium завантаження на сторонній веб-сайт із безкоштовним завантаженням
  41. // @description:ug ئەسلى Premium چۈشۈرۈش كۇنۇپكىسىنى ھەقسىز چۈشۈرۈشچى ئۇچۇر تورى بىلەن ئالماشتۇرىدۇ
  42. // @description:vi Thay thế nút Tải xuống Premium gốc bằng trang web của bên thứ ba với tải xuống miễn phí
  43. // @description:zh-CN 将原来的高级下载按钮替换为第三方网站的免费下载按钮
  44. // @description:zh-TW 將原來的高級下載按鈕替換為第三方網站的免費下載按鈕
  45. // ==/UserScript==
  46.  
  47. (function() {
  48. const API = "https://yt1s.com/en/youtube-to-mp3?q=";
  49. const BUTTON_ID = "dwnldBtn";
  50. const TARGET_CONTAINER = "#top-level-buttons-computed";
  51. const REFERENCE_BUTTON = "#top-level-buttons-computed > segmented-like-dislike-button-view-model";
  52.  
  53. const buttonStyle = `
  54. #${BUTTON_ID} {
  55. background-color: #292a2a; /* Alterado para a nova cor */
  56. color: #FFFFFF;
  57. border: 1px solid #292a2a;
  58. border-color: rgba(41,42,42,255);
  59. margin: 0px 4px;
  60. border-radius: 18px;
  61. width: 120px; /* Ajustado para acomodar o ícone e o texto */
  62. height: 36px;
  63. line-height: 36px;
  64. text-align: center;
  65. font-style: normal;
  66. font-size: 14px;
  67. font-family: Roboto, Noto, sans-serif;
  68. font-weight: 500;
  69. text-decoration: none;
  70. display: flex; /* Usado para alinhar o ícone e o texto */
  71. align-items: center;
  72. justify-content: center;
  73. }
  74. #${BUTTON_ID} svg {
  75. margin-right: 8px; /* Espaçamento entre o ícone e o texto */
  76. fill: #FFFFFF; /* Define a cor do ícone como branca */
  77. }
  78. #${BUTTON_ID}:hover {
  79. background-color: #15171E;
  80. color: #ffffff;
  81. border-color: #15171E;
  82. }
  83. `;
  84.  
  85. GM_addStyle(buttonStyle);
  86.  
  87. function waitForElement(selector) {
  88. return new Promise(resolve => {
  89. if (document.querySelector(selector)) {
  90. return resolve(document.querySelector(selector));
  91. }
  92. const observer = new MutationObserver(mutations => {
  93. if (document.querySelector(selector)) {
  94. resolve(document.querySelector(selector));
  95. observer.disconnect();
  96. }
  97. });
  98. observer.observe(document.body, { childList: true, subtree: true });
  99. });
  100. }
  101.  
  102. function removeFlexibleItemButtons() {
  103. const flexibleItemButtons = document.querySelector("#flexible-item-buttons");
  104. if (flexibleItemButtons) {
  105. flexibleItemButtons.remove();
  106. }
  107. }
  108.  
  109. function addButton() {
  110. waitForElement(TARGET_CONTAINER).then((container) => {
  111. removeFlexibleItemButtons();
  112.  
  113. const referenceButton = container.querySelector(REFERENCE_BUTTON);
  114. const btn = document.createElement('a');
  115. btn.href = API + encodeURIComponent(window.location.href);
  116. btn.target = "_blank";
  117. btn.id = BUTTON_ID;
  118. btn.innerHTML = `
  119. <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24" focusable="false" style="pointer-events: none; display: inherit; width: 24px; height: 24px;" aria-hidden="true">
  120. <path d="M17 18v1H6v-1h11zm-.5-6.6-.7-.7-3.8 3.7V4h-1v10.4l-3.8-3.8-.7.7 5 5 5-4.9z" fill="#FFFFFF"></path>
  121. </svg>
  122. Download
  123. `;
  124. container.insertBefore(btn, referenceButton.nextSibling);
  125. });
  126. }
  127.  
  128. function updateButton() {
  129. waitForElement(`#${BUTTON_ID}`).then((btn) => {
  130. btn.href = API + encodeURIComponent(window.location.href);
  131. });
  132. }
  133.  
  134. window.onload = addButton;
  135. window.addEventListener("yt-navigate-start", updateButton, true);
  136. })();
  137.  
  138.