Hi,

I would like to write a script that makes video links opened from the Youtube subscriptions page open in a new tab instead of the current, but I'm quite a noob at writing code.

Anyone able to give a helping hand please ?

Without writing it for you, here's a general approach to it:

  1. Identify all <a> tags on the page
    document.getElementsByTagName('a'));
    
  2. Loop through the collection of <a> tags.
  3. Set the target attribute on each <a> to force them to open in a new tab. A keyword of '_blank' will ensure a new tab each time the link is clicked. Or a unique identifier (such as the video's ID from the url) will ensure clicking the same link multiple times will only create / overwrite it's specified named tab.
  4. (Advanced): Everything above will only work for things on the page at the time the script runs and not on newly fetched content (such as clicking 'Load More' on a playlist). For that, you'll need to watch the parent container for newly added content ('Mutations') and call your function on that new content. One way is with the MutationObserver

Ooh, learned something new. If <a href="..." target="_blank"> works for you, it's as simple appending a <base target="_blank"> to <head>

var base=document.createElement('base');
base.target='_blank';
document.head.appendChild(base);

Thanks for trying to help XFoxPrower,
unfortunately it looks like Youtube does something to disallow links from opening in a new tab.
I already had this script, which AFAIK should work for clicking thumbnails & video titles on the subscription page, I even saw the target='_blank' being added to the specific elements, but it somehow doesn't get picked up upon clicking any of them.

var Alink = document.getElementsByClassName('yt-uix-tile-link yt-ui-ellipsis yt-ui-ellipsis-2       spf-link ');
for (var i = Alink.length - 1; i > -1; i--)
 {
   Alink[i].setAttribute("target", "_blank");
 }