StreamableDownloader

Downloads the current Streamable video when you click the button.

目前为 2023-07-05 提交的版本。查看 最新版本

// ==UserScript==
// @name         StreamableDownloader
// @namespace    http://tampermonkey.net/
// @version      1.2.2
// @description  Downloads the current Streamable video when you click the button.
// @author       PneuTueur
// @match        *://streamable.com/*
// @icon         https://cdn0.iconfinder.com/data/icons/ui-line-pixel-perfect-3/32/user_interface_UI_line_download_unduh_media_ui-512.png
// @grant        none
// @license      MIT
// ==/UserScript==

function handleClick(event) { // called when the button is clicked
    const videoURL = document.getElementById('video-player-tag').getAttribute('src');
    const videoID = window.location.href.split('/')[3];
    if (videoURL.includes('cdn-cf-east.streamable.com')) {
        window.location.href = videoURL; // sends a request to the video hosting link which automatically downloads the video
    }
    else {
        alert('Your download will begin in a few seconds');

        fetch(videoURL).then(response => { return response.blob(); })
        .then(blob => {
            var urlCreator = window.URL || window.webkitURL;
            var videoLink = urlCreator.createObjectURL(blob);
            var tag = document.createElement('a');
            tag.href = videoLink;
            tag.target = '_blank';
            tag.download = videoID + '.mp4';
            document.body.appendChild(tag);
            tag.click();
            document.body.removeChild(tag);
        })
        .catch(err => {
            alert('ERROR : Failed to download the video. Please try again. \n If it still doesn\'t work, you can contact the script author on gf.qytechs.cn with the video URL.');
        });
    }
}

const shareBtn = document.getElementsByClassName('below-video__video-actions__cta js-share-btn')[0]; // locates the button area
const btnHTML = '<button class="below-video__video-actions__cta js-download-btn" style="height:35px;">Download</button>'; // sets the button HTML
shareBtn.insertAdjacentHTML('beforebegin', btnHTML); // adds the button to the overall HTML

document.getElementsByClassName('js-download-btn')[0].addEventListener('click', handleClick); // calls handleClick() when the button is clicked

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址