googlebis
Power Member
- Feb 7, 2017
- 519
- 224
see latest update when youtube added "for you" chip and they made it by default?
here is how to make it "latest" by default
and as a bonus whenever you click on a channel it redirects you directly to /videos instead of the homepage of the channel!
first you need to install "tampermonkey" extension
then you click on it and click on dashboard
then click on the plus sign to create new page
the first page paste this code (which will redirect you to /videos when you click on a channel)
after you're done click save and then create new page and pate this code in it (which will autoclick on "latest" chip)
after you're done control+s to save
NOTE: the youtube update is still on the way so if you don't see "for you" chip then the update didn't get to you yet, therefor the code won't work but you can desable the second code and leave the first code so it takes you to /videos...
bons extention: (bing chat for all browsers) you an use bing chat on any browser.
the code was modified by chatgpt (i couldn't merge them together!)
here is how to make it "latest" by default
and as a bonus whenever you click on a channel it redirects you directly to /videos instead of the homepage of the channel!
first you need to install "tampermonkey" extension
then you click on it and click on dashboard
then click on the plus sign to create new page
the first page paste this code (which will redirect you to /videos when you click on a channel)
Code:
// ==UserScript==
// @name Youtube channel default tab
// @match https://www.youtube.com/*
// @exclude https://www.youtube.com/embed*
// @run-at document-start
// @license MIT License
// @grant none
// ==/UserScript==
(() => {
const RX_CHANNEL_HOME = /^(https?:\/\/www\.youtube\.com)((\/(user|channel|c)\/[^/]+)(\/?$|\/featured[^/])|(\/@(?!.*\/)[^/]+))/;
const DEFAULT_TAB_HREF = "/videos";
// the byte/ascii sequence '0x12 0x06 v i d e o s' encoded with base64 and uri component encoding seems to correspond to the videos tab
const DEFAULT_TAB_ENDPOINT_PARAMS = encodeURIComponent(btoa(String.fromCharCode(0x12, 0x06) + "videos"));
if (RX_CHANNEL_HOME.test(location.href)) {
// this will get invoked when a youtube channel link is reached from a non-youtube origin page
// where we didn't rewrite the link
location.href = RegExp.$2 + DEFAULT_TAB_HREF;
return;
}
addEventListener('mousedown', event => {
const a = event.target.closest('a');
if (a && RX_CHANNEL_HOME.test(a.href)) {
// a channel link was clicked so it has to be rewritten before the actual navigation happens
// this makes sure the redirect above in line 15-20 is not needed as long as the link clicked is on a youtube page
// e.g. when opening a channel link in a new tab
a.href = RegExp.$2 + DEFAULT_TAB_HREF;
// without this the url in the browsers navigation bar will show the wrong url but the videos tab is still being loaded
try { a.data.commandMetadata.webCommandMetadata.url = RegExp.$2 + DEFAULT_TAB_HREF; } catch (e) {}
// this makes sure that the videos tab is the one actually being loaded
try { a.data.browseEndpoint.params = DEFAULT_TAB_ENDPOINT_PARAMS; } catch (e) {}
}
}, true);
})();
after you're done click save and then create new page and pate this code in it (which will autoclick on "latest" chip)
Code:
// ==UserScript==
// @name YouTube Channel Page Auto Click "Latest" May 2023
// @description Emulate mouse click on the "Latest" chip on YouTube channel pages
// @namespace ytchannellatest
// @version 2
// @match *://*.youtube.com/*
// @run-at document-end
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @license public domain
// ==/UserScript==
(function() {
console.log(`${GM.info.script.name} run`);
if (
window.location.pathname !== '/' &&
window.location.pathname !== '/results' &&
!window.location.pathname.startsWith('/watch')
) {
var clickLatestChip = function() {
var latestChip = document.querySelector('yt-chip-cloud-chip-renderer[aria-selected="false"]');
if (latestChip) {
latestChip.click();
}
};
var clickLatestChipOnLoad = function() {
var interval = setInterval(function() {
var latestChip = document.querySelector('yt-chip-cloud-chip-renderer[aria-selected="false"]');
if (latestChip) {
clearInterval(interval);
clickLatestChip();
}
}, 500);
};
if (document.readyState === 'complete') {
clickLatestChip();
} else {
window.addEventListener('load', clickLatestChipOnLoad);
}
}
})();
after you're done control+s to save
NOTE: the youtube update is still on the way so if you don't see "for you" chip then the update didn't get to you yet, therefor the code won't work but you can desable the second code and leave the first code so it takes you to /videos...
bons extention: (bing chat for all browsers) you an use bing chat on any browser.
the code was modified by chatgpt (i couldn't merge them together!)