Greasy Fork is available in English.

Discussions » Development

Possible to catch a resource link out of dynamically loaded content/pages?

§
Posted: 14-06-2021

If there's a website whose content only gets loaded from dynamic scripts that load other dynamic scripts that eventually load the content, is there a way to make a userscript that can "catch" a particular content URL when it eventually is loaded?

For example, if a site dynamically loads video content dynamically, the eventual video resource being at https://example.com/test.mp4, is there a way to make a userscript "listen" for any URL's loading resources to "example.com/*.mp4" ?

wOxxOmMod
§
Posted: 14-06-2021

Yes, you can hook/intercept the standard functions that make requests like unsafeWindow.fetch or unsafeWindow.XMLHttpRequest, look for examples.

§
Posted: 21-06-2021

Yes, you can hook/intercept the standard functions that make requests like unsafeWindow.fetch or unsafeWindow.XMLHttpRequest, look for examples.

Thanks wOx. My issue is I can't even find where the call itself is because of the deep dynamic mess of scripts/loads upon scripts/loads. In the browser dev console, the direct request for the file isn't attributed to a particular script, but rather "Other".

This is on Twitch when you use the clipping tool (for any stream/streamer). It opens the clipping tool in a new tab/window. In the network requests, there's some GraphQL interaction preceding a request for a .MP4 file. However, this request is attributed to "Other" and not tied to a particular script. What might you do here to trace to the source of this request?

Post reply

Sign in to post a reply.