Skip to content

Instantly share code, notes, and snippets.

@DesBlock
Created July 1, 2025 15:16
Show Gist options
  • Select an option

  • Save DesBlock/ea9573b5d1ac6207b7bce525b5412c01 to your computer and use it in GitHub Desktop.

Select an option

Save DesBlock/ea9573b5d1ac6207b7bce525b5412c01 to your computer and use it in GitHub Desktop.
Panopto Download
javascript: !function(){"use strict";if(function(e){if("undefined"!=typeof GM_addStyle)GM_addStyle(e);else{const t=document.createElement("style");t.innerText=e,document.head.appendChild(t)}}("#Panopto-Video-DL{position:fixed;top:10%;left:50%;width:70%;padding:2em%203em%201em;background-color:#2d3436;transform:translateX(-50%);z-index:1050}#Panopto-Video-DL%20*{margin-bottom:10px;color:#fff!important;font-size:18px;}#Panopto-Video-DL%20>%20div%20{margin-top:%201em;}#Panopto-Video-DL%20ul,#Panopto-Video-DL%20ol,#Panopto-Video-DL%20li{margin:0%20.5em;padding:0%20.5em;list-style:decimal}#Panopto-Video-DL%20button{margin-left:5px;margin-right:5px;color:#000!important;font-size:16px;}#Panopto-Video-DL%20p{margin-top:0.5em;}#Panopto-Video-DL%20input{color:black!important;}#Panopto-Video-DL%20textarea{width:100%;color:black!important;resize:vertical;white-space:nowrap;}"),location.pathname.includes("/List.aspx")){n("Service%20started");const%20e=document.createElement("button");e.className="css-t83cx2%20css-tr3oo4%20css-coghg4",e.role="button",e.style.marginLeft="0.5rem",e.innerHTML='<span%20class="material-icons%20css-6xugel"%20style="font-size:%2018px;margin-bottom:-0.25rem;">file_download</span>Download',e.addEventListener("click",(e=>{let%20o;e.preventDefault(),e.stopPropagation();const%20a=(o=document.querySelectorAll("#listViewContainer%20tbody%20>%20tr%20a.detail-title")).length||(o=document.querySelectorAll("#detailsTable%20tbody%20>%20tr%20a.detail-title")).length||(o=document.querySelectorAll("#thumbnailGrid%20>%20li%20a.detail-title")).length?o:null;if(!a)return%20void%20n("No%20videos%20found","error");const%20i=[...a].map((e=>{new%20URL(e.getAttribute("href")).searchParams.get("id");e.textContent.trim()}));Promise.allSettled(i).then((e=>{let%20o="";e.forEach((e=>{if("fulfilled"==e.status&&e.value){const%20t=e.value?.[0];t&&(o+=t+"\n")}})),""!==o&&t(o)}))})),document.querySelector("#actionHeader%20button")?.parentElement.appendChild(e)}else%20if(location.pathname.includes("/Viewer.aspx")){n("Service%20started");const%20t=document.createElement("a");t.href="#",t.innerHTML='<span%20class="material-icons"%20style="font-size:15px;margin-bottom:-0.25rem;">file_download</span>%20Download',t.classList="event-tab-header",t.style="display:inline-flex;align-items:center;position:absolute;bottom:30px;padding:5px%2010px;text-decoration:none;cursor:pointer;",t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e()})),document.querySelector("#eventTabControl").appendChild(t),"undefined"!=typeof%20GM_registerMenuCommand&&GM_registerMenuCommand("Download",(()=>e()))}else%20if(location.pathname.includes("/Embed.aspx")){const%20t=document.createElement("div");t.role="button",t.title="Download",t.classList="button-control%20material-icons",t.innerHTML='<span%20class="material-icons">file_download</span>',t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e()}));const%20o=()=>setTimeout((()=>{const%20e=document.querySelector("#navigationControls");if(!e)return%20o();e.appendChild(t)}),1e3);o(),"undefined"!=typeof%20GM_registerMenuCommand&&GM_registerMenuCommand("Download",(()=>e()))}function%20e(){(function(e){return%20fetch(location.origin+"/Panopto/Pages/Viewer/DeliveryInfo.aspx",{method:"POST",headers:{Accept:"application/json,%20text/javascript,%20*/*;%20q=0.01","Content-Type":"application/x-www-form-urlencoded;%20charset=UTF-8"},body:"deliveryId="+e+"&isEmbed=true&responseType=json"}).then((e=>e.json())).then((e=>{const%20t=e.ErrorCode;if(t)throw%20new%20Error(e.ErrorMessage??"",{code:t??-1});const%20o=e.Delivery?.PodcastStreams[0]?.StreamUrl,n=(e.Delivery?.Streams||[]).filter((e=>e.StreamUrl!=o));if(!o)throw%20new%20Error("Stream%20URL%20not%20ready%20yet");return[o,n]})).catch((e=>{throw%20n(e),e}))})(new%20URL(location.href).searchParams.get("id")).then((e=>{const%20n=e[0],a=e[1];if(n.endsWith("master.m3u8")||n.match(/\.panobf\d+/)?("true"!=localStorage.getItem("popup-viewed")&&o('<h1%20style="text-align:center;font-size:30px;">READ%20ME</h1>%20<p>To%20download%20the%20video%20follow%20these%20steps:</p>%20<ol><li>Download%20this%20program%20from%20<a%20href="https://github.com/Panopto-Video-DL/Panopto-Video-DL"%20target="_blank">GitHub</a>%20(No%20installation%20needed)%20and%20open%20it</li>%20<li>Paste%20the%20automatically%20copied%20link</li>%20<li>Set%20the%20destination%20folder</li>%20<li>Wait%20for%20the%20download%20to%20finish</li>%20</ol>%20<p%20style="text-align:center;">%20<button%20onclick="this.parentElement.parentElement.remove();">Close</button>%20<button%20onclick="localStorage.setItem(\'popup-viewed\',%20true);this.parentElement.parentElement.remove();">Close%20and%20don\'t%20show%20again</button>%20</p>'),t(n)):"undefined"!=typeof%20GM_openInTab?GM_openInTab(n,!1):window.open(n),a.length&&"true"!=localStorage.getItem("other-source-viewed")){const%20e=o('<h2%20style="font-size:20px;">Download%20another%20source%20video</h2><ul></ul><p%20style="text-align:center;"><button%20onclick="this.parentElement.parentElement.remove();">Close</button><button%20onclick="localStorage.setItem(\'other-source-viewed\',%20true);this.parentElement.parentElement.remove();">Close%20and%20don\'t%20show%20again</button></p>');a.forEach(((o,n)=>{const%20a=document.createElement("li");a.innerHTML=(o.Name?.replace(/-?(\d{8}T\d+Z)+((.)?(\w+))?/g,"").replace(/_/g,"%20")||"Stream%20"+(n+1))+"<button>Copy</button>",a.querySelector("button").addEventListener("click",(e=>{t(o.StreamUrl)})),e.querySelector("ul").appendChild(a)}))}}))}function%20t(e){"undefined"!=typeof%20GM_setClipboard?GM_setClipboard(e,"text"):navigator.clipboard.writeText(e).then((()=>{})).catch((t=>{n(t);o('<h3>There%20was%20an%20error%20when%20copying%20the%20download%20link</h3>%20<p>Copy%20it%20manually:</p><textarea%20type="text"%20value=""%20rows="3"%20onclick="this.select();"></textarea><p%20style="text-align:center;"><button%20onclick="this.parentElement.parentElement.remove();">Close</button></p>').querySelector("textarea").value=e}))}function%20o(e){const%20t=document.createElement("div");if(t.innerHTML=e,document.querySelector("#Panopto-Video-DL")){const%20e=document.createElement("hr");t.prepend(e),document.querySelector("#Panopto-Video-DL").append(t)}else%20t.id="Panopto-Video-DL",document.querySelector("body").appendChild(t);return%20t}function%20n(e,t="log"){console[t]("%c%20Panopto-Video-DL%20->","color:red;font-size:14px;",e)}}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment