// ==UserScript== // @name B 站网页端直播游戏 // @namespace ProgramRipper // @version 0.0.0 // @author ProgramRipper // @license MIT // @description 在 B 站网页端开播游戏 // @homepage https://github.com/ProgramRipper/BilibiliLiveGameWeb // @icon https://www.bilibili.com/favicon.ico // @supportURL https://github.com/ProgramRipper/BilibiliLiveGameWeb/issues // @match *://link.bilibili.com/p/center/index // @connect api.live.bilibili.com // @connect * // @downloadURL none // ==/UserScript== /* eslint-disable */ /* spell-checker: disable */ // @[ You can find all source codes in GitHub repo ] (() => { "use strict"; const originOpen = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function (method, url, async = true, user = null, password = null) { if (method === 'POST') { const { host, pathname } = new URL(url.startsWith('//') ? 'https:' + url : url); if (host === 'api.live.bilibili.com' && pathname === '/room/v1/Room/startLive') { this.send = (body) => { const searchParams = new URLSearchParams(body); searchParams.set('platform', 'ios'); XMLHttpRequest.prototype.send.call(this, searchParams.toString()); }; } } originOpen.call(this, method, url, async, user, password); }; })();