Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download a Tegrity video

Tegrity Download

Install

  1. Create a new bookmark
  • In Firefox:
    1. Right click on bookmarks bar
    2. Select "New Bookmark..."
    3. Pick a name such as "Tegrity Downloader" and paste the following code below into the Location box
  • In Chrome:
    1. Right click on bookmarks bar
    2. Select "Add page..."
    3. Replace the default contents with a name such as "Tegrity Downloader" and paste the following code into the URL box
  1. Open up a video you want to download from Tegrity and click the bookmarklet. A new window will open with the video; you can than use Ctrl-S to save it

What to paste:

javascript:(function()%20{%20let%20playerUrl%20=%20document.getElementById('playerContainer').attributes['iframe-src'].value;%20%20let%20videoUrl%20=%20playerUrl.replace('TegrityPlayer.htm',%20'Projector/screen00.mp4');%20videoUrl%20=%20videoUrl.substring(0,%20videoUrl.indexOf('?'));%20%20let%20authTokenStart%20=%20playerUrl.indexOf('AuthToken');%20let%20authTokenEnd%20=%20playerUrl.indexOf('&',%20authTokenStart);%20let%20authToken%20=%20playerUrl.substring(authTokenStart,%20authTokenEnd);%20%20let%20authVideoUrl%20=%20videoUrl%20+%20'?'%20+%20authToken;%20%20console.log('Found%20video%20URL:%20'%20+%20authVideoUrl);%20window.open(authVideoUrl);%20})();
/**
* Copyright 2018 Joseph Stahl <hello@josephstahl.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Tegrity Video Downloader (Bookmarklet) v0.1
// Opens video in new window for easy downloading
let playerUrl = document.getElementById('playerContainer').attributes['iframe-src'].value;
// change from iframe to .mp4 video
let videoUrl = playerUrl.replace('TegrityPlayer.htm', 'Projector/screen00.mp4');
videoUrl = videoUrl.substring(0, videoUrl.indexOf('?')); /** trim everything after question mark */
// extract authentication token
let authTokenStart = playerUrl.indexOf('AuthToken');
let authTokenEnd = playerUrl.indexOf('&', authTokenStart);
let authToken = playerUrl.substring(authTokenStart, authTokenEnd);
// put it all together
let authVideoUrl = videoUrl + '?' + authToken; /** add back the auth token (although I don't believe it's necessary when signed in with browser) */
console.log('Found video URL: ' + authVideoUrl);
window.open(authVideoUrl);
/**
* As a bookmarklet:
* Note: comments must be stripped out
* `
* javascript:(function() { ...code... })();
* `
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment