i am trying to make a userscript to add a download button to youtube, i tried tampermonkey and greasemonkey but they dont work. the script doesnt throw any errors when run manually on console. it adds the button when i copy and paste it into the console.
the userscript:
// ==UserScript==
// @name Youtube Downloader
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Download Youtube Videos With One Click!
// @author qweren
// @match https://www.youtube.com/*
// @icon https://upload.wikimedia.org/wikipedia/commons/thumb/0/09/YouTube_full-color_icon_%282017%29.svg/1024px-YouTube_full-color_icon_%282017%29.svg.png
// ==/UserScript==
(function() {
'use strict';
// Check if the "actions" div exists
var actionsDiv = document.getElementById('actions');
// Create a new button element
var newButton = document.createElement('button');
newButton.textContent = 'Click Me';
// Add an event listener to the button
newButton.addEventListener('click', function() {
alert('Button clicked!');
});
// Append the button to the "actions" div
actionsDiv.appendChild(newButton);
console.log("adding button")
})();
i tried changing the userscript extension from greasemonkey to tampermonkey both dont work. i tried to write an onload for actionsdiv it doesnt work too.