HOWTO: Play HTML5 and Youtube Videos in an external Player

Post your tutorials for using Pale Moon or performing related tasks here.
Note: Not for "how do I...?" Questions!

Moderator: satrow

Forum rules
Tutorials and Howtos should only relate to Pale Moon, and not to third party applications. e.g.: Don't post a Howto for configuring your firewall.
If you have a question how to do something, you should use one of the support boards, not this board. It is meant for people to document and post instructions.
Posts: 10
Joined: 2016-09-17, 14:39

HOWTO: Play HTML5 and Youtube Videos in an external Player

Post by Kiray » 2016-11-01, 17:48

I already Posted this in another Thread, but I'm not sure if it's easily findable there, so I'm posting it here Again.
So I made an Greasemonkey Script which extracts HTML5 Videos and Youtube Video Links, removes the HTML5 Video Element and put's them into the Clipboard where an external Player or Script can pick it up.

Here the Greasemonkey Script:

Code: Select all

// ==UserScript==
// @name        Video2Clipboard
// @namespace   none
// @description Copies "" URL and HTML5 Video Sources to Clipboard and removes the Element, so External Programs can pick them up.
// @include     *
// @version     1.0
// @grant       GM_setClipboard
// ==/UserScript==
var clipprefix="extplay ";
var regex = /https*:\/\/*\/watch/;

//Check if Youtube
if (regex.test(window.location.href)) {

//Remove and copy HTML5 Videos
//document.addEventListener('DOMContentLoaded',function() {
var elems = document.querySelectorAll("video");
for (var i = 0; i < elems.length; i++) {

//Remove and copy newly created video elements
document.addEventListener("DOMNodeInserted", function(e) {
    var elem =;
    if (elem.nodeName == "VIDEO") {
}, false);
Just Click on the Greasemonkey dropdown -> "New User Script", Enter any Script Name and "none" as Namespace and just overwrite the Contents in the Text Editor with above Script.

And here an Bash One-liner which detects and passes the Link to the Videoplayer (smplayer in this Case):

Code: Select all

while true; do if [[ -n $( xclip -o | grep '^extplay') ]]; then url=$(xclip -o | awk '{print $2}'); smplayer $url; echo $url | xclip -i; fi; sleep 1; done
For Youtube Videos you need
1.) an Videoplayer that supports Youtube Video Links (which is the case for smplayer)
2.) and NoScript to stop the Embedded Youtube-Player from Playing.