Video Screenshot

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);
    }
})();