Opening YouTube videos in third-party app

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

ltcomdata
Apollo supporter
Apollo supporter
Posts: 43
Joined: 2015-06-28, 03:49
Location: WI

Opening YouTube videos in third-party app

Unread post by ltcomdata » 2022-09-11, 07:36

Hello:

Assuming that I have a third-party application installed in my computer that can play YouTube videos... is there a way that every time I click on a YouTube link the video opens in the third-party application instead of in Pale Moon (perhaps by using an addon-on)?

Thanks!

User avatar
RealityRipple
Astronaut
Astronaut
Posts: 647
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California
Contact:

Re: Opening YouTube videos in third-party app

Unread post by RealityRipple » 2022-09-11, 08:14

You could probably change uTube's source code to execute an application with a little JS knowledge and research.

User avatar
tellu-white
Moon lover
Moon lover
Posts: 83
Joined: 2022-03-08, 22:02

Re: Opening YouTube videos in third-party app

Unread post by tellu-white » 2022-09-11, 12:04

ltcomdata wrote:
2022-09-11, 07:36
Is there a way that every time I click on a YouTube link the video opens in the third-party application instead of in Pale Moon (perhaps by using an addon-on)?
If you use Windows, you can try the add-on described in this post (Add-on Version II):

viewtopic.php?f=46&t=28494&sid=824b129a ... 22#p229411

User avatar
Kris_88
Keeps coming back
Keeps coming back
Posts: 933
Joined: 2021-01-26, 11:18

Re: Opening YouTube videos in third-party app

Unread post by Kris_88 » 2022-09-11, 12:38

If the problem is that the video opens slowly, you can try the Greasemonkey script. It forces the video to open in the full window and the page loads very quickly. You may not need an external player.

Code: Select all

// ==UserScript==
// @name        youtube
// @namespace   yt2
// @include     https://www.youtube.com/watch*
// @run-at document-start
// @version     1
// @grant       none
// ==/UserScript==
//=======================================================================//

(function() {

  var _isstyleinjected = false;

  document.addEventListener("beforescriptexecute", function(e) {

    if(
        e.target.src.indexOf('webcomponents-ce-sd.js') >= 0 ||
        e.target.src.indexOf('webcomponents-all-noPatch.js') >= 0 ||
        e.target.src.indexOf('network.js') >= 0 ||
        e.target.src.indexOf('web-animations-next-lite.min.js') >= 0 ||
        e.target.src.indexOf('desktop_polymer_legacy_browsers.js') >= 0 ||
        e.target.src.indexOf('intersection-observer.min.js') >= 0 ||
        e.target.src.indexOf('scheduler.js') >= 0 ||
        e.target.src.indexOf('desktop_polymer.js') >= 0 
      ) {
      e.preventDefault();
      e.stopPropagation();
      return;
    };


    if(!_isstyleinjected) {
  
      _isstyleinjected = true;
  
      var hd = document.querySelector('head');
      var hd2 = document.createElement("head");
      hd.parentNode.insertBefore(hd2, hd.nextSibling);
  
      var st = document.createElement("style");
      st.innerHTML = 
        'body * { visibility: hidden; } ' + 
        '#movie_player, #movie_player * { visibility: visible; } ' +
        'body { overflow: hidden; } ' +
        'video.video-stream.html5-main-video, #player-api, ' +
        '#movie_player, #movie_playervideo { position: fixed !important; ' +
        'width: 100% !important; height: 100% !important; ' +
        'top:0px !important; left:0px !important; } ' +
        '#movie_player { z-index: 10000 !important; } ' +
        'div.ytp-right-controls button[data-tooltip-target-id="ytp-autonav-toggle-button"], ' +
        'div.ytp-right-controls button.ytp-size-button, ' +
        'div.ytp-right-controls button.ytp-pip-button, ' +
        'div.ytp-right-controls button.ytp-miniplayer-button, ' +
        'div.ytp-right-controls button.ytp-fullscreen-button ' +
        '{ display: none !important; } ' +
        'div.ytp-volume-panel { width: 52px !important; } ' +
        'div.ytp-ad-overlay-container { display:none !important; }';
  
      hd2.appendChild(st);
    };

  }, true);

})();


Goodydino
Keeps coming back
Keeps coming back
Posts: 820
Joined: 2017-10-10, 21:20

Re: Opening YouTube videos in third-party app

Unread post by Goodydino » 2022-09-11, 17:46

Kris_88 wrote:
2022-09-11, 12:38
If the problem is that the video opens slowly, you can try the Greasemonkey script. It forces the video to open in the full window and the page loads very quickly. You may not need an external player.

Code: Select all

// ==UserScript==
// @name        youtube
// @namespace   yt2
// @include     https://www.youtube.com/watch*
// @run-at document-start
// @version     1
// @grant       none
// ==/UserScript==
//=======================================================================//

