BypassYoutubePub

Bypass YouTube publicity (French Version) and handle multiple languages

  1. // ==UserScript==
  2. // @name BypassYoutubePub
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.3
  5. // @description Bypass YouTube publicity (French Version) and handle multiple languages
  6. // @author MeGaBOuSsOl
  7. // @match https://www.youtube.com/*
  8. // @icon https://www.google.com/s2/favicons?domain=youtube.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Liste des textes de boutons "Skip" ou "Ignorer" dans différentes langues
  16. const skipButtonTexts = [
  17. "Ignorer l'annonce", // Français
  18. "Skip Ad", // Anglais
  19. "Anzeige überspringen", // Allemand
  20. "Saltar anuncio", // Espagnol
  21. "Salta annuncio", // Italien
  22. "広告をスキップ", // Japonais
  23. "跳过广告", // Chinois
  24. "광고 건너뛰기", // Coréen
  25. "Пропустить рекламу" // Russe
  26. ];
  27.  
  28. // Fonction pour détecter et cliquer sur le bouton "Skip" ou "Ignorer"
  29. function skipAd() {
  30. // Rechercher tous les boutons possibles
  31. const buttons = document.querySelectorAll('.ytp-ad-skip-button, .ytp-ad-skip-button-icon, .ytp-skip-ad-button');
  32.  
  33. buttons.forEach(button => {
  34. if (skipButtonTexts.some(text => button.textContent.includes(text))) {
  35. button.click();
  36. console.log('Publicité skippée !');
  37. clearInterval(checkInterval); // Arrêter l'intervalle une fois l'action effectuée
  38. }
  39. });
  40. }
  41.  
  42. // Fonction pour fermer les bannières publicitaires
  43. function closeBannerAds() {
  44. const closeButtons = document.querySelectorAll('.ytp-ad-overlay-close-button, .ytp-ad-preview-text, .ytp-ad-skip-button');
  45.  
  46. closeButtons.forEach(button => {
  47. button.click();
  48. console.log('Bannière publicitaire fermée !');
  49. });
  50. }
  51.  
  52. // Vérifier toutes les secondes
  53. const checkInterval = setInterval(() => {
  54. skipAd();
  55. closeBannerAds();
  56. }, 1000);
  57.  
  58. // Arrêter l'intervalle après 5 minutes pour éviter une utilisation excessive du CPU
  59. setTimeout(() => {
  60. clearInterval(checkInterval);
  61. console.log('Arrêt du script après 5 minutes.');
  62. }, 300000); // 5 minutes
  63. })();