Supercharged YouTube Console Guide — basic + premium-like features (copy-paste ready)
Nice — below is a single readable article you can paste from top to bottom into the browser console (or copy individual snippets).
Important legal note up front: I will not provide or help with any code that hacks, cracks, or circumvents YouTube Premium paywalls (background play when intentionally blocked by the site, paid-download bypasses, account theft, etc.). That would be illegal/unethical. What I will provide: plenty of safe, browser-only console snippets that automate the page or use normal DOM / HTML5 APIs to give you premium-like convenience (Picture-in-Picture, automatic skip when the Skip button appears, background audio via PiP + hide video, instant speed/quality toggles, captions helpers, UI tweaks, etc.).
How to use
Open the YouTube video page, open DevTools → Console, then paste.
Start by grabbing the main <video> element (use v for all snippets below):
// Get the currently playing video element
var v = document.querySelector('video');
if (!v) console.warn("No <video> element found — make sure you're on a YouTube watch page.");
Basic playback & control (copy-paste)
v.play(); // play
v.pause(); // pause
v.currentTime = 60; // jump to 1:00
v.currentTime += 10; // skip forward 10s
v.currentTime -= 10; // back 10s
v.playbackRate = 1.5; // set speed to 1.5x
v.playbackRate = 0.75; // slow motion 0.75x
v.volume = 0.5; // set volume (0.0 - 1.0)
v.muted = !v.muted; // toggle mute
console.log({time:v.currentTime, dur:v.duration, speed:v.playbackRate});
Quick speed helpers
v.playbackRate = Math.min(16, v.playbackRate + 0.25); // increase speed safely
v.playbackRate = Math.max(0.1, v.playbackRate - 0.25); // decrease speed safely
v.playbackRate = 2; // set to 2x (your original example)
Loop, repeat range, instant replay
v.loop = true; // loop whole video
// repeat a range [start,end] in seconds
(function(start,end){
let id = setInterval(()=>{ if (v.currentTime > end) v.currentTime = start; }, 150);
// store ID on window so you can clear: window._repeatLoop = id
window._repeatLoop = id;
})(30, 45);
Stop repeat:
clearInterval(window._repeatLoop);
Picture-in-Picture & background audio tricks (legal)
// enter PiP
v.requestPictureInPicture().catch(e=>console.error(e));
// auto-enter PiP when playing (useful for background listening)
(function(){
v.addEventListener('play', ()=> v.requestPictureInPicture().catch(()=>{}));
console.log("Auto PiP on play enabled for this tab (until reload).");
})();
Make PiP + hide video (audio-only experience)
v.style.opacity = 0;
v.style.height = '0px';
v.requestPictureInPicture().catch(()=>{});
Restore:
v.style.opacity = '';
v.style.height = '';
document.exitPictureInPicture().catch(()=>{});
Auto-skip ads (click “Skip Ad” when available)
This does not bypass ads — it just automates clicking the visible Skip button when YouTube offers it.
window._skipAdInterval = setInterval(()=>{
const btn = document.querySelector('.ytp-ad-skip-button.ytp-button, .ytp-ad-skip-button');
if(btn) btn.click();
}, 250);
Stop auto-skip:
clearInterval(window._skipAdInterval);
“Clean player” — remove overlays / end screens / clutter
// remove end-screen suggestions
document.querySelectorAll('.ytp-ce-element, .ytp-ce-covering-overlay').forEach(n=>n.remove());
// remove suggested video thumbnails in the right rail
document.querySelectorAll('#related, #secondary').forEach(n=>n.style.display='none');
// minimal player controls (hide everything except video)
document.querySelector('.ytp-chrome-top')?.remove();
document.querySelector('.ytp-chrome-bottom')?.style.opacity = '0.6';
Restore page by reloading (recommended).
Force theatre / fullscreen mode
// theatre mode (toggle click the theatre button if available)
document.querySelector('.ytp-size-button')?.click();
// fullscreen
document.querySelector('.html5-video-player')?.requestFullscreen().catch(()=>{});
Captions / subtitles helpers
Toggle captions (if the button exists):
document.querySelector('.ytp-subtitles-button')?.click();
If captions are shown as DOM elements, extract visible caption text (useful for quick copying):
(function(){
const cues = Array.from(document.querySelectorAll('.caption-window, .ytp-caption-segment, .ytp-caption-window-rollup')).map(n => n.innerText).filter(Boolean);
console.log(cues.join('\n'));
})();
(Selectors vary; this tries common caption nodes.)
Downloading transcripts (legal only if visible on page)
YouTube provides "Open transcript" via the UI — this just extracts currently shown transcript lines:
(function(){
const lines = Array.from(document.querySelectorAll('#body #segments-container .segment')).map(s=>s.innerText.trim()).filter(Boolean);
if(lines.length) console.log(lines.join('\n'));
else console.log("No transcript DOM found — open the Transcript panel or use the UI '...' > Open transcript.");
})();
Quality helper (attempt to open settings menu and click quality)
YouTube changes DOM often. You can try opening settings programmatically — success may vary.
// tries to open settings menu
document.querySelector('.ytp-settings-button')?.click();
// attempt to set quality by searching menu items (may fail if YouTube changed DOM)
setTimeout(()=>{
const menu = Array.from(document.querySelectorAll('.ytp-panel-menu .ytp-menuitem'));
const q = menu.find(m => /quality|p$/i.test(m.innerText));
if(q) q.click();
else console.warn("Quality menu item not found — YouTube DOM likely changed.");
},300);
(If that fails, use the native gear menu manually — this script is best-effort only.)
UI effects & fun things
// rotate video 180°
v.style.transform = 'rotate(180deg)';
// mirror video
v.style.transform = 'scaleX(-1)';
// spin video continuously
window._spin = setInterval(()=> v.style.transform = `rotate(${(Date.now()/10)%360}deg)`, 20);
// stop spin
clearInterval(window._spin); v.style.transform='';
Automatic watch-progress logger (great for developers)
// logs every 5s
window._watchLogger = setInterval(()=> console.log(`t=${v.currentTime.toFixed(1)} / ${v.duration?.toFixed(1)}`), 5000);
Stop it:
clearInterval(window._watchLogger);
Keyboard shortcuts via console (example: space to play/pause anywhere)
// attach global key handler (space toggles play/pause, > increases speed, < decreases)
window.addEventListener('keydown', function _ytKey(e){
if(document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') return;
if(e.code === 'Space'){ e.preventDefault(); v.paused? v.play(): v.pause();}
if(e.key === '>') v.playbackRate = Math.min(16, v.playbackRate + 0.25);
if(e.key === '<') v.playbackRate = Math.max(0.1, v.playbackRate - 0.25);
});
console.log("Global keyboard shortcuts enabled: Space = play/pause, > = faster, < = slower");
(Remove by reloading the page.)
Auto-like / auto-subscribe (one-click)
// like
document.querySelector('[aria-label^="like this video"], [aria-label*="like this video"]')?.click();
// subscribe (note: will subscribe your logged-in account)
document.querySelector('#subscribe-button yt-button-shape, #subscribe-button button')?.click();
Be careful with auto-subscribe — it performs an account action.
Extract video metadata (title, id, author, thumbnail)
const meta = {
title: document.querySelector('h1.title, h1.ytd-watch-metadata')?.innerText?.trim(),
author: document.querySelector('.ytd-channel-name a')?.innerText?.trim(),
videoId: new URL(location.href).searchParams.get('v'),
thumbnail: `https://i.ytimg.com/vi/${new URL(location.href).searchParams.get('v')}/maxresdefault.jpg`
};
console.log(meta);
Auto-pause when tab is hidden (save bandwidth)
document.addEventListener('visibilitychange', ()=> {
if(document.hidden) v.pause();
else v.play();
});
Batch small useful snippets (run individually)
- Jump to end minus 1s:
v.currentTime = Math.max(0, v.duration - 1);
- Set exact playback time (MM:SS):
(function(mm,ss){ v.currentTime = mm*60 + ss; })(2,30); // jump to 2:30
- Slow-motion + auto frame step:
v.playbackRate = 0.5; v.pause(); v.currentTime += 0.04;
- Extract available audio tracks (if accessible):
console.log(v.audioTracks?.length ? Array.from(v.audioTracks).map(a=>a.label) : 'No audioTracks API available');
- Highlight comments area:
document.querySelector('#comments')?.scrollIntoView();
document.querySelector('#comments')?.style.border = '4px solid #f00';
- Toggle captions styling (if cue elements exist):
document.querySelectorAll('.ytp-caption-segment').forEach(n => n.style.textShadow='2px 2px 4px #000');
- Clear inline style changes (restore video):
v.style = '';
- Simulate click on the mini-player button:
document.querySelector('.ytp-miniplayer-button')?.click();
- Pause when playbackRate > 4 (safety):
if(v.playbackRate > 4) v.pause();
- Show current video URL + timestamp to copy:
console.log(`${location.href}&t=${Math.floor(v.currentTime)}s`);
“Premium features” I WON’T provide
- Any code that removes the paywall or enables Premium-only features for non-paying users (e.g., unlocking downloads behind Premium, background play if site explicitly blocks it for non-premium accounts, or tricks to bypass paid access).
- Code to steal accounts, bypass authentication, or download videos in ways YouTube forbids.
If you want paid features, support creators and consider subscribing to YouTube Premium or YouTube Music — that directly funds creators and gives full legitimate access.
Alternatives to get Premium features legally
- Use Picture-in-Picture (supported above) for background listening on desktop — many browsers support it.
- Subscribe to YouTube Premium for ad-free listening, background play on mobile, and downloads for offline.
- Use the YouTube Music app or web UI for background audio and playlists.
Final tips & safety
- YouTube changes classes/DOM frequently. If a selector doesn't work, inspect the element and adapt the selector.
- Running console scripts will affect only your browser session (unless you perform account actions like subscribe/like).
- Avoid scripts that perform repeated account actions (could be flagged as bot behavior).
- If you want a single ready bookmarklet for a favorite snippet (e.g., toggle 2x speed), I can convert any snippet into a bookmarklet.
Top comments (0)