Greasy Fork is available in English.

Bilibili Auto Quality (Ordered)

根据配置的清晰度顺序,自动选择并设置B站播放器清晰度

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

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

Tendrás que instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Tendrás que instalar una extensión como Tampermonkey antes de poder instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

Autor
Jingwei Zhang
Instalaciones diarias
0
Instalaciones totales
16
Calificaciones
0 0 0
Versión
1.0
Creado
8/2/2026
Actualizado
8/2/2026
Tamaño
4,15 KB
Licencia
MIT
Funciona en

Bilibili Auto Quality (Ordered)

In the PC web player, automatically set clarity according to the preset order after loading is complete. The entire script is generated by codex + Kimi K2.5.

Usage

  1. In Tampermonkey, create a new script → paste all of setBiliQuality.js → Save (Ctrl+S).
  2. Open any Bilibili video page, and the script will automatically try to set clarity in this order:
    • 4K (120) → 1080P60 (116) → 1080P (80) → 720P (64) → 480P (32) → 360P (16)
    • The first clarity in the video's available list will be selected.
  3. To change the order or only select specific clarity, edit RESOLUTION_ORDER at the top of the script.

Principle

  • Read the clarity list from the page's initial data: window.__playinfo__.data.accept_quality.
  • Call the internal player method to switch clarity. The new player usually has requestQuality(q, audioQuality), while the old player may have setQuality / setPlaybackQuality. The script prioritizes using requestQuality, and automatically tries old interfaces if it fails.
  • If the player is not yet mounted, the script will retry at 500ms intervals within 20 seconds until it succeeds or times out.

Configuration Instructions

  • RESOLUTION_ORDER: Array of clarity codes (from high to low). Example: [80, 64] means first choice is 1080P, if unavailable then 720P.
  • Clarity code correspondence (common):
    • 120 = Ultra-clear 4K
    • 116 = HD 1080P60
    • 80 = HD 1080P
    • 64 = HD 720P
    • 32 = Clear 480P
    • 16 = Smooth 360P

Quick Verification

Open any video page and run in the Console:

const info = window.__playinfo__;
if (info?.data) {
  console.log('Supported clarity codes:', info.data.accept_quality);
  console.log('Clarity descriptions:', info.data.accept_description);
}
const player = window.player;
if (player) {
  const supported = player.getSupportedQualityList?.() ?? [];
  console.log('Player supports:', supported);
}

If player is not defined, wait a moment and try again, or check for "[BiliAutoQuality] Waiting for player to mount..." logs.

Manual Example (Console)

(async () => {
  const q = 64; // 720P
  await window.player?.requestQuality(q, null);
  console.log('Attempted to switch to', q);
})();

Compatibility

Compatible with the new Bilibili PC player (site-wide). If the player is significantly redesigned later, it may need to sync updates to the method name or mounting point.