Panopto-Video-DL

Download video from Panopto

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

// ==UserScript==
// @name         Panopto-Video-DL
// @namespace    www.pizidavi.altervista.org
// @description  Download video from Panopto
// @icon         https://www.panopto.com/wp-content/themes/panopto/library/images/favicons/favicon-96x96.png
// @author       pizidavi & Stini
// @version      2.1
// @copyright    2021, PIZIDAVI
// @license      MIT
// @homepageURL  https://github.com/enricobragastini/Panopto-Video-DL
// @match        https://*.panopto.com/Panopto/Pages/Viewer.aspx?*id=*
// @match        https://*.panopto.com/Panopto/Pages/Embed.aspx?*id=*
// @match        https://*.panopto.eu/Panopto/Pages/Viewer.aspx?*id=*
// @match        https://*.panopto.eu/Panopto/Pages/Embed.aspx?*id=*
// @grant        none
// ==/UserScript==

(function(Panopto) {
    'use strict';

    if (location.pathname.includes('Viewer.aspx')) {
        const element = document.createElement('a');
        element.id = 'downloadTabHeader';
        element.classList = 'event-tab-header';
        element.href = location.pathname.replace('Viewer.aspx', 'Embed.aspx') + '?id=' + new URLSearchParams(location.search).get('id');
        element.target = '_blank';
        element.style = 'position:absolute;bottom:40px;padding:5px 10px;cursor:pointer;';
        element.innerHTML = '<b>Download</b> <span class="material-icons" style="font-size:15px;vertical-align:middle;">file_download</span>';
        element.addEventListener('click', e => {
            if (localStorage.getItem('popup-viewed') == 'true') { return; }
            const div = document.createElement('div');
            div.id = 'Panopto-Video-DL';
            div.innerHTML = '<style> #Panopto-Video-DL { position: fixed; top: 10%; left: 10%; width: 80%; padding: 3em 3em 1em; background-color: #2d3436; z-index: 9999999; } #Panopto-Video-DL * { margin-bottom: 10px; color: white !important; font-size: 18px; } #Panopto-Video-DL ol, #Panopto-Video-DL li { margin: 0 .5em; padding: 0 .5em; list-style: decimal; } #Panopto-Video-DL button { margin-top: 1em; margin-right: 10px; color: black !important; } </style> <h1 style="text-align:center;font-size:24px;">Warning!</h1> <h4 style="text-align:center;">Panopto has blocked the previous download method!</h4> <p>To download video follow these steps:</p> <ol> <li>Download this Python program: <a href="https://github.com/enricobragastini/Panopto-Video-DL/releases" target="_blank">Download</a></li> <li>Click on "Download" button in the bottom-left corner</li> <li>Wait until the page opened is automatically closed</li> <li>Open the program and paste automatically copied link</li> <li>Wait until the download finishes</li> <li>The video will be found in the same folder of the program</li> </ol> <p style="text-align:center;"><button onclick="this.parentElement.parentElement.remove();" disabled>Close</button><button onclick="localStorage.setItem(\'popup-viewed\', true);this.parentElement.parentElement.remove();" disabled>Close and don\'t show again</button></p>';
            document.querySelector('body').appendChild(div);
            setTimeout(() => {
                div.querySelectorAll('button').forEach(button => {
                    button.disabled = false;
                });
            }, 5*1000);
        });
        document.querySelector('#eventTabControl').appendChild(element);
    }
    else if (location.pathname.includes('Embed.aspx')) {
        const master_url = Panopto.Embed.instance.videoUrl;
        copy_in_clipboard(master_url);
        window.close();
    }

    // Function
    function copy_in_clipboard(text) {
        const input = document.querySelector('input');
        input.type = 'text';
        input.value = text;
        input.select();
        input.setSelectionRange(0, 99999);
        document.execCommand('copy');
        input.remove();
    }

})(Panopto);

QingJ © 2025

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