Last active
December 15, 2025 14:25
-
-
Save rodolfogoulart/6b9740f3c0d6ef75f7c2a32bb9cacfe0 to your computer and use it in GitHub Desktop.
Prime Video Mute Ads - Tampermonkey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Prime Video Auto Mute Ads | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2.5 | |
| // @description Mutar todos os vídeos durante anúncios e desmutar quando terminarem no Prime Video | |
| // @author Rodolfo | |
| // @match *://www.primevideo.com/* | |
| // @match *://primevideo.com/* | |
| // @updateURL https://gist.githubusercontent.com/rodolfogoulart/6b9740f3c0d6ef75f7c2a32bb9cacfe0/raw/prime.video.mute.ads.js | |
| // @downloadURL https://gist.githubusercontent.com/rodolfogoulart/6b9740f3c0d6ef75f7c2a32bb9cacfe0/raw/prime.video.mute.ads.js | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| // Mutar todos os vídeos | |
| function muteAllVideos() { | |
| const videos = document.querySelectorAll("video"); | |
| videos.forEach(v => { | |
| if (!v.muted) { | |
| v.muted = true; | |
| console.log("🔇 Mute:", v); | |
| } | |
| }); | |
| } | |
| // Desmutar todos os vídeos | |
| function unmuteAllVideos() { | |
| const videos = document.querySelectorAll("video"); | |
| videos.forEach(v => { | |
| if (v.muted) { | |
| v.muted = false; | |
| console.log("🔊 Unmute:", v); | |
| } | |
| }); | |
| } | |
| // Verifica se há anúncio (qualquer classe que contenha 'atvwebplayersdk-ad-timer') | |
| function isAdPlaying() { | |
| return document.querySelector('[class*="atvwebplayersdk-ad-timer"]').innerHTML != ''; | |
| } | |
| // Observa mudanças no DOM | |
| const observer = new MutationObserver(() => { | |
| console.log("Verificando:"); | |
| if (isAdPlaying()) { | |
| muteAllVideos(); | |
| } else { | |
| unmuteAllVideos(); | |
| } | |
| }); | |
| observer.observe(document.body, { childList: true, subtree: true }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment