Prime Video Ad Blocker [ESP]

Skip Ads in Prime Video.

Från och med 2022-10-08. Se den senaste versionen.

// ==UserScript==
// @name            Prime Video Ad Blocker [ESP]
// @namespace       https://greasyfork.dpdns.org/en/users/5102-jeau
// @version         0.2.3
// @description     Skip Ads in Prime Video.
// @description:es  Bloquea los anuncios en Prime Video.
// @author          Jeau
// @license         MIT
// @match           https://www.primevideo.com/*
// @icon            https://m.media-amazon.com/images/G/01/digital/video/DVUI/favicons/favicon-32x32.png
// @grant           none
// ==/UserScript==

/*
------------------------------------------------------------------------
   Adapted for spanish Amazon site from RawMeatEater's script:
   https://greasyfork.dpdns.org/es/scripts/446723-amazon-video-ad-blocker
------------------------------------------------------------------------
*/

(function() {
    'use strict';
    // This value when true shows that the Ad has been skipped
    var adSkipped = false;
    setInterval(function() {
        var video;
        var renderer = document.getElementsByClassName("rendererContainer")[0];
        if (renderer) {
            video = renderer.querySelector('video');
        }
        var adTimeElement = document.getElementsByClassName("atvwebplayersdk-adtimeindicator-text")[0];
        // If video started playing and a 'Time to Skip' element is detected
        if (video && video.currentTime && adTimeElement) {
            // Has it been skipped aready? (To be sure that you don't skip forward twice)
            if ( adSkipped == false ) {
                var adTimeRegExp = /(\d?\d:){0,2}\d?\d/;
                if (adTimeRegExp.test(adTimeElement.innerHTML)) {
                    // Grab the Ad timer in HH:MM:SS format and split it into an array as soon as it is detected
                    var currentAdTime = adTimeElement.innerHTML.match(adTimeRegExp)[0].split(':');
                    // Calculate the Ad time in seconds
                    var adTimeInSecs = 0;
                    for (let i = 0; i < currentAdTime.length; i++) {
                        adTimeInSecs += parseInt(currentAdTime[i]) * Math.pow(60, currentAdTime.length - 1 - i);
                    }
                    // Forward the video by how much Ad time the timer shows
                    video.currentTime += adTimeInSecs;
                    // Mark the Ad as skipped
                    adSkipped = true;
                }
            }
        } else {
            // When Ad timer disappers, reset the Ad skip value
            adSkipped = false;
        }
    }, 100);
})();
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元