Last active
April 27, 2025 06:13
-
-
Save OkoyaUsman/23bbcde3431f43b01761344f3b9b9159 to your computer and use it in GitHub Desktop.
Decrypting HLS stream keys on the fly according to https://blog.jonlu.ca/posts/illegal-streams
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
const originalFetch = window.fetch; | |
window.fetch = function(input, init){ | |
if(init && init.method === 'GET' && input.indexOf("something.com/aes") !== -1) { | |
const rewrittenUrl = "https://example.com/key.php?key="+input; | |
init = { ...init, url: rewrittenUrl }; | |
const modifiedRequest = new Request(rewrittenUrl, init); | |
return originalFetch.call(this, modifiedRequest); | |
} | |
return originalFetch.call(this, input, init); | |
}; | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (open) { | |
XMLHttpRequest.prototype.open = function (method, url, async, user, pass) { | |
var rewrittenUrl = url; | |
if(url.indexOf("svcs.mlb")!=-1){ | |
rewrittenUrl="https://example.com/key.php?id=keyURL"; | |
} | |
if(url.indexOf("svcs.plus.espn")!=-1){ | |
rewrittenUrl="https://example.com/key.php?id=keyURL"; | |
} | |
open.call(this, method, rewrittenUrl, async, user, pass); | |
}; | |
})(XMLHttpRequest.prototype.open); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment