Skip to content

Instantly share code, notes, and snippets.

@gombossb
Created April 10, 2021 11:20
Show Gist options
  • Save gombossb/02dc1c5bc8f9ccf7be137633d3b3141c to your computer and use it in GitHub Desktop.
Save gombossb/02dc1c5bc8f9ccf7be137633d3b3141c to your computer and use it in GitHub Desktop.
Watch2gether color changer script
// watch2gether background color changer script
// change this to your room code
let roomCode = "abcdefghijklmnopqr";
function randomColor(){
return "#" + Math.floor(Math.random()*16777215).toString(16).toUpperCase();
}
function req(){
fetch("https://w2g.tv/rooms/"+roomCode+"/sync_update", {
"headers": {
"accept": "application/json",
"accept-language": "en-US,en;q=0.9",
"content-type": "application/json",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin"
},
"referrer": "https://w2g.tv/rooms/"+roomCode,
"referrerPolicy": "no-referrer-when-downgrade",
"body": "{\"bg_color\":\""+randomColor()+"\"}",
"method": "POST",
"mode": "cors",
"credentials": "include"
});
}
for (var i=0; i<5; i++){
setTimeout(req, i*1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment