Created
November 2, 2018 01:47
-
-
Save gdoteof/087dc983e408a96b43e7053cf86c143f to your computer and use it in GitHub Desktop.
youtube chat logger
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
function lastMessage(){ | |
let a = document.getElementsByTagName('yt-live-chat-text-message-renderer'); | |
return { | |
user: a[a.length-1].getElementsByTagName('yt-live-chat-author-chip')[0].innerText, | |
message: a[a.length-1].querySelector('#message').innerText, | |
} | |
} | |
window.ggCacheChat = {user:'',message:''} | |
window.ggCacheStore= [] | |
function sample(){ | |
var last = window.ggCacheChat; | |
var check = lastMessage(); | |
if (last.user !== check.user || last.message !== check.message) { | |
window.ggCacheStore.push(check) | |
console.log("adding ", check); | |
} | |
window.ggCacheChat = check; | |
} | |
var myInterval = window.setInterval(sample, 100) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment