Greasy Fork

Greasy Fork is available in English.

Lihuelworks's Tiktok - Get list of tiktok links (Updated!)

Adds a button to TikTok to get a list of all tiktok video links (e.g from a tiktok profile) to use in yt-dlp (Scroll an list link download code is by Dinoosauro https://github.com/Dinoosauro/tiktok-to-ytdlp)

当前为 2025-03-13 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Lihuelworks's Tiktok - Get list of tiktok links (Updated!)
// @namespace    Violentmonkey Scripts
// @version      0.2
// @license CC-BY-NC-SA-4.0
// @run-at document-end
// @icon https://www.tiktok.com/favicon.ico
// @homepageURL https://github.com/lihuelworks/tiktok-to-ytdlp-userscript
// @description  Adds a button to TikTok to get a list of all tiktok video links (e.g from a tiktok profile) to use in yt-dlp (Scroll an list link download code is by Dinoosauro https://github.com/Dinoosauro/tiktok-to-ytdlp)
// @author       Lihuelworks (with code from Dinoosauro's https://github.com/Dinoosauro/tiktok-to-ytdlp)
// @match        https://www.tiktok.com/*
// @grant        GM_addStyle
// ==/UserScript==

(function () {
    'use strict';

    // Add custom styles including reset and Material Design
    GM_addStyle(`
        #lihuelworks-tiktok-links-download-button {
            border: none;
            margin: 0;
            padding: 0;
            width: auto;
            overflow: visible;
            background: transparent;
            color: inherit;
            font: inherit;
            line-height: normal;
            -webkit-font-smoothing: inherit;
            -moz-osx-font-smoothing: inherit;
            -webkit-appearance: none;
        }

        #lihuelworks-tiktok-links-download-button::-moz-focus-inner {
            border: 0;
            padding: 0;
        }

        /* Material Design styles */
        #lihuelworks-tiktok-links-download-button {
            padding: 12px 24px;
            background-color: #6200ea;
            color: white;
            font-size: 14px;
            font-weight: 500;
            border-radius: 4px;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
            cursor: pointer;
            transition: background-color 0.3s ease, transform 0.3s ease;
        }

        #lihuelworks-tiktok-links-download-button:hover {
            background-color: #3700b3;
            transform: scale(1.05);
        }

        #lihuelworks-tiktok-links-download-button:focus {
            outline: none;
            box-shadow: 0 0 0 2px rgba(98, 0, 234, 0.5);
        }

        #lihuelworks-tiktok-links-download-button:active {
            background-color: #03dac6;
        }
    `);

    // Function to create and append the download button
    function addDownloadButton() {
        // Create a button element
        let downloadButton = document.createElement('button');
        downloadButton.textContent = 'Get list of TikTok links';
        downloadButton.style.order = '-1';
        downloadButton.style.zIndex = '9999999';
        downloadButton.id = 'lihuelworks-tiktok-links-download-button';

        // Get the first element with a class that contains "DivSearchWrapper"
        let searchWrapper = document.querySelectorAll('[class*="DivSearchWrapper"]')[0];

        if (searchWrapper) {
            // Insert the button above the first element with class containing DivSearchWrapper
            searchWrapper.parentElement.insertBefore(downloadButton, searchWrapper);
            console.log("Button added!");
        } else {
            console.log("DivSearchWrapper not found!");
        }

        // Add click event listener to the button
        downloadButton.addEventListener('click', function () {
            // Call the function to start downloading TikTok videos
            tiktoktoytdlp();
        });
    }

    // Function to start downloading TikTok videos
    function tiktoktoytdlp() {
        // Script logic continues...
    }

    // Wait for the page to load and then add the button
    window.addEventListener('load', addDownloadButton);
})();