虎牙自动最高码率 (免登录), 屏蔽 PCDN

将默认码率调到最高码率 (可突破扫码专享, 实测最高到蓝光 20M), 并屏蔽 PCDN, 防止偷跑上传

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

Author
浩劫者12345
Daily installs
2
Total installs
286
Ratings
0 0 0
Version
1.1.0
Created
2025-09-14
Updated
2025-09-16
Size
2.04 KB
License
MIT
Applies to

码率修改:

默认码率判断逻辑在 https://a.msstatic.com/huya/h5player/room/2509100944/vplayer.js 中:

function tt(t) {
    if (!y.isCheckDefBit) {
        if (y.curBitRate = 0,
        y.isCheckDefBit = !0,
        !y.isLogin) {  // 是否登录
            var e = y.bitRateList1.length;
            if (e > 0)
                return void (y.curBitRate = y.bitRateList1[e - 1].iBitRate)  // 不登录时选择最差画质
        }
        y.isAutoBitrate = y.h5player && y.h5player.getUseAuto();
        var i = c.getCookie("videoBitRate");  // 上次使用码率 (在 cookie 里面)
        y.bitRateInCookie = "" === i ? -1 : i,
        i = parseInt(i) || 2147483647,
        t = y.aBTestDefaultBitrate > 0 ? y.aBTestDefaultBitrate : t || 2147483647,  // 默认码率
        y.iWebDefaultBitRate = t;
        var s = Math.min(i, t)  // 上次使用码率和默认码率, 取较小值

判断是否登录逻辑也在 vplayer.js 里面:

S = {
    ENV: null,
    vplayer: null,
    vplayerUI: null,
    logUtils: g,
    Event: v,
    menuItems: [],
    menuData: // ...一堆参数
}
// ...各种赋值
S.yyuid = parseInt(c.getCookie("yyuid")) || parseInt(c.getCookie("udb_uid")) || 0,  // 从 cookie 获取 yyuid
S.isLogin = S.yyuid > 0,  // 判断 yyuid 是否存在来判断是否登录

默认码率随文档加载, 写在 hyPlayerConfig.stream.iWebDefaultBitRate 里, 由一个内联 <script> tag 全局赋值:

<script>
    var hyPlayerConfig = {
        // ...
        stream: {
            // ...
            "iWebDefaultBitRate": 4000,  // 默认码率
            "iFrameRate": 60
        }
    };
</script>

通过向 cookie 写入 videoBitRateyyuid, 并 hook hyPlayerConfig 的赋值, 以达到更改默认码率的效果

屏蔽 PCDN

通过 hook RTCPeerConnection 的构造函数实现屏蔽 WebRTC 连接, 从而使 PCDN 失效
理论上可用于所有网站