Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WeTV - hijack callback

With this code you can hijack the JSON data WeTV player loads - doesn't matter the encryption version. Change the hijackedCallback function to do whatever you want with the data and then you can create a bookmarklet with this tool. After running the bookmarklet it will hijack one request - initial video load or when you change the quality. Comment out line 10 if you want it to keep hijacking.

If you use this code in your project - let me know and credit me. ;)

let hijackedCallback = data => {
new MutationObserver((mutations, observer) => {
for(let mutation of mutations) {
for(let element of mutation.addedNodes) {
if(element.tagName === 'SCRIPT' && element.src.indexOf('/play.') > -1) {
observer.disconnect(); // you can comment that line out if you want to keep observing
let callbackName = (new URL(element.src)).searchParams.get('callback');
(name => {
let realCallback = window[name];
window[name] = data => {
}).observe(document.head, {childList: true});
Copy link

Tithen-Firion commented Oct 10, 2020

You run this code and then change the video quality. You can see that hijackedCallback simply logs the data to the browser console (F12 > Console). This is just an example, you can do whatever you want with that data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment