Last active
April 21, 2020 03:00
-
-
Save slashinfty/522ba1d6e4ecb2fb5b026c34310bda57 to your computer and use it in GitHub Desktop.
Get a list of users who have sent a chat message in a Google Meet
This file contains 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
// To run (in Chrome): | |
// MUST HAVE GOOGLE MEET CHAT VISIBLE! | |
// Press F12 to open Developer Tools | |
// Click the "Console" tab | |
// Copy and paste the code below | |
function copyToClipboard(str) { | |
var tempInput = document.createElement("input"); | |
tempInput.style = "position: absolute; left: -1000px; top: -1000px"; | |
tempInput.value = str; | |
document.body.appendChild(tempInput); | |
tempInput.select(); | |
document.execCommand("copy"); | |
document.body.removeChild(tempInput); | |
} | |
//find the chat element | |
var list = document.querySelectorAll('[aria-live="polite"]'); | |
//find the messages | |
var messages = list[0].querySelectorAll('div'); | |
var names = []; | |
messages.forEach(msg => { | |
//get names from elements | |
let name = (/(^.*?[a-zA-z])\d/).exec(msg.textContent); | |
//if it's a name you haven't had before, add it to the list | |
if (name !== null && name[1] !== null && !names.includes(name[1])) names.push(name[1]); | |
}); | |
names.forEach((name, i) => { | |
//remove names that aren't names; also you | |
if (!(/^(\b[A-Z][\w\']*\s*)+$/).test(name) || name === "You") names.splice(i, 1); | |
}); | |
let namesAsString = ''; | |
//make it a list instead of an array | |
names.forEach((n, i) => namesAsString = i === 0 ? n : namesAsString + ', ' + n); | |
//copy list to your clipboard | |
copyToClipboard(namesAsString); | |
//now you can paste it where you want |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are so bold, you can create a bookmark and paste the following as the page (name can be whatever you want):
Then, if you click the bookmark while a Google Meet chat is open, it'll automatically copy the names to your clipboard.