Skip to content

Instantly share code, notes, and snippets.

@mallendeo
Created October 9, 2015 03:48
Show Gist options
  • Save mallendeo/8bf99b60554e59779107 to your computer and use it in GitHub Desktop.
Save mallendeo/8bf99b60554e59779107 to your computer and use it in GitHub Desktop.
Override XMLHttpRequest
(function(send) {
XMLHttpRequest.prototype.send = function () {
var callback = this.onreadystatechange
this.onreadystatechange = function() {
if (this.readyState == 4) {
var responseURL = this.responseURL
if (responseURL.match(/https?:\/\/www\.youtube\.com\/watch\?v=.*/g)) {
console.log(responseURL)
}
}
if (callback) {
callback.apply(this, arguments)
}
}
send.apply(this, arguments)
}
}(XMLHttpRequest.prototype.send))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment