Universal Video Ad Skip Tool

인터넷 사이트의 동영상 광고를 16배속으로 넘기고, SKIP 버튼이 활성화되면 자동으로 클릭합니다. (Greasy Fork 규정 준수 버전)

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Universal Video Ad Skip Tool
// @namespace    https://greasyfork.org/users/your-id
// @version      1.1
// @description  인터넷 사이트의 동영상 광고를 16배속으로 넘기고, SKIP 버튼이 활성화되면 자동으로 클릭합니다. (Greasy Fork 규정 준수 버전)
// @author       You
// @match        *://*/*
// @exclude      *://www.youtube.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    /**
     * 광고 스킵 및 배속 처리 함수
     * 5초 강제 광고는 16배속으로 빠르게 통과시키고, 버튼은 즉시 클릭합니다.
     */
    const skipAdTask = () => {
        // 1. 모든 비디오 요소 검사
        const videos = document.querySelectorAll('video');
        videos.forEach(video => {
            // 광고 컨테이너(vjs-ad-playing 등) 내에 있는지 확인
            const isAd = video.closest('[class*="ad"], [id*="ad"], .vjs-ad-playing, .vjs-ad-container');
            
            if (isAd) {
                video.muted = true;      // 광고 소리 끄기
                video.playbackRate = 16; // 16배속 설정
                // 재생 시간이 확인되면 끝으로 강제 이동
                if (video.duration > 0 && isFinite(video.duration)) {
                    video.currentTime = video.duration;
                }
            }
        });

        // 2. 스킵 버튼 자동 클릭
        // 이미지 속 '4초 뒤 광고 SKIP' 버튼의 클래스와 텍스트를 추적합니다.
        const skipButtons = document.querySelectorAll('.vjs-ad-skip-button, [class*="skip"], button');
        skipButtons.forEach(btn => {
            const btnText = btn.innerText || "";
            // 버튼이 화면에 보이고 'SKIP' 또는 '스킵' 문구가 포함된 경우 클릭
            if ((btnText.toUpperCase().includes('SKIP') || btnText.includes('스킵')) && btn.offsetParent !== null) {
                btn.click();
            }
        });
    };

    // DOM 변화를 감시하여 실시간으로 광고가 삽입될 때 대응
    const observer = new MutationObserver(skipAdTask);
    observer.observe(document.body || document.documentElement, { 
        childList: true, 
        subtree: true 
    });

    // 초기 실행
    skipAdTask();
})();