YouTube ScreenShoter

Screenshots current YT frame in full quality

< 腳本YouTube ScreenShoter的回應

評論:正評 - 腳本一切正常

§
發表於:2022-07-17

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.

§
發表於:2022-07-17

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`})
        })

    };
doctor8296作者
§
發表於:2022-07-17
編輯:2022-07-17

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

發表回覆

登入以回復