0

I'm curious how some website prevent you to download its video ( only for study purpose ).

I start by wrap window.MediaSource.addSourceBuffer. But some how the website detect it. Here's the wrapper code :

let _addSourceBuffer = window.MediaSource.prototype.addSourceBuffer
window.MediaSource.prototype.addSourceBuffer = function(mime) {
    return _addSourceBuffer.call(this, mime)
}

How do you detect such wrapper in javascript?

  • 1
    There are many ways of doing this, we can't guess which the site might be using. One obvious one is invoking `toString` on `window.MediaSource.prototype.addSourceBuffer`. It should return something like `"function addSourceBuffer() { [native code] }"` but yours will return the function body you've defined. – user229044 Oct 28 '21 at 01:41
  • I thought about this actually. Is there any other way of detect such wrapper? – user16387400 Oct 28 '21 at 01:44
  • Are you sure they do detect it at call time? Is your script running before theirs? Can you link to the website? – Kaiido Oct 28 '21 at 01:55
  • How do you detect it not on call time? and my script is a tampermonkey script, they don't detect it as far as I don't override `MediaSource.addSourceBuffer`. I switch the setting to `load on document start`. And currently I not able to put the link, because it is not public yet... – user16387400 Oct 28 '21 at 02:04
  • 1
    They could have overridden the setter themselves and detect that you were trying to do it too. But without a clear error message, nor any code to chew on, we really can't help you here. – Kaiido Oct 28 '21 at 02:08

0 Answers0