Auto skip ads on amazon prime videos

No need to manually click

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Auto skip ads on amazon prime videos
// @namespace   momala
// @description No need to manually click

// @match https://primevideo.com/region/*/detail/*
// @match https://*.primevideo.com/region/*/detail/*

// @match https://primevideo.com/detail/*
// @match https://*.primevideo.com/detail/*

// @match https://amazon.com/Episode-*/dp/*
// @match https://*.amazon.com/Episode-*/dp/*
// @match https://amazon.co.jp/Episode-*/dp/*
// @match https://*.amazon.co.jp/Episode-*/dp/*
// @match https://amazon.de/Episode-*/dp/*
// @match https://*.amazon.de/Episode-*/dp/*
// @match https://amazon.de/dp/*
// @match https://*.amazon.de/dp/*

// @match https://amazon.com/gp/video/detail/*
// @match https://*.amazon.com/gp/video/detail/*
// @match https://amazon.co.jp/gp/video/detail/*
// @match https://*.amazon.co.jp/gp/video/detail/*
// @match https://amazon.de/gp/video/detail/*
// @match https://*.amazon.de/gp/video/detail/*

// @version     3
// @noframes
// ==/UserScript==

(function() {
    'use strict';
    (new MutationObserver(function (mutationlist) {
        if (document.querySelector('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4) > div:nth-child(2)')) {
            this.disconnect();
            console.log('Got player');
            console.log(document.querySelector('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4) > div:nth-child(2)'));
            (new MutationObserver(function (mutationlist) {
                console.log('got observer');
                console.log(document.querySelectorAll('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4) > div:nth-child(2) div img[src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4LjQ4NCIgaGVpZ2h0PSIxNC4xNDEiIHZpZXdCb3g9IjAgMCA4LjQ4NCAxNC4xNDEiPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik03LjA3IDUuNjU2TDEuNDE0IDAgMCAxLjQxNCA1LjY1NiA3LjA3IDAgMTIuNzI3bDEuNDE0IDEuNDE0TDcuMDcgOC40ODQgOC40ODQgNy4wN3oiLz48L3N2Zz4="]'));
                Array.from(document.querySelectorAll('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4) > div:nth-child(2) div img[src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4LjQ4NCIgaGVpZ2h0PSIxNC4xNDEiIHZpZXdCb3g9IjAgMCA4LjQ4NCAxNC4xNDEiPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik03LjA3IDUuNjU2TDEuNDE0IDAgMCAxLjQxNCA1LjY1NiA3LjA3IDAgMTIuNzI3bDEuNDE0IDEuNDE0TDcuMDcgOC40ODQgOC40ODQgNy4wN3oiLz48L3N2Zz4="]')).
                filter(function(item) { return ['Ignorer', 'Skip', 'Überspringen'].includes(item.parentNode.parentNode.innerText)}).forEach(function(item) {
                    console.log('Auto skipped ads');
                    item.click();
                });

            //})).observe(document.querySelector('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4) > div:nth-child(2)'),{ attributes: false, childList: true, subtree: true });
            })).observe(document.querySelector('.webPlayerUIContainer [tabindex="-1"] > div:nth-child(4)'),{ attributes: false, childList: true, subtree: true });
        }
    })).observe(document.getElementById('dv-web-player'),{ attributes: false, childList: true, subtree: true });
})();