返回博客
指纹

BotBrowser 帧率控制

BotBrowser 如何通过 --bot-fps 标志在浏览器引擎层面控制显示刷新率信号。

隐私风险

显示刷新率可通过 requestAnimationFrame 时间测量获取,它揭示了显示器硬件信息。这个值由物理硬件决定,清除 Cookie 或切换浏览器都不会改变它。

BotBrowser 的解决方案

BotBrowser 提供 --bot-fps 标志,在浏览器引擎渲染管线层面控制帧率。

基于配置文件的帧率

使用指纹配置文件中的值:

chrome --bot-profile="/path/to/profile.enc" \
       --bot-fps=profile \
       --user-data-dir="$(mktemp -d)"

无论实际显示刷新率如何,都报告配置文件中定义的帧率。

自定义或真实帧率

设置特定值或使用实际显示刷新率:

# 固定 60 FPS
chrome --bot-profile="/path/to/profile.enc" \
       --bot-fps=60

# 实际显示刷新率
chrome --bot-profile="/path/to/profile.enc" \
       --bot-fps=real

引擎层面控制

因为在渲染管线层面操作:

  • requestAnimationFrame 回调按控制的速率触发
  • 帧时间戳与报告的速率一致
  • CSS 动画与报告的帧率行为一致

验证

使用 --bot-fps 启动后,验证帧率:

const { chromium } = require('playwright-core');

const browser = await chromium.launch({
  executablePath: '/path/to/botbrowser/chrome',
  args: [
    '--bot-profile=/path/to/profile.enc',
    '--bot-fps=60',
  ],
  headless: true,
});

const page = await (await browser.newContext()).newPage();

const measuredFps = await page.evaluate(() => {
  return new Promise(resolve => {
    const timestamps = [];
    function frame(ts) {
      timestamps.push(ts);
      if (timestamps.length < 60) {
        requestAnimationFrame(frame);
      } else {
        const intervals = [];
        for (let i = 1; i < timestamps.length; i++) {
          intervals.push(timestamps[i] - timestamps[i - 1]);
        }
        const avg = intervals.reduce((a, b) => a + b) / intervals.length;
        resolve(Math.round(1000 / avg));
      }
    }
    requestAnimationFrame(frame);
  });
});

console.log('测量 FPS:', measuredFps); // 应约为 60

关键检查项:

  1. 测量帧率与配置值匹配
  2. 帧间隔一致
  3. 多种测量方法产生相同结果

快速开始

  1. GitHub 下载 BotBrowser
  2. 使用 --bot-profile 加载指纹配置文件
  3. 使用 --bot-fps=profile--bot-fps=real--bot-fps=60 设置帧率
  4. 验证报告的帧率与配置匹配
#fps#frame-rate#requestAnimationFrame#fingerprinting#privacy