Home | Computer Graphics |     Share This Page
YouTube Ad Killer

Deal with YouTube's worst behaviors

P. Lutus Message Page

Copyright © 2021, P. Lutus

Most recent update:

Introduction | Installation | Updates | Testing | Licensing

(double-click any word to see its definition)

Introduction

To me personally, over the past several years YouTube's increasingly aggressive advertising policy has destroyed the previous YouTube experience and made the experience scarcely worth having. In frustration, for a spell I stopped visiting YouTube altogether, until I realized I could create a utility to lift the videos from their environment, glean the wheat from the chaff, so to speak. This project explains how to do it.

This web page's title is somewhat simplified, but among other things the utility presented here kills off YouTube ads, for both Windows and Linux. In Linux it's a Bash shell script, in Windows it's a Powershell script, both provide the same functions. The scripts monitor the system clipboard and, when a video URL is detected, the free video player VLC is launched in full-screen mode and the video is played with no ads1.

After launching this utility, the user need only visit YouTube or another video hosting site, point to a video of interest, right-click and select "Copy Link Location" (Firefox), "Copy link address" (Google Chrome / Chromium), or similar wording in other browsers, and within a second, this utility will detect the URL on the clipboard, launch VLC and play the video you've chosen2.

Drawbacks and Advantages

Here are the drawbacks to this way of playing a YouTube video:

  • If the video has a time index/bookmarks, they won't be displayed.
  • If the video has internal links to other videos, those won't be displayed.
  • Basically, all the special YouTube embedded video features are lost.

Here are the advantages:

  • Normally when playing a YouTube video, your location on the parent video listing page is lost — this method prevents that, you don't lose your place.
  • There are no ads1.

Footnotes:

  1. Except any ads the video creator directly embeds in his/her video.
  2. The user need only copy the URL to the system clipboard, no paste action is needed.
Installation

The Linux and Windows installation procedures are much the same, differing only in details.

Windows Installation

  • Download and install the free VLC video player from this page.
  • Create a directory named C:\VLC_utilities in the Windows filesystem root directory.
  • Download this Powershell script and place it in the new directory.
  • Download this desktop shortcut file, if necessary rename it "Launch_VLC_using_Clipboard.lnk" and place it on your desktop.
  • But if for reasons of security you prefer to create your own desktop shortcut, use these entries:
    • Title: Any suitable title, I usually choose "Launch VLC using Clipboard".
    • Target: Must be exactly this —
      powershell.exe -noprofile -executionpolicy bypass -file C:\VLC_utilities\VLC_clipboard_launcher.ps1
      — but on one line. This method of invocation creates an exception — for this one script — to the default Windows 10 prohibition against running unsigned Powershell scripts.
    • Icon: Browse to the previously downloaded VLC executable and select it (by default it will be located at C:\Program Files (x86)\VideoLAN\VLC\vlc.exe). This will assign the VLC application icon to the shortcut.
    • Filename: Any filename is suitable, but the default is "Launch_VLC_using_Clipboard.lnk".
    • After these steps are complete, make a copy of the shortcut to your desktop.

Linux Installation

  • In a Bash shell session, install the free VLC video player and one additional package like this (Debian and derivatives):
    sudo apt update
    sudo apt install vlc xclip
  • In a shell session, create a directory named VLC_utilities under your user's home directory:
    mkdir ~/VLC_utilities
  • Download this Bash shell script and place it in the new directory.
  • In a shell session, make the shell script executable:
    chmod +x ~/VLC_utilities/VLC_clipboard_launcher.sh
  • Download this desktop shortcut file and place it on your desktop.
  • In a shell session, make the shortcut executable:
    chmod +x ~/Desktop/vlc_from_clipboard.desktop
Updates
  • In 2021 I noticed the YouTube video playback began stalling and sometimes crashing VLC. I eventually figured out that YouTube was limiting the download data rate, but because my primary display supports 4K, VLC would try to download at that resolution (or 1080p) and data rate. Under these circumstances VLC couldn't sustain timely playback and would stall or crash.

    So in my launcher scripts I added an option to choose a more modest resolution that VLC supports, regardless of the display resolution. In each of the scripts is an option to set a preferred resolution which, if your display is as large as mine is, will prevent stalls and crashes.

    Just edit your copy of the script and set a value for "pr" suitable for your display and circumstances. In most cases the default setting of "576" will solve the issue.

Testing

These tests should work much the same in both Windows and Linux.

  • Click the desktop link and, if no errors have been made, this will appear:
  • Now start your favorite browser, visit a site that hosts videos, right-click a video and select "Copy Link Location" (Firefox), "Copy link address" (Google Chrome / Chromium), or similar wording in other browsers, and the VLC video player should launch and show the video — without ads. (There's no need to paste the copied URL — this utility automatically reads the clipboard's contents.)
Licensing

This dual-platform VLC clipboard player utility is Copyright 2021, P. Lutus and is licensed under the GPL. Please honor the GPL license conditions by appropriately attributing derived versions to this copyright holder.

Home | Computer Graphics |     Share This Page