Link Extractor

Display and export all links found on the current webpage.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

Advertisement:

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

Advertisement:

// ==UserScript==
// @name         Link Extractor
// @name:ru      Извлечение ссылок
// @name:pl      Ekstraktor linków
// @name:tr      Bağlantı Çıkarıcı
// @namespace    https://greasyfork.org/users/your-id
// @version      1.0
// @description         Display and export all links found on the current webpage.
// @description:ru      Показывает и экспортирует все ссылки, найденные на текущей веб-странице.
// @description:pl      Wyświetla i eksportuje wszystkie linki znalezione na bieżącej stronie.
// @description:tr      Geçerli web sayfasında bulunan tüm bağlantıları görüntüler ve dışa aktarır.
// @author       Alex
// @match        *://*/*
// @grant        GM_setClipboard
// ==/UserScript==

(function() {
    'use strict';

    const btn = document.createElement('button');
    btn.textContent = '🔗 Показать ссылки';

    Object.assign(btn.style, {
        position: 'fixed',
        top: '10px',
        right: '10px',
        zIndex: '999999',
        padding: '8px 12px',
        background: '#222',
        color: '#fff',
        border: '1px solid #777',
        borderRadius: '6px',
        cursor: 'pointer'
    });

    btn.onclick = () => {
        const links = [...document.querySelectorAll('a')]
            .map(a => ({
                text: a.textContent.trim(),
                href: a.href || a.getAttribute('href') || ''
            }))
            .filter(x => x.href || x.text)
            .map(x => x.href || x.text);

        const list = links.join('\n');

        const w = window.open('', '_blank');
        w.document.body.innerHTML = `
<textarea style="width:100%;height:90vh;font-family:monospace;font-size:14px;">${list}</textarea>
<button onclick="navigator.clipboard.writeText(document.querySelector('textarea').value)">📋 Copy</button>
<p>Найдено: ${links.length}</p>
        `;
    };

    document.body.appendChild(btn);
})();