Greasy Fork is available in English.

Discussions » Creation Requests

Youtube - land on user's video page by default

§
Posted: 03-04-2015

Youtube - land on user's video page by default

Simple request (I hope)

Any time you land on a youtube user's home page, for example https://www.youtube.com/user/grindinggear/featured
Redirect automatically to the video's page: https://www.youtube.com/user/grindinggear/videos

wOxxOmMod
§
Posted: 06-04-2015
Edited: 11-04-2015

That can be done in two ways:

  1. Rewrite the user page links on any site to point to videos page, use Ctrl-Alt-click to skip redirection:
  // ==UserScript==
  // @name Youtube: open user's videos instead of the personal page
  // ==/UserScript==

  window.addEventListener('click', function(e) {
        if (e.altKey)
            return;

        var a = e.target;

        //search the parent A element if needed, max 10 levels up the hierarchy
        for (i=10; a.localName != 'a'; i--, a = a.parentNode)
            if (i==0 || !a.parentNode)
                return;

        a.href = a.href.replace(/(youtube\.com.*?\/user\/[^\/]+)(?:\/featured)?\/?$/, '$1/videos');
  });
  1. Redirect to the videos page only when a user page is opened, which will be briefly visible:
  // ==UserScript==
  // @name    Youtube: open user's videos instead of the personal page
  // @include https://www.youtube.com/user/*
  // ==/UserScript==

  if (m = location.href.match(/(^.+?youtube\.com.*?\/user\/[^\/]+)(?:\/featured)?\/?$/))
        location.href = m[1] + '/videos';
§
Posted: 11-04-2015

Sounds good, but doesn't seem to work. The first script does nothing at all, and the second one does redirect to the videos page, but it reloads the video page over and over in and endless loop. Did you try the scripts?

wOxxOmMod
§
Posted: 11-04-2015

Fixed a few typos, try it again.

Post reply

Sign in to post a reply.