Skip to content

Instantly share code, notes, and snippets.

@Sainan
Created September 20, 2020 09:11
Show Gist options
  • Save Sainan/519f3ecbaf743b29cf4b28e993a6711c to your computer and use it in GitHub Desktop.
Save Sainan/519f3ecbaf743b29cf4b28e993a6711c to your computer and use it in GitHub Desktop.
Make logged-out Youtube a bit more enjoyable

This is custom bypass code for Universal Bypass. If you have the extension, head into the options and insert the Javascript below into your "Custom Bypasses" section, either appending it your other custom bypasses or replacing the example code.

As for how this makes logged-out Youtube more enjoyable:

  • Automatically closes the "please log in because Google is so great" pop-ups
  • Allows you to watch age-restricted videos without logging in (SFW Example)
domainBypass("youtube.com",()=>{
// Desktop "Upsell" aka. "Log the fuck in because Google is awesome!!1"
awaitElement("yt-upsell-dialog-renderer #dismiss-button",b=>b.click())
// Desktop "Log the fuck in or you can't watch this"
awaitElement("#reason.yt-player-error-message-renderer",d=>{
if(d.textContent=="Sign in to confirm your age")
{
awaitElement("#player:not(.skeleton)",p=>{
p.innerHTML='<iframe src="https://www.youtube.com/embed/'+new URLSearchParams(location.search).get("v")+'" style="position:relative;width:100%;min-height:480px;'+
/* This calc shit comes from Youtube CSS: */ 'min-width:calc(480px * (16 / 9));max-width:calc((100vh - (56px + 24px + 136px)) * (16 / 9))"/>'
})
}
})
// Mobile "Upsell" aka. "Log the fuck in because Google is awesome!!1"
awaitElement(".upsell-dialog-dismiss-button",b=>b.click())
// Mobile "Log the fuck in or you can't watch this"
awaitElement(".playability-reason",d=>{
if(d.textContent=="Sign in to confirm your age")
{
awaitElement(".player-size:not(#player)",p=>{
p.innerHTML='<iframe src="https://www.youtube.com/embed/'+new URLSearchParams(location.search).get("v")+'" style="position:absolute;top:0;left:0;width:100%;height:100%"/>'
})
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment