Greasy Fork is available in English.
Replace TikTok's default "Download video" button with a non-watermarked download option
当前为
// ==UserScript==
// @name TikTok Watermarkless Video Downloader
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Replace TikTok's default "Download video" button with a non-watermarked download option
// @author LukysGaming
// @match https://www.tiktok.com/*
// @grant GM_download
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
// Create a MutationObserver to monitor DOM changes
const observer = new MutationObserver(() => {
const downloadButton = document.querySelector('li.css-1l1tdw6-LiItemWrapper.e5bhsb11');
const videoElement = document.querySelector('video');
// Check if both the download button and video element exist
if (downloadButton && videoElement) {
const sourceURL = videoElement.querySelector('source')?.src;
if (sourceURL) {
// Override the default click event for the download button
downloadButton.addEventListener('click', (event) => {
event.stopImmediatePropagation();
event.preventDefault();
// Use GM_download to download the video without watermark
GM_download(sourceURL, 'vid.mp4');
}, { once: true }); // Add listener only once
// Change the text of the download button to indicate watermark-free download
const spanElement = downloadButton.querySelector('span');
if (spanElement) {
spanElement.textContent = 'Download video (No Watermark)';
}
}
}
});
// Start observing the DOM for any changes
observer.observe(document.body, {
childList: true,
subtree: true
});
})();