Video Bypass (maxstream generic)

Bypasses Anti-AdBlock on maxstream-like streaming sites. On /watchfree/* pages, extracts the real video URL from iframes and redirects. On other pages, blocks alert/confirm/prompt dialogs.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

// ==UserScript==
// @name         Video Bypass (maxstream generic)
// @version      2.0.1
// @description  Bypasses Anti-AdBlock on maxstream-like streaming sites. On /watchfree/* pages, extracts the real video URL from iframes and redirects. On other pages, blocks alert/confirm/prompt dialogs.
// @author       antwal, ngi
// @license      MIT
// @match        https://*.maxstream.video/*
// @match        https://*/*watchfree/*
// @grant        none
// @run-at       document-start
// @homepage     https://gist.github.com/ngi/99134b4bc1f97ff87a7fa8be3b573514
// @namespace https://greasyfork.org/users/1440018
// ==/UserScript==

(function() {
    'use strict';

    function isWatchfreeUrl() {
        return window.location.pathname.startsWith("/watchfree");
    }

    // Generic pattern to recognize maxstream-like domains
    const DOMAIN_PATTERNS = [
        /max\w*\d*\.\w+$/,// maxs19.fun, maxmon23.online, maxv.lol, etc.
        /maxstream\.video$/,
        /fmax\d*\.\w+$/,
        /sumax\d*\.\w+$/,
        /samax\d*\.\w+$/,
    ];

    function isKnownDomain(hostname) {
        return DOMAIN_PATTERNS.some(pattern => pattern.test(hostname));
    }

    if (!isKnownDomain(window.location.hostname)) return;

    if (isWatchfreeUrl()) {
        const iframes = document.getElementsByTagName("iframe");
        for (let i = 0; i < iframes.length; i++) {
            const src = iframes[i].getAttribute("src") || iframes[i].src;
            if (src && src.includes("maxstream.video")) {
                window.location.replace(src);
                return;
            }
        }

        const observer = new MutationObserver((mutations) => {
            for (const mutation of mutations) {
                for (const node of mutation.addedNodes) {
                    if (node.tagName === "IFRAME") {
                        const src = node.getAttribute("src") || node.src;
                        if (src && src.includes("maxstream.video")) {
                            observer.disconnect();
                            window.location.replace(src);
                            return;
                        }
                    }
                }
            }
        });
        observer.observe(document.body || document.documentElement, {
            childList: true,
            subtree: true
        });
    } else {
        Object.defineProperty(window, 'alert', {
            value: function(message) {
                console.log("Blocked alert: " + message);
            },
            writable: false,
            configurable: false
        });

        Object.defineProperty(window, 'confirm', {
            value: function(message) {
                console.log("Blocked confirm: " + message);
                return true;
            },
            writable: false,
            configurable: false
        });

        Object.defineProperty(window, 'prompt', {
            value: function(message) {
                console.log("Blocked prompt: " + message);
                return null;
            },
            writable: false,
            configurable: false
        });
    }
})();