Remove deprecated and add proxy server example
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
This folder contains an extension which can be used with both Chrome and Firefox to proxy twitch.tv m3u8 stream requests.
|
||||
|
||||
The target url is set to `http://127.0.0.1/`, you'll want to modify that based on your requirements.
|
||||
@@ -0,0 +1,20 @@
|
||||
var isChrome = typeof chrome !== "undefined" && typeof browser === "undefined";
|
||||
var extensionAPI = isChrome ? chrome : browser;
|
||||
function onBeforeRequest(details) {
|
||||
const match = /hls\/(\w+)\.m3u8/gim.exec(details.url);
|
||||
if (match !== null && match.length > 1) {
|
||||
return {
|
||||
redirectUrl: `http://127.0.0.1/twitch-m3u8/${match[1]}`
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
redirectUrl: details.url
|
||||
};
|
||||
}
|
||||
}
|
||||
extensionAPI.webRequest.onBeforeRequest.addListener(
|
||||
onBeforeRequest, {
|
||||
urls: ["https://usher.ttvnw.net/api/channel/hls/*"]
|
||||
},
|
||||
["blocking"]
|
||||
);
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "Twitch M3U8 Proxy",
|
||||
"description": "Twitch M3U8 Proxy",
|
||||
"version": "1.0",
|
||||
"manifest_version": 2,
|
||||
"background": {
|
||||
"scripts": ["background.js"],
|
||||
"persistent": true
|
||||
},
|
||||
"permissions": [
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"*://*.twitch.tv/*",
|
||||
"*://*.ttvnw.net/*"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user