Greasy Fork is available in English.

自动跳过视频广告

自用脚本, 自动跳过视频广告, 当前支持 腾讯, 爱奇艺, 优酷, 搜狐, 芒果tv, pptv

// ==UserScript==
// @name              自动跳过视频广告
// @namespace
// @version           1.1.0
// @description       自用脚本, 自动跳过视频广告, 当前支持 腾讯, 爱奇艺, 优酷, 搜狐, 芒果tv, pptv
// @author            daniel
// @icon              data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAVoUlEQVR4Xu2debAc1XXGv9NPC3rTI8DS9CCMQ0yRmOkRlBPsmJi4AJMgCBaVlEvsYINYzC42sUogsQmBWMQqHNtgwIBFKmXAmJgiqAzlhCROOUTTgwMpnEAsTY/EoumRQOj1SQ16jzye3jJ9+3ZPL2f+ffece853zu/2m57uewnyEQVEgTEVINFGFBAFxlZAAJHuEAXGUUAAkfYQBQQQ6QFRQE0BuYKo6SZWOVFAAMlJoSVNNQUEEDXdxConCgggOSm0pKmmgACipptY5UQBASQnhZY01RQQQNR0E6ucKCCA5KTQkqaaAgKImm5ilRMFBJCcFFrSVFNAAFHTTaxyooAAkpNCS5pqCgggarqJVU4UEEByUmhJU00BAURNN7HKiQICSE4KLWmqKSCAqOkmVjlRQADJSaElTTUFBBA13cQqJwoIIDkptKSppoAAoqabWOVEAQEkJ4WWNNUUEEDUdBOrnCgggOSk0JKmmgICiJpuYpUTBQSQnBRa0lRTIFeAvPNfe+28U/9OXxiA368mV76tjEmTvA+MD/5zxow3NuVFicwDwnzwpPYGdxkzjiLgD/JS2EjzJNQBPFuYaV1OtGZbpHP12HmmAdm8wf6K7/MygA7usc4ZnZ7XGAZd3j/TeSWjCSKzgGx27Xk+8D0AxawWLyF5tQxgfr/lrE5IPFrDyCQgrfWVY8igx7UqJc7GVYB9Pra4W/2JrMmUOUBa6yvHkkGPZa1QaciHiY8rluqZWpgyBYjXrB4H5h+loZkyGyPR8WaplpkFKjOAeM3q8WB+NLONl6bEiE4wS7VMLFSZAMRr2ieA8Uia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AJKTQkuaagoIIGq6iVVOFBBAclJoSVNNAQFETTexyokCAkhOCi1pqikggKjpJlY5UUAAyUmhJU01Bf4Pr9/RMoYtvhIAAAAASUVORK5CYII=
// @namespace
// @require           https://cdn.bootcss.com/jquery/3.5.1/jquery.min.js
// @match             https://xbeibeix.com/api/bilibili/biliplayer/*
// @match             *://v.qq.com/x/cover/*
// @match             *://m.v.qq.com/x/cover/*
// @match             *://v.qq.com/x/page/*
// @match             *://m.v.qq.com/x/page/*
// @match             *://m.v.qq.com/*
// @match             *://www.iqiyi.com/v*
// @match             *://m.iqiyi.com/*
// @match             *://www.iqiyi.com/*
// @match             *://m.iqiyi.com/kszt/*
// @match             *://www.iqiyi.com/kszt/*
// @match             *://v.youku.com/v_show/*
// @match             *://m.youku.com/alipay_video/*
// @match             *://w.mgtv.com/b/*
// @match             *://m.mgtv.com/b/*
// @match             *://www.mgtv.com/b/*
// @match             *://tv.sohu.com/v/*
// @match             *://m.tv.sohu.com/v/*
// @match             *://film.sohu.com/album/*
// @match             *://m.film.sohu.com/album/*
// @match             *://www.le.com/ptv/vplay/*
// @match             *://m.le.com/ptv/vplay/*
// @match             *://v.pptv.com/show/*
// @match             *://m.pptv.com/show/*
// @match             *://vip.pptv.com/show/*
// @match             *://www.wasu.cn/Play/show/*
// @match             *://m.wasu.cn/Play/show/*
// @license           GPL License
// @grant             unsafeWindow
// @grant             GM_openInTab
// @grant             GM.openInTab
// @grant             GM_getValue
// @grant             GM.getValue
// @grant             GM_setValue
// @grant             GM.setValue
// @grant             GM_xmlhttpRequest
// @grant             GM.xmlHttpRequest
// @grant             GM_registerMenuCommand
// @namespace 
// ==/UserScript==

(function () {
    'use strict';

    var $ = $ || window.$;
    var host = location.host

    function generic() {
        setInterval(() => {
            let $ad = $('body').find('video')
            if ($ad) {
                if ($ad.get()) {
                    let videos = $ad.get()
                    // console.log(videos.length)
                    for (let video of videos) {
                        let srcVal = $(video).attr('src')
                        // console.log(srcVal)
                        if (srcVal && !srcVal.startsWith('blob:')) {
                            video.currentTime = 1000
                        }
                    }
                }
            }
        }, 1000)
    }

    switch (host) {
        case 'www.iqiyi.com':  // 爱奇艺
            setInterval(() => {
                var skip_guanggao = document.getElementsByClassName("skippable-after")[0]
                if (skip_guanggao) {
                    skip_guanggao.click()
                }
            }, 1000)
            break

        case 'v.qq.com':  // 腾讯视频
            generic()
            break

        case 'v.youku.com':  // 优酷视频
            generic();
            break

        case 'www.mgtv.com':   // 芒果tv
            generic()
            break

        case 'tv.sohu.com':  // 搜狐视频
            generic()
            break

        case 'v.pptv.com':  // pptv
            generic()
            break

    }

})();