YouTube ScreenShoter

Screenshots current YT frame in full quality

< Feedback on YouTube ScreenShoter

Review: Good - script works

§
Posted: 17.07.2022

good script, please use GM_download (grant it first) to add an option to download the image instead of pasting it in clipboard. for example have a constant at the top of the script that says const downloadImage = false and if the user changes it to true, it will download the image.

§
Posted: 17.07.2022

this is how i modified the copy function so it would save the image. (Now it only saves, but i'm sure you'll be able to put an if/else for some preference variable to decide between copying and saving)

YouTubeScreenShoter.prototype.onCopyImage = function(blob) {
        // navigator.clipboard.write([new window.ClipboardItem({
        //     "image/png": blob
        // })]);

        //blob to dataURL, 
        //https://stackoverflow.com/questions/23150333/html5-javascript-dataurl-to-blob-blob-to-dataurl#30407959
        function blobToDataURL(blob, callback) {
            var a = new FileReader();
            a.onload = function(e) {callback(e.target.result);}
            a.readAsDataURL(blob);
        }

        this.ss("video").pause()
        console.log("downloading:", blob)
        // download the datauri
        blobToDataURL(blob, (dataURI) => {
          GM_download({url: dataURI, name: `ytf-${new Date().getTime()}.png`})
        })

    };
doctor8296Author
§
Posted: 17.07.2022
Edited: 17.07.2022

Downloading feature is already exist. You can download it if you'll hold ctrl key during the click on the PRTSC button.

Post reply

Sign in to post a reply.