// ==UserScript==
// @name YouTube Play All
// @description Adds the Play-All-Button to the videos section of a YouTube-Channel
// @version 2024-03-25
// @author Robert Wesner (https://robert.wesner.io)
// @license MIT
// @namespace http://robert.wesner.io/
// @match https://*.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
document.head.insertAdjacentHTML('beforeend', ``);
setInterval(() => {
if (!window.location.pathname.endsWith('/videos') || document.querySelector('.play-all-button')) {
return;
}
fetch('.')
.then(_ => _.text())
.then(html => {
const i = html.indexOf(' div');
latestVideo = document.querySelector('ytm-compact-video-renderer a').attributes.href.value;
}
// list=UU adds shorts into the playlist, list=UULF only has actual videos
parent.insertAdjacentHTML(
'beforeend',
`Play All`,
);
});
}, 1000);
})();