src/youtube/music/warning-proceed.user.js created

This commit is contained in:
Nicholas Phillips 2024-08-03 10:56:36 -04:00
parent 3cab1d9b59
commit 5055253cd3
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,8 @@
// ==UserScript==
// @name music.youtube.com
// @description This skips the warning "The following content may contain suicide or self-harm topics." on music.youtube.com
// @namespace Bowud Scripts
// @match https://music.youtube.com/watch*
// @downloadURL {{FILE_URL}}
// @version {{UNIXDATE}}
// ==/UserScript==

View file

@ -0,0 +1,18 @@
(function () {
let errorScreenEl = document.querySelector("#error-screen");
console.log({ errorScreenEl: errorScreenEl });
let reasonEl = errorScreenEl.querySelector("#reason");
console.log({ reasonEl: reasonEl });
if (
reasonEl.textContent ===
"The following content may contain suicide or self-harm topics."
) {
let buttonEl = errorScreenEl.querySelector(
'button[aria-label="I understand and wish to proceed"]'
);
console.log({ buttonEl: buttonEl });
if (buttonEl) {
buttonEl.click();
}
}
})();