您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Print content-type 'application/vnd.apple.mpegurl'
当前为
// ==UserScript== // @name Print requests with content-type 'application/vnd.apple.mpegurl' // @namespace http://your-domain-here/ // @version 8 // @description Print content-type 'application/vnd.apple.mpegurl' // @match http://*/* // @match https://*/* // @grant GM_xmlhttpRequest // @license MIT // ==/UserScript== (function() { 'use strict'; // Intercept the XHR requests function interceptXHR(xhr) { // Print the XHR request to the console console.log('XHR request intercepted:', xhr); // Check if the content type is application/vnd.apple.mpegurl const contentType = xhr.getResponseHeader('content-type'); if (contentType === 'application/vnd.apple.mpegurl') { console.log('XHR request with content type application/vnd.apple.mpegurl:', xhr); } } // Add interceptors to all XHR requests window.XMLHttpRequest.prototype.realSend = window.XMLHttpRequest.prototype.send; window.XMLHttpRequest.prototype.send = function(data) { interceptXHR(this); this.realSend(data); }; // Observe the document for changes and add interceptors to any new iframes const observer = new MutationObserver(observeIframes); observer.observe(document, { childList: true, subtree: true }); // Add interceptors to any iframes already in the document observeIframes(); function observeIframes() { const iframes = document.getElementsByTagName('iframe'); console.log('observeIframes:', iframes.length); for (let i = 0; i < iframes.length; i++) { addInterceptorToIframe(iframes[i]); } } function addInterceptorToIframe(iframe) { // Check if interceptor already added if (iframe.contentWindow.XMLHttpRequest.prototype.realSend) { return; } // Add interceptor to XHR requests in the iframe iframe.contentWindow.XMLHttpRequest.prototype.realSend = iframe.contentWindow.XMLHttpRequest.prototype.send; iframe.contentWindow.XMLHttpRequest.prototype.send = function(data) { interceptXHR(this); this.realSend(data); } // Observe the iframe for changes and add interceptors to any new iframes const observer = new iframe.contentWindow.MutationObserver(observeIframesInIframe); observer.observe(iframe.contentDocument, { childList: true, subtree: true }); // Add interceptors to any iframes already in the iframe observeIframesInIframe(); function observeIframesInIframe() { const iframes = iframe.contentDocument.getElementsByTagName('iframe'); for (let i = 0; i < iframes.length; i++) { addInterceptorToIframe(iframes[i]); } } } })();