Ad-Free YouTube With a Custom Player

Published: (April 1, 2026 at 11:03 PM EDT)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for Ad‑Free YouTube With a Custom Player

As enshittification marches on—more ads, more dark patterns, UI designed to serve the platform instead of the user—I’ve been writing userscripts to take back control of my browser. The web is full of intrusive UI: search results that hide answers behind AI summaries, cookie banners that trick you into opting in, and click‑bait overlays.

YouTube is one of the worst offenders: pre‑roll ads, mid‑roll interruptions, and recommended‑video overlays that hijack the screen. Fortunately, YouTube’s own embed domain youtube-nocookie.com serves no ads. By intercepting youtube.com/watch?v=VIDEO_ID links and routing them through a third‑party pass‑through (yout-ube.com), the request is rewritten to a nocookie embed while preserving the correct HTTP Referer. This avoids the “Error 153” that kills playback when navigating directly to a nocookie URL.

A second script runs on the nocookie domain to enhance the player, giving you the full video with zero ads.

YouTube No Cookie Player – custom player on youtube‑nocookie.com (comments panel open, like/dislike ratio bar, clean controls, zero ads)

What I Built

Speed hold

Hold the mouse button over the video to speed it up:

  • Upper half → 2× speed
  • Lower half → 3× speed

Release to snap back to 1×. No UI elements, just muscle memory.

Double‑click fullscreen

YouTube’s overlay swallows the native dblclick event, so the script tracks clicks manually. Two clicks within 300 ms over the video area toggle fullscreen.

Comments panel

A collapsible panel at the bottom of the player pulls comments via the YouTube Data API v3. Features include:

  • Top or New sort
  • Like counts, timestamps
  • Like/dislike ratio bar

UI Cleanup

The nocookie player still renders unwanted elements (e.g., “watch on YouTube” button, fullscreen recommendations overlay, loop icon). All of these are removed with CSS:

player-fullscreen-action-menu,
.ytp-pause-overlay-container,
.watch-on-youtube-button-wrapper,
.ytFullscreenVideoRecommendationsHost {
  display: none !important;
}

Volume, closed captions, and settings buttons are relocated to a custom bottom bar for a tidier interface.

Set It Up Yourself

  • Video walkthrough:
  • Full written instructions, both scripts, and API‑key setup:
0 views
Back to Blog

Related posts

Read more »

Execution Context

Bayangkan Execution Context seperti sebuah dapur. Sebelum kamu memulai memasak mengeksekusi kode, kamu perlu ruang kerja, peralatan variabel, dan resep function...