Greasy Fork is available in English.

哔哩哔哩视频自动倍速播放(可记住用户设定值并自动设置播放速度)

哔哩哔哩(bilibili.com)视频自动倍速播放,智能记忆用户设定的视频倍速并存储在本地,播放全站视频都会自动使用该倍速,例如全站视频都用1.25倍速播放,不用每次播放视频都要设置倍速。。

// ==UserScript==
// @name         哔哩哔哩视频自动倍速播放(可记住用户设定值并自动设置播放速度)
// @description  哔哩哔哩(bilibili.com)视频自动倍速播放,智能记忆用户设定的视频倍速并存储在本地,播放全站视频都会自动使用该倍速,例如全站视频都用1.25倍速播放,不用每次播放视频都要设置倍速。。
// @icon         https://www.bilibili.com/favicon.ico
// @namespace    https://greasyfork.org/zh-CN/users/393603-tsing
// @version      1.0
// @author       Tsing
// @include      *://www.bilibili.com/video/*
// @include      *://www.bilibili.com/medialist/play/watchlater/p*
// @include      *://www.bilibili.com/bangumi/play/ep*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var player_speed = 1.25; // Default video speed
    var speed_arr = [0.5, 0.75, 1, 1.25, 1.5, 2]; // Video speed control panel data-value
    var v = localStorage.getItem("user_video_speed");
    if(!v){ // Localstorage Null
        localStorage.setItem("user_video_speed", player_speed);
    }else{
        if(speed_arr.indexOf(parseFloat(v)) != "-1"){ // Speed value valid
            player_speed = parseFloat(v);
        }else{ // Speed value invalid
            localStorage.setItem("user_video_speed", player_speed);
        }
    }

    setInterval(function(){
        for(let i=0; i<speed_arr.length; i++){
            document.getElementsByClassName("bilibili-player-video-btn-speed-menu-list ")[i].onmousedown = function(){
                player_speed = parseFloat(this.innerHTML);
                localStorage.setItem("user_video_speed", player_speed);
                console.log("User changed the speed to: " + player_speed);
            }
        }
        var speed = parseFloat(document.querySelector(".bilibili-player-active").innerHTML);
        if(speed != player_speed){
            document.querySelector("li[data-value='" + player_speed + "']").click();
        }
    }, 500);

})();