// ==UserScript== // @name KamTape Downloader // @namespace kamtape // @version 6.0 // @match https://www.kamtape.com/watch?v=* // @grant none // @run-at document-end // ==/UserScript== (function() { 'use strict'; function insertButton() { const videoId = new URLSearchParams(window.location.search).get("v"); if (!videoId) return; if (document.getElementById("kamtape-download-row")) return; const firstActionsDiv = document.querySelector("#actionsAndStatsDiv .actionsDiv"); if (!firstActionsDiv) return; const actionRow = document.createElement("div"); actionRow.className = "actionRow"; actionRow.id = "kamtape-download-row"; actionRow.style.marginTop = "10px"; const button = document.createElement("button"); button.type = "button"; button.textContent = "Download Video"; button.addEventListener("click", function() { const h1 = document.querySelector("h1"); let filename = h1 ? h1.textContent.trim() : "video"; filename = filename.replace(/[\/\\?%*:|"<>]/g, "_") + ".webm"; const link = document.createElement("a"); link.href = "https://www.kamtape.com/get_video.php?video_id=" + videoId + "&webm=1"; link.download = filename; document.body.appendChild(link); link.click(); document.body.removeChild(link); }); actionRow.appendChild(button); firstActionsDiv.appendChild(actionRow); } insertButton(); setTimeout(insertButton, 500); })();