// ==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.2 // @copyright 2021, PIZIDAVI & Stini // @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 GM_setClipboard // @downloadURL 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;text-decoration:none;cursor:pointer;'; element.innerHTML = 'Download file_download'; element.addEventListener('click', e => { if (localStorage.getItem('popup-viewed') == 'true') { return; } const div = document.createElement('div'); div.id = 'Panopto-Video-DL'; div.innerHTML = '

READ ME!

Panopto has blocked the previous download method!

To download the video follow these steps:

  1. Click on Download button in the bottom-left corner
  2. Wait until the page opened is automatically closed
  3. If you see this box you already done these two steps.
  4. Download this program from GitHub: Download (No installation needed) and open it
  5. Paste the automatically copied link
  6. Wait until the download finishes
  7. The video will be found in the same folder of the program

'; document.querySelector('body').appendChild(div); }); document.querySelector('#eventTabControl').appendChild(element); } else if (location.pathname.includes('Embed.aspx')) { const master = Panopto.Embed.instance.videoUrl; if (typeof GM_setClipboard !== 'undefined') { GM_setClipboard(master, 'text'); window.close(); } else { navigator.clipboard.writeText(master).then(() => { window.close(); }, e => { const div = document.createElement('div'); div.id = 'Panopto-Video-DL'; div.innerHTML = '

There was an error when automatically copying the link

Copy it manually:

'; div.querySelector('input').value = master; div.querySelector('button').onclick = () => { navigator.clipboard.writeText(master).then(() => { window.close(); }, _e => { div.querySelector('button').remove(); alert('Other error O_o. Please copy the link directly from the text field, and then close this window.'); }); }; document.querySelector('body').appendChild(div); }); } } })(Panopto);