您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Force User-Agent to pan.baidu.com for specific domains
当前为
// ==UserScript== // @name Baidu Netdisk UA Switcher // @namespace https://gf.qytechs.cn // @version 1.2 // @description Force User-Agent to pan.baidu.com for specific domains // @author Andy // @match *://resource.qblb.net/* // @match *://pan.baidu.com/* // @grant none // ==/UserScript== (function() { 'use strict'; // 自定义User-Agent const baiduUA = "pan.baidu.com"; // 覆盖XMLHttpRequest的open方法 const originalXhrOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(method, url, async, user, password) { this.setRequestHeader('User-Agent', baiduUA); originalXhrOpen.call(this, method, url, async, user, password); }; // 覆盖fetch请求 window.fetch = async (...args) => { const [url, options] = args; const newOptions = { ...options, headers: { ...(options?.headers || {}), 'User-Agent': baiduUA } }; return window.fetch(url, newOptions); }; // 尝试修改navigator.userAgent(可能失败) try { Object.defineProperty(navigator, 'userAgent', { value: baiduUA, writable: true }); } catch (error) { console.log('Failed to modify navigator.userAgent:', error.message); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址