Video Screenshot

alabileceğin en kaliteli görüntüyü alır.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Video Screenshot
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  alabileceğin en kaliteli görüntüyü alır.
// @author       Mustafa Hakan
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function takeScreenshot() {
        // 1. Sayfadaki video elementini bul
        const video = document.querySelector('video');
        
        if (!video) {
            alert("Sayfada oynatılan bir video bulunamadı!");
            return;
        }

        try {
            // 2. Gizli bir Canvas oluştur (Videonun orijinal boyutlarında)
            const canvas = document.createElement('canvas');
            canvas.width = video.videoWidth;
            canvas.height = video.videoHeight;
            
            // 3. Videonun o anki karesini Canvas'a çiz
            const ctx = canvas.getContext('2d');
            ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
            
            // 4. Canvas'ı PNG verisine dönüştür
            const imageData = canvas.toDataURL('image/png');
            
            // 5. Otomatik indirme bağlantısı oluştur
            const downloadLink = document.createElement('a');
            const timestamp = new Date().toLocaleTimeString().replace(/:/g, '-');
            downloadLink.download = `nm_EkranGoruntusu_${timestamp}.png`;
            downloadLink.href = imageData;
            downloadLink.click();
            
            console.log("Ekran görüntüsü başarıyla alındı.");
        } catch (err) {
            console.error("Hata:", err);
            alert("Güvenlik (CORS) nedeniyle bu sitede ekran görüntüsü alınamıyor.");
        }
    }

    // ARAYÜZE BUTON EKLE (Önceki toolbarına ekliyoruz)
    const screenshotBtn = document.createElement('button');
    screenshotBtn.innerText = '📸 Kareyi Yakala';
    screenshotBtn.className = 'm-btn'; // Daha önce tanımladığın buton stili
    screenshotBtn.onclick = takeScreenshot;

    // Toolbar'ı bul ve butonu ekle
    const toolbar = document.getElementById('toolbar');
    if (toolbar) {
        toolbar.appendChild(screenshotBtn);
    }
})();