Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aluxian/5344aa0ee5fa0d8a154add902eaff8ba to your computer and use it in GitHub Desktop.
Save aluxian/5344aa0ee5fa0d8a154add902eaff8ba to your computer and use it in GitHub Desktop.
Turn off/disable YouTube autoplay feature
// ==UserScript==
// @name Disable YouTube Autoplay
// @version 1.0
// @match *://www.youtube.com/*
// @run-at document-start
// @grant none
// ==/UserScript==
(function () {
"use strict";
function disable() {
let a = document.querySelector(
"button.ytp-button[data-tooltip-target-id='ytp-autonav-toggle-button']"
); // get the button
if (a.getAttribute("aria-label") == "Autoplay is on") {
a.click(); // disable autoplay next if enabled
}
}
setTimeout(disable, 3000);
setTimeout(disable, 9000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment