How to open any YouTube video directly with VLC with Clipman in Linux

Clipman is a clipboard manager for XFCE that can be extended with custom actions, using Regular Expressions, abbreviated to RegEx.

YouTube is still the most popular place on the Internet to find videos online. Over the years, YouTube has evolved, amassing a huge collection of content and, strangely enough, almost everything as it looks and how it works remains the same.

Although it has been equipped with many new features and received tweaks somewhere, watching videos on YouTube is still an experience not yet comparable to the standalone media players.

Thankfully, VLC supports playing (almost) any online video stream. Unfortunately, streaming a stream requires about 5 clicks or more. That may not seem important, but as the videos pile up, the process becomes tiring. Soon you will find yourself clicking directly on links in your browser because it's simpler, it's a lot easier. Is there no better way? Try Clipman!

Use Clipman to open YouTube videos directly with VLC

  1. What is clipman?
  2. Install VLC and Clipman
  3. Select or create action
  4. Name and sync actions
  5. Detect YouTube with RegEx
  6. Actual action to open in VLC
  7. Sent to VLC

What is clipman?

Clipman is a clipboard manager for XFCE that can be extended with custom actions, using Regular Expressions, abbreviated to RegEx.

Custom actions allow you to set it the way, when something you define is copied to the clipboard, Clipman will work. Custom actions do what you say to it, through setup.

You can set Clipman to do almost anything, run any terminal command when it detects a specific string of text.

You don't need to search for a specific example. That is the main topic of this article. The article will exploit the function of Clipman, to detect all YouTube URLs copied to the clipboard and forward them to VLC. This will turn online video streaming channels in VLC into a simple 2-click process.

Install VLC and Clipman

If they are not already installed in the system, add both VLC and Clipman to your local software collection. On Debian-based distributions, you can do that with:

 sudo apt-get install xfce4-clipman vlc 

Although Clipman is for XFCE, it will work in most other desktop environments. Please run Clipman. If you are using a relatively new version of XFCE as your desktop environment, it is already running and accessible from the taskbar. Right-click on the Clipman icon and select Properties from the pop-up menu to enter the options screen.

How to open any YouTube video directly with VLC with Clipman in Linux Picture 1

Ensure all options, except 'Show QR-Code' , are enabled.

Select or create action

Move to the Actions tab - contains a list of all the actions that Clipman has set for specific text strings. From here, you can create new actions with the plus button. You can edit existing actions by double clicking on them or selecting them and clicking the 'Edit' button (second action). And finally, you can delete any action you no longer need (the last button with the trash icon).

How to open any YouTube video directly with VLC with Clipman in Linux Picture 2

Click the plus button to create your first action.

Name and sync actions

The first thing to do when creating an action in Clipman is to name it. Because you can continue adding your own similar actions later, choose something recognizable and direct - for example, importing VLC YouTube .

How to open any YouTube video directly with VLC with Clipman in Linux Picture 3

Also, be sure to enable the option 'Activate only on manual copy' . It sounds like this option is a bit restrictive to you, but it allows Clipman to view the actual clipboard content and act upon detecting a string there. If this option is disabled, you must call Clipman to act on a text string instead of having it appear automatically.

Detect YouTube with RegEx

You can think of Regular Expressions as a logical way to identify text strings and some relationships between them, making them easily discoverable.

Download Regular Expresions Cheatsheet here:

 https://www.maketecheasier.com/cheatsheet/regex/ 

RegEx can be useful when, for example, when renaming large groups of files have similar names, but are not the same. You can create an additional RegEx formula, selecting all JPG (but not PNG) files starting with a certain word in a folder. Or in this case, any string containing the YouTube URL:

 (https://www.youtube.com/watch)(.*) 

Please note that you must copy it exactly as above, including all parentheses. It may look a bit like an alien hieroglyph, but is one of the simplest RegEx formulas:

  1. The symbol '/' you see is not an ASCII form of the letter v , but a backslash - - removed from the slash used in the URL. Because the slash is a special character in RegEx, when you want to treat it as an actual character and are part of the string you want to detect, you must put a backslash in front of it. The backslash, as you can guess, is how you get rid of other things in the 'RegEx world'.
  2. The RegEx formula is divided into two parentheses: The first brace contains the beginning of any YouTube video URL: 'http://www.youtube.com/watch'. And the second bracket - '(. *)' - is how RegEx says 'everything after that'.

How to open any YouTube video directly with VLC with Clipman in Linux Picture 4

Actual action to open in VLC

The rest is simpler and more direct: Enter the name for the command you want to run whenever the specified RegEx string is detected. The example has just entered 'VLC URL' here.

Enter the actual command in the following field. The command will be:

 vlc 

The first part is just running VLC itself. actually map to everything that matches the RegEx formula. In the example case are the YouTube URLs. Thankfully, VLC can open any YouTube URL directly, so there's no need to do anything other than direct it to the URL the example has copied.

Remember to click the plus button to add your command to the list, then click OK and exit the Properties window to activate the command.

How to open any YouTube video directly with VLC with Clipman in Linux Picture 5

Sent to VLC

How to open any YouTube video directly with VLC with Clipman in Linux Picture 6

While browsing YouTube, to directly open any video in VLC, right-click on its URL and select 'Copy Link Location' . A new pop-up window appears, this time from Clipman, that will detect it's a YouTube URL and allow you to select the related action set. Click on it and VLC will start streaming your video.

Hope you are succesful.

« PREV
NEXT »