Enhanced Corrupt Dailymotion Ads

Corrupts ads on Dailymotion by blocking playback

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Enhanced Corrupt Dailymotion Ads
// @namespace    https://pastebin.com/tiAedV19
// @version      2.0
// @description  Corrupts ads on Dailymotion by blocking playback
// @match        https://www.dailymotion.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const adSources = [
        'ad',
        'advertisement',
        'doubleclick',
        'adserver',
        'ads',
        'tracking',
        'spotxchange',
        'krxd.net',
        'brighttag',
        'vdopia',
        'dailymotion.com/ads',
        'googleads',
        'adtech',
        'serving-sys',
        'adsrvr',
        'adroll',
        'adnxs',
        'adform',
        'rubiconproject',
        'appnexus',
        'zencoder',
        'floodlight',
        'criteo',
        'indexexchange',
        'openx',
        'smaato',
        'yieldmo',
        'adcolony',
        'moatads',
        'brightroll',
        'liveintent',
        'taboola',
        'outbrain',
        'revcontent',
        'adsbygoogle',
        'sovrn',
        'sonobi',
        'mopub',
        'audiencenetwork',
        'flashtalking',
        'triplelift',
        'fetchback',
        'adbeast',
        'adpushup',
        'improvely',
        'videonow',
        'extreme-reach',
        'adview',
        'adserverpub',
        'adsnative',
        'yieldbot',
        'moat',
        'improvedigital',
        'cysend',
        'media.net',
        'adswizz',
        'spotx',
        'gumgum',
        'kontera',
        'nativeads',
        'adf.ly',
        'shorte.st',
        'adfender',
        'fanboost',
        'nativo',
        'adlib',
        'mediacom',
        'admatic',
        'videoplaza',
        'mocean',
        'adconion',
        'justpremium',
        'openadstream',
        'admeld',
        'smaato',
        'adswapper',
        'mediaalpha',
        'brainly',
        'adblade',
        'tapad',
        'adparlor',
        'adknowledge',
        'tremorvideo',
        'radiumone',
        'uzymedia',
        'adgear',
        'cpxinteractive',
        'whiteshark',
        'adcontrol',
        'adspring',
        'maxymiser',
        'booster',
        'customaudience',
        'geniuslink',
        'intango',
        'igum',
        'leadbolt',
        'adaction',
        'buysellads',
        'clicksor',
        'zebraads',
        'advertise.com',
        'ezanga',
        'videojug',
        'avocarrot',
        'fyber',
        'yandex',
        'adlibitum',
        'popads',
        'popunder',
        'atdmt',
        'adpolicy',
        'acxiom',
        'mopub',
        'criteo',
        'dynamicyield',
        'adpiler',
        'arbitraryads',
        'adtrader',
        'adhero',
        'digitalenvoy',
        'cocoon',
        'adshuffler',
        'backflip',
        'advangelists',
        'interclick',
        'adman',
        'adscape',
        'adattic',
        'adsidian',
        'adperium',
        'retargeting',
        'bidswitch',
        'adteca',
        'whaleads',
        'buyat',
        'adshuffle',
        'inmobi',
        'interscroller',
        'proxio',
        'adcloud',
        'adserving',
        'adunity',
        'pof.com',
        'roboads',
        'in-ads',
        'hypeaudience',
        'yahooads',
        'vungle',
        'chartboost',
        'unityads',
        'applovin',
        'adnetwork',
        'innoads',
        'adpure',
        'adsoft',
        'redefiningads',
        'mmedia',
        'weborama',
        'newads',
        'adspring',
        'deputyads',
        'dcollab',
        'dsp',
        'quantcast',
        'adfuse',
        'epom',
        'adext',
        'rsi',
        'thetradedesk',
        'buzzcity',
        'criteo',
        'districtm',
        'plista',
        'veeboo',
        'adopt',
        'admitad',
        'kargo',
        'squeezy',
        'clearcode',
        'adupay',
        'spinme',
        'yuga',
        'inetwork',
        'adwallet',
        'myads',
        'adfunnel',
        'unitedads',
        'adwarrior',
        'metaad',
        'intelligentads',
        'mediacore',
        'driftrock',
        '360ads',
        'adclick',
        'splashad',
        'adbrokers',
        'reachlocal',
        'adiq',
        'adzero',
        'adspresso',
        'netseer',
        'btrll',
        'conviva',
        'bitrate',
        'adtraction',
        'adstring',
        'adviewmedia',
        'interceptd',
        'avora',
        'mindspark',
        'aolads',
        'adnow',
        'adverty',
        'adcloudmedia',
        'adoption',
        'inspireads',
        'broadstreetads',
        'exponential',
        'crossmedia',
        'triplelift',
        'lotame',
        'nexage',
        'clickable',
        'dove',
        'inviqa',
        'adspark',
        'addefend',
        'fastclick',
        'adnet',
        'adexchanger',
        'metricads',
        'simpleads',
        'upliftads',
        'advolcano',
        'spotx',
        'twitch',
        'preroll',
    ];

    const isAdSource = (src) => {
        return adSources.some(ad => src.includes(ad));
    };

    const corruptAds = () => {
        const originalPlay = HTMLMediaElement.prototype.play;

        HTMLMediaElement.prototype.play = function() {
            if (isAdSource(this.src)) {
                return Promise.reject(new Error('Ad playback failed due to connection issues.'));
            }
            return originalPlay.call(this);
        };
    };

    const suppressConsoleWarnings = () => {
        const originalError = console.error;
        console.error = function(...args) {
            if (args[0] && typeof args[0] === 'string' && args[0].includes('Reading cookie in cross-site context')) {
                return;
            }
            originalError.apply(console, args);
        };
    };

    window.addEventListener('load', () => {
        suppressConsoleWarnings();
        corruptAds();

        const observer = new MutationObserver(() => {
            corruptAds();
        });
        observer.observe(document.body, { childList: true, subtree: true });
    });
})();