Created
October 9, 2015 03:48
-
-
Save mallendeo/8bf99b60554e59779107 to your computer and use it in GitHub Desktop.
Override XMLHttpRequest
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(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