mirror of
https://github.com/younesaassila/ttv-lol-pro.git
synced 2025-04-29 14:04:26 +02:00
commit
4384d50abc
@ -1,4 +1,17 @@
|
||||
function stripUnusedParams(str, params) {
|
||||
if (!params) {
|
||||
params = [ 'token', 'sig' ];
|
||||
}
|
||||
var tempUrl = new URL('https://localhost/' + str);
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
tempUrl.searchParams.delete(params[i]);
|
||||
}
|
||||
return tempUrl.pathname.substring(1) + tempUrl.search;
|
||||
}
|
||||
|
||||
function onPlaylistBeforeRequest(details) {
|
||||
|
||||
details.url = stripUnusedParams(details.url, null);
|
||||
|
||||
// (hls\/|vod\/)(.+?)$
|
||||
const match = /(hls|vod)\/(.+?)$/gim.exec(details.url);
|
||||
@ -41,4 +54,4 @@ chrome.webRequest.onBeforeSendHeaders.addListener(
|
||||
onBeforeSendHeaders,
|
||||
{ urls: ["https://api.ttv.lol/playlist/*", "https://api.ttv.lol/vod/*"] },
|
||||
["blocking", "requestHeaders"]
|
||||
);
|
||||
);
|
||||
|
@ -1,5 +1,18 @@
|
||||
function stripUnusedParams(str, params) {
|
||||
if (!params) {
|
||||
params = [ 'token', 'sig' ];
|
||||
}
|
||||
var tempUrl = new URL('https://localhost/' + str);
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
tempUrl.searchParams.delete(params[i]);
|
||||
}
|
||||
return tempUrl.pathname.substring(1) + tempUrl.search;
|
||||
}
|
||||
|
||||
function onPlaylistBeforeRequest(details) {
|
||||
|
||||
details.url = stripUnusedParams(details.url, null);
|
||||
|
||||
// (hls\/|vod\/)(.+?)$
|
||||
const match = /(hls|vod)\/(.+?)$/gim.exec(details.url);
|
||||
|
||||
@ -42,4 +55,4 @@ function onPlaylistBeforeRequest(details) {
|
||||
onBeforeSendHeaders,
|
||||
{ urls: ["https://api.ttv.lol/playlist/*", "https://api.ttv.lol/vod/*"] },
|
||||
["blocking", "requestHeaders"]
|
||||
);
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user