🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2026/01/08 22:40:00
🔄 下次更新时间:2026/01/08 23:40:00
手动刷新缓存

Speed up for Youtube

Press right key to speed up, NoStop

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         Speed up for Youtube
// @description  Press right key to speed up, NoStop
// @version      1.05
// @author      Harry
// @match        https://*.youtube.com/*
// @match        https://*.zoom.us/*
// @match        https://*.ixigua.com/*
// @match        https://*.mgtv.com/*
// @match        https://v.qq.com/*
// @match        http://www.zjstv.com/*
// @match        http://*.cctv.com
// @icon         https://www.youtube.com/s/desktop/fc7b0168/img/favicon.ico
// @connect      googlevideo.com
// @license      MIT
// @namespace https://greasyfork.org/users/662979
// ==/UserScript==
(function () {
    'use strict';
    let count = 0
    let page_video
    let speedupKey = 39
    let history_rate = 1
    const tryPageVideo = () => Array.prototype.find.call(document.getElementsByTagName('video'), e => e.currentTime > 0.1)
    const getPageVideo = () => {
        return new Promise(resolve => {
            const timer = setInterval(() => {
                const page_video = tryPageVideo()
                console.log(page_video.playbackRate);
                if (page_video) {
                    clearInterval(timer)
                    resolve(page_video)
                }
            }, 500);
        })
    };

    const checkPageVideo = async () => {
        if (page_video.currentTime <= 0) {
            page_video = await getPageVideo()
            if (page_video.currentTime <= 0) {
                return false
            }
        }

        return true
    }

    const relativeEvent = {
        _stopper: e => e.stopPropagation(),
    }

    const downEvent_right = async e => {
        if (e.keyCode !== speedupKey) return
        e.stopPropagation()
        count++

        if (count === 2 && await checkPageVideo()) {
            relativeEvent.shouldPrevent && relativeEvent.prevent()
            history_rate = page_video.playbackRate
            page_video.playbackRate = 3
            console.log(page_video.playbackRate)
            console.log('speed up for 3x times')
        }
    }
    const upEvent_right = async e => {
        if (e.keyCode !== speedupKey) return
        e.stopPropagation()

        if (count >= 2 && page_video.playbackRate > 1) {
                page_video.playbackRate = history_rate
                console.log('cancel speed up')
            relativeEvent.shouldPrevent && relativeEvent.allow()
        }else{
                page_video.currentTime += 5
            }

        count = 0
    }
    const init = async () => {
        page_video = await getPageVideo()
        document.body.addEventListener('keydown', downEvent_right, true)
        document.body.parentElement.addEventListener('keyup', upEvent_right, true)
    }

    init()
   Object.defineProperties(document, { 'hidden': {value: false}, 'webkitHidden': {value: false}, 'visibilityState': {value: 'visible'}, 'webkitVisibilityState': {value: 'visible'} });
setInterval(function(){
        document.dispatchEvent( new KeyboardEvent( 'keyup', { bubbles: true, cancelable: true, keyCode: 143, which: 143 } ) );
}, 60000);
})();