(function() {

  var _isstyleinjected = false;

  document.addEventListener("beforescriptexecute", function(e) {

    if(
        e.target.src.indexOf('webcomponents-ce-sd.js') >= 0 ||
        e.target.src.indexOf('webcomponents-all-noPatch.js') >= 0 ||
        e.target.src.indexOf('network.js') >= 0 ||
        e.target.src.indexOf('web-animations-next-lite.min.js') >= 0 ||
        e.target.src.indexOf('desktop_polymer_legacy_browsers.js') >= 0 ||
        e.target.src.indexOf('intersection-observer.min.js') >= 0 ||
        e.target.src.indexOf('scheduler.js') >= 0 ||
        e.target.src.indexOf('desktop_polymer.js') >= 0 
      ) {
      e.preventDefault();
      e.stopPropagation();
      return;
    };


    if(!_isstyleinjected) {
  
      _isstyleinjected = true;
  
      var hd = document.querySelector('head');
      var hd2 = document.createElement("head");
      hd.parentNode.insertBefore(hd2, hd.nextSibling);
  
      var st = document.createElement("style");
      st.innerHTML = 
        'body * { visibility: hidden; } ' + 
        '#movie_player, #movie_player * { visibility: visible; } ' +
        'body { overflow: hidden; } ' +
        'video.video-stream.html5-main-video, #player-api, ' +
        '#movie_player, #movie_playervideo { position: fixed !important; ' +
        'width: 100% !important; height: 100% !important; ' +
        'top:0px !important; left:0px !important; } ' +
        '#movie_player { z-index: 10000 !important; } ' +
        'div.ytp-right-controls button[data-tooltip-target-id="ytp-autonav-toggle-button"], ' +
        'div.ytp-right-controls button.ytp-size-button, ' +
        'div.ytp-right-controls button.ytp-pip-button, ' +
        'div.ytp-right-controls button.ytp-miniplayer-button, ' +
        'div.ytp-right-controls button.ytp-fullscreen-button ' +
        '{ display: none !important; } ' +
        'div.ytp-volume-panel { width: 52px !important; } ' +
        'div.ytp-ad-overlay-container { display:none !important; }';
  
      hd2.appendChild(st);
    };

  }, true);

})();

Does that imply that the video would start playing as soon as the page loads? Would there be any way still to require clicking the play button?

User avatar
Kris_88
Keeps coming back
Keeps coming back
Posts: 933
Joined: 2021-01-26, 11:18

Re: Opening YouTube videos in third-party app

Unread post by Kris_88 » 2022-09-11, 20:27

Goodydino wrote:
2022-09-11, 17:46
Does that imply that the video would start playing as soon as the page loads?
When not in a background tab, as normal for youtube.
Goodydino wrote:
2022-09-11, 17:46
Would there be any way still to require clicking the play button?
it is possible. 2 additional lines.

Code: Select all

// ==UserScript==
// @name        youtube
// @namespace   yt2
// @include     https://www.youtube.com/watch*
// @run-at document-start
// @version     1
// @grant       none
// ==/UserScript==
//=======================================================================//

(function() {

  var _isstyleinjected = false;

  document.addEventListener("beforescriptexecute", function(e) {

    var pl = document.querySelector('div[id="movie_player"]');
    if(pl && pl.pauseVideo) pl.pauseVideo();
    
    if(
        e.target.src.indexOf('webcomponents-ce-sd.js') >= 0 ||
        e.target.src.indexOf('webcomponents-all-noPatch.js') >= 0 ||
        e.target.src.indexOf('network.js') >= 0 ||
        e.target.src.indexOf('web-animations-next-lite.min.js') >= 0 ||
        e.target.src.indexOf('desktop_polymer_legacy_browsers.js') >= 0 ||
        e.target.src.indexOf('intersection-observer.min.js') >= 0 ||
        e.target.src.indexOf('scheduler.js') >= 0 ||
        e.target.src.indexOf('desktop_polymer.js') >= 0 
      ) {
      e.preventDefault();
      e.stopPropagation();
      // return;
    };


    if(!_isstyleinjected) {
  
      _isstyleinjected = true;
  
      var hd = document.querySelector('head');
      var hd2 = document.createElement("head");
      hd.parentNode.insertBefore(hd2, hd.nextSibling);
  
      var st = document.createElement("style");
      st.innerHTML = 
        'body * { visibility: hidden; } ' + 
        '#movie_player, #movie_player * { visibility: visible; } ' +
        'body { overflow: hidden; } ' +
        'video.video-stream.html5-main-video, #player-api, ' +
        '#movie_player, #movie_playervideo { position: fixed !important; ' +
        'width: 100% !important; height: 100% !important; ' +
        'top:0px !important; left:0px !important; } ' +
        '#movie_player { z-index: 10000 !important; } ' +
        'div.ytp-right-controls button[data-tooltip-target-id="ytp-autonav-toggle-button"], ' +
        'div.ytp-right-controls button.ytp-size-button, ' +
        'div.ytp-right-controls button.ytp-pip-button, ' +
        'div.ytp-right-controls button.ytp-miniplayer-button, ' +
        'div.ytp-right-controls button.ytp-fullscreen-button ' +
        '{ display: none !important; } ' +
        'div.ytp-volume-panel { width: 52px !important; } ' +
        'div.ytp-ad-overlay-container { display:none !important; }';
  
      hd2.appendChild(st);
    };

  }, true);

})();


User avatar
distantpluto
Fanatic
Fanatic
Posts: 115
Joined: 2015-12-17, 18:28
Location: UK

Re: Opening YouTube videos in third-party app

Unread post by distantpluto » 2022-09-12, 10:41

Kris_88 wrote:
2022-09-11, 20:27
it is possible. 2 additional lines...
That works a treat, thanks :)
Pale Moon and Epyrus on Arch Linux.

Locked