// ==UserScript== // @name TikTok Video Downloader - Ultimate // @namespace none // @version 1.38 // @description Download TikTok Videos Without A Watermark - The Best, Ultimate TikTok Script // @author altaireh // @match *://*.tiktok.com/* // @icon https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRA-YRvXcW4n9Uv8FvTYubFk4uLqV2A4J___55paaZmd3y1TT8q // @grant none // @downloadURL none // ==/UserScript== (() => { 'use strict'; const ICON_URL = 'https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRA-YRvXcW4n9Uv8FvTYubFk4uLqV2A4J___55paaZmd3y1TT8q'; const createButton = (video) => { const button = document.createElement('img'); button.src = ICON_URL; button.className = 'download-btn'; button.style.cssText = ` position: absolute; left: 10px; top: 50%; transform: translateY(-50%); z-index: 1000; width: 50px; height: 50px; cursor: pointer; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, 0.8); `; button.onclick = (e) => { e.stopPropagation(); const videoUrl = video.src || video.querySelector('source')?.src; if (videoUrl) { const iframe = document.createElement('iframe'); iframe.style.display = 'none'; iframe.src = videoUrl; document.body.appendChild(iframe); setTimeout(() => document.body.removeChild(iframe), 1500); } else { console.error('Video URL Not Found'); } }; return button; }; const addButton = (video) => { if (!video.nextElementSibling?.classList.contains('download-btn')) { video.parentNode.insertBefore(createButton(video), video.nextSibling); } }; const isPreviewPage = () => /v16-webapp-prime.tiktok.com|mime_type=video_mp4/.test(location.href); const initialize = () => { if (isPreviewPage()) { const video = document.querySelector('video'); if (video) { const link = document.createElement('a'); link.href = video.src || video.querySelector('source')?.src; link.download = ''; document.body.appendChild(link); link.click(); link.remove(); } } else { const observer = new MutationObserver(() => { document.querySelectorAll('video').forEach(addButton); }); observer.observe(document.body, { childList: true, subtree: true }); document.querySelectorAll('video').forEach(addButton); } }; initialize(); })();