Created
May 24, 2025 06:31
-
-
Save insin/351bf2344d340090677e23c1166ffd1a to your computer and use it in GitHub Desktop.
Going from "I am so S.M.R.T!" to "how have I been so stupid?" just like that
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
window.fetch = new Proxy(window.fetch, { | |
apply(target, thisArg, argArray) { | |
let promise = Reflect.apply(target, thisArg, argArray) | |
let url = argArray[0] instanceof Request ? argArray[0].url : argArray[0] | |
if (url.includes('reel_item_watch')) { | |
console.log('intercepting reel_item_watch') | |
return promise.then(response => { | |
response.clone().json().then(json => { | |
let menuItems = json.overlay.reelPlayerOverlayRenderer.menu.menuRenderer.items | |
let openAppItem = menuItems.find(item => | |
item.menuNavigationItemRenderer?.icon.iconType == 'OPEN_IN_NEW' | |
) | |
console.log({ | |
[document.body?.lang]: openAppItem.menuNavigationItemRenderer.text.runs[0].text, | |
}) | |
}).catch(e => { | |
console.log('error getting JSON', e) | |
}) | |
return response | |
}) | |
} | |
return promise | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment