Skip to content

Instantly share code, notes, and snippets.

@whobutsb
Created June 21, 2018 15:35
Show Gist options
  • Save whobutsb/05261fce928c80a59d950f43ce6a9ccc to your computer and use it in GitHub Desktop.
Save whobutsb/05261fce928c80a59d950f43ce6a9ccc to your computer and use it in GitHub Desktop.
chrome = Application("Google Chrome");
windows = chrome.windows;
for(i = 0; i < windows.length; i++){
tabs = windows[i].tabs;
for(j = 0; j < tabs.length; j++){
url = tabs[j].url();
if(url.match(/youtube.com/)){
tabs[j].execute({ javascript: "document.querySelector('.ytp-play-button').click();" });
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment