// ==UserScript== // @name Tiktok Video Downloader // @namespace https://greasyfork.org/en/scripts/431826 // @version 0.2 // @description Download tiktok videos without watermark // @author YAD // @match *://*.tiktok.com/* // @icon https://play-lh.googleusercontent.com/E6F1EUvRbO8iIXdC4ZUZCJLtGJYjrrOq_0DWaPxAXogKoftQMuuinPStuX9xNFDC9AwT // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; function addDownloadButton(video) { // Check if the video already has a download button if (video.nextElementSibling && video.nextElementSibling.classList.contains('download-btn')) { return; } // Create the download button const downloadBtn = document.createElement('button'); downloadBtn.textContent = '⬇️'; downloadBtn.className = 'download-btn'; downloadBtn.style.position = 'absolute'; downloadBtn.style.left = '10px'; downloadBtn.style.bottom = '50%'; downloadBtn.style.zIndex = '1000'; downloadBtn.style.padding = '10px'; downloadBtn.style.color = '#fff'; downloadBtn.style.background = '#007bff'; downloadBtn.style.border = 'none'; downloadBtn.style.borderRadius = '50px'; downloadBtn.addEventListener('click', function() { const url = video.src || video.querySelector('source').src; const a = document.createElement('a'); a.href = url; a.download = url.split('/').pop(); document.body.appendChild(a); a.click(); document.body.removeChild(a); }); video.parentNode.insertBefore(downloadBtn, video.nextSibling); } document.querySelectorAll('video').forEach(addDownloadButton); new MutationObserver(() => { document.querySelectorAll('video').forEach(addDownloadButton); }).observe(document.body, { childList: true, subtree: true }); })();