下面是用 Tampermonkey(油猴脚本管理器)在 B 站网页端自定义快进 / 快退秒数的思路 + 示例脚本。请 自行承担风险(脚本来源要信任、可能失效、B 站更新可能被封锁)。
步骤概览
在浏览器里安装 Tampermonkey / Violentmonkey / Greasemonkey 插件
新建一个用户脚本
脚本里监听左右方向键(或其它快捷键),然后控制视频元素的
currentTime
增减保存并启用脚本,刷新 B 站页面测试
示例脚本:自定义快进 / 快退 10 秒
下面是一个简化版本的用户脚本代码示例,把左右键设为快进 / 快退 10 秒。你可以根据需要改成 5 秒、15 秒或其他键。
#这个代码经正式测试 OK 有大用 有大大用
// ==UserScript==
// @name Bilibili 自定义快进快退
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 在 B 站网页上使用左右方向键快进 / 快退自定义秒数
// @match *://www.bilibili.com/video/*
// @match *://www.bilibili.com/bangumi/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const SEEK_SECONDS = 3;// 改为你想要的秒数
window.addEventListener('keydown', function(e) {
let tag = e.target.tagName.toLowerCase();
if (tag === 'input' || tag === 'textarea') return;
const video = document.querySelector('video');
if (!video) return;
if (e.key === 'ArrowRight') {
video.currentTime = Math.min(video.duration, video.currentTime + SEEK_SECONDS);
e.stopImmediatePropagation(); // 阻止后续任何同类型监听器执行
e.preventDefault();
} else if (e.key === 'ArrowLeft') {
video.currentTime = Math.max(0, video.currentTime - SEEK_SECONDS);
e.stopImmediatePropagation();
e.preventDefault();
}
}, true);
})();
或者
// ==UserScript==
// @name Bilibili 自定义快进快退
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 在 B 站网页上使用左右方向键快进 / 快退自定义秒数
// @match *://www.bilibili.com/video/*
// @match *://www.bilibili.com/bangumi/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const SEEK_SECONDS = 3;// 改为你想要的秒数
document.addEventListener('keydown', e => {
let tag = e.target.tagName.toLowerCase();
if (tag === 'input' || tag === 'textarea') return;
const video = document.querySelector('video');
if (!video) return;
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
let delta = e.key === 'ArrowRight' ? SEEK_SECONDS : -SEEK_SECONDS;
video.currentTime = Math.min(video.duration, Math.max(0, video.currentTime + delta));
e.preventDefault();
e.stopPropagation();
}
}, true);
})();
把上面的脚本复制到 Tampermonkey 新脚本界面里,保存启用,就可以在 B 站页面上用左右键快进 / 快退你设置的秒数了。
更完善的脚本 &现成方案
在 GreasyFork 上有 “Bilibili 高级倍速功能” 脚本,虽然主要是针对 倍速 调整功能,但一般也有快捷键扩展的支持。Greasy Fork
“Bilibili Evolved” 是一个比较强大的增强脚本,功能很多,有些版本也可能包含视频控制增强。哔哩哔哩+1
你可以去 GreasyFork 搜 “Bilibili 快进” / “Bilibili 自定义 快退” / “Bilibili Evolved” 之类关键词,看看有没有别人写好的、经常维护的脚本。
如果你愿意的话,我可以帮你找一个最近更新且可靠的脚本,并发给你链接和安装方法,你要吗?