Discord UID Extractor

Extract UIDs from Discord avatars and display them

当前为 2024-11-21 提交的版本,查看 最新版本

// ==UserScript==
// @name         Discord UID Extractor
// @namespace    http://tampermonkey.net/
// @version      1.6
// @description  Extract UIDs from Discord avatars and display them
// @author       Your Name
// @match        https://discord.com/*
// @grant        none
// @license You can modify as long as you credit me
// ==/UserScript==
 
(function() {
    'use strict';
 
    // Create a container for the UID list
    const container = document.createElement('div');
    container.style.position = 'fixed';
    container.style.top = '10px';
    container.style.left = '10px';
    container.style.backgroundColor = '#2f3136';
    container.style.color = '#ffffff';
    container.style.padding = '10px';
    container.style.borderRadius = '5px';
    container.style.zIndex = '1000';
    container.style.width = '300px'; 
    container.style.maxHeight = '400px'; 
    container.style.overflowY = 'scroll'; 
    document.body.appendChild(container);
 
    // Create a title for the container
    const title = document.createElement('h2');
    title.textContent = 'Extracted UIDs';
    title.style.margin = '0 0 10px 0';
    title.style.fontSize = '16px';
    container.appendChild(title);
 
    // Create a list to display the UIDs
    const uidList = document.createElement('ul');
    uidList.style.listStyleType = 'none';
    uidList.style.padding = '0';
    container.appendChild(uidList);
 
    // Create a button to start UID extraction
    const startButton = document.createElement('button');
    startButton.textContent = 'Start Extraction';
    startButton.style.marginTop = '10px';
    startButton.style.padding = '5px 10px';
    startButton.style.backgroundColor = '#7289da';
    startButton.style.color = '#ffffff';
    startButton.style.border = 'none';
    startButton.style.borderRadius = '3px';
    startButton.style.cursor = 'pointer';
    container.appendChild(startButton);
 
    // Create a button to copy the UIDs
    const copyButton = document.createElement('button');
    copyButton.textContent = 'Copy UIDs';
    copyButton.style.marginTop = '10px';
    copyButton.style.padding = '5px 10px';
    copyButton.style.backgroundColor = '#7289da';
    copyButton.style.color = '#ffffff';
    copyButton.style.border = 'none';
    copyButton.style.borderRadius = '3px';
    copyButton.style.cursor = 'pointer';
    container.appendChild(copyButton);
 
    // Function to extract UIDs from avatar URLs
    function extractUIDs() {
        const avatarElements = document.querySelectorAll('img[src*="cdn.discordapp.com/avatars/"]');
        const uids = new Set();
        avatarElements.forEach(img => {
            const url = img.src;
            const match = url.match(/avatars\/(\d+)\//);
            if (match) {
                uids.add(match[1]);
            }
        });
        return Array.from(uids);
    }
 
    // Function to update the UID list
    function updateUIDList() {
        const uids = extractUIDs();
        uids.forEach(uid => {
            if (!Array.from(uidList.children).some(li => li.textContent === uid)) {
                const listItem = document.createElement('li');
                listItem.textContent = uid;
                uidList.appendChild(listItem);
            }
        });
    }
 
    // Function to copy UIDs to clipboard
    function copyUIDsToClipboard() {
        const uids = Array.from(uidList.children).map(li => li.textContent).join('\n');
        navigator.clipboard.writeText(uids).then(() => {
            alert('UIDs copied to clipboard!');
        }).catch(err => {
            console.error('Failed to copy UIDs: ', err);
        });
    }
 
    // Add event listener to the start button
    startButton.addEventListener('click', () => {
        updateUIDList();
        const observer = new MutationObserver(() => {
            setTimeout(updateUIDList, 1000); 
        });
        observer.observe(document.body, { childList: true, subtree: true });
    });
 
    // Add event listener to the copy button
    copyButton.addEventListener('click', copyUIDsToClipboard);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址