Greasy Fork is available in English.

百度云网盘视频允许倍速播放

适用于百度云在线视频播放,倍速播放,没有额外的按钮,直接点击视频中的倍数按钮 即可倍数播放。需要定制脚本请联系QQ2847046608

// ==UserScript==
// @name         百度云网盘视频允许倍速播放
// @namespace    http://tampermonkey.net/
// @version      2024-11-22
// @description  适用于百度云在线视频播放,倍速播放,没有额外的按钮,直接点击视频中的倍数按钮 即可倍数播放。需要定制脚本请联系QQ2847046608
// @author       You
// @match        https://pan.baidu.com/pfile/video?*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=baidu.com
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
    'use strict';
    clearInterval(window.asdasd);
    window.asdasd = setInterval(() => {
        var affsdasd = document.querySelector(".vp-video__control-bar--playback-rates");
        if (!!affsdasd && !affsdasd.classList.contains("aaaa")) {
            affsdasd.classList.add("aaaa");
            clearInterval(window.asdasd);

            affsdasd.insertAdjacentHTML('afterbegin', `
<div class="vp-video__control-bar--video-button is-svip"><!----><button type="button" class="vp-btn normal is-round" style=""><!----><span><!----> 4X</span></button><!----><!----></div>
  <div class="vp-video__control-bar--video-button is-svip"><!----><button type="button" class="vp-btn normal is-round" style=""><!----><span><!----> 3X</span></button><!----><!----></div>
  <div class="vp-video__control-bar--video-button is-svip"><!----><button type="button" class="vp-btn normal is-round" style=""><!----><span><!----> 2.5X</span></button><!----><!----></div>
`)

            document.querySelectorAll(".vp-video__control-bar--playback-rates > .vp-video__control-bar--video-button").forEach(o => {
                o.onclick = function () {
                    document.querySelector("video").playbackRate = o.querySelector("button").innerText.replace("X", "");
                    document.querySelector("video").play();

                    document.querySelector("wora-pc-dialog").style.display = "none";
                    document.querySelectorAll(".vp-video__control-bar--playback-rates > .vp-video__control-bar--video-button").forEach(o22 => {
                        if (o22 == o) {
                            o22.classList.add("is-selected");
                        } else {
                            o22.classList.remove("is-selected");
                        }

                    });
                }
            });


            window.realSpee = 0;
            [
                document.body,
                document.querySelector(".video-js"), ...document.querySelector(".video-js").querySelectorAll('*')
            ].forEach(oo => {
                oo.onkeydown = () => {
                    if (window.realSpee == 0) {
                        window.realSpee = document.querySelector("video").playbackRate;
                        window.ttttta = new Date();
                    }
                    switch (event.code) {
                        case "Right":
                        case "ArrowRight":
                            document.querySelector("video").playbackRate = 4;
                            event.stopImmediatePropagation();
                            break;
                    }
                };

                oo.onkeyup = () => {
                    switch (event.code) {
                        case "Right":
                        case "ArrowRight":
                            if (window.realSpee != 0) {
                                document.querySelector("video").playbackRate = window.realSpee;
                                window.realSpee = 0;

                                console.log(new Date()-window.ttttta);
                                if(new Date()-window.ttttta < 450){
                                    document.querySelector("video").currentTime +=20;
                                }
                            }
                            event.stopImmediatePropagation();
                            break;
                    }
                };
            });
        }
    }, 1000)
    // Your code here...
})();