Redirect YouTube channel's home page

Piotr Stojanow's avatar
Name

Piotr Stojanow

Twitter
@piotrstojanow

I find a YouTube channel’s “home”/“featured” page useless. Almost always I want to see the most recent videos of a channel. For this reason I created the following userscript (GitHub) to redirect directly to the /videos tab:

(function () {
    const excludedPaths = ['/community', '/live', '/playlists', '/podcasts', '/shorts', '/streams'];

    const currentPath = window.location.pathname;
    const channelMatch = currentPath.match(/^\/@([^/]+)/);

    if (channelMatch) {
        const channelName = channelMatch[1];
        const shouldRedirect = !excludedPaths.some(path => currentPath.startsWith(`/@${channelName}${path}`));
        if (shouldRedirect && !currentPath.endsWith('/videos') || currentPath.endsWith('/featured')) {
            window.location.href = `https://www.youtube.com/@${channelName}/videos`;
        }
    }
})();

The script triggers when you visit any channel e.g. youtube.com/@channelname or youtube.com/@channelname/featured. It will not redirect from the following paths: '/community', '/live', '/playlists', '/podcasts', '/shorts', '/streams'.