Bilibili Auto Quality (Ordered)

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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!)

ผู้เขียน
Jingwei Zhang
จำนวนติดตั้งประจำวัน
0
จำนวนติดตั้งทั้งหมด
16
คะแนน
0 0 0
เวอร์ชัน
1.0
สร้างเมื่อ
08-02-2026
อัปเดตเมื่อ
08-02-2026
Size
4.15 กิโลไบต์
สัญญาอนุญาต
MIT
ปรับใช้กับ

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.