Git Product home page Git Product logo

stream.sfu.ca-media-downloader's Introduction

stream.sfu.ca-media-downloader

Easily download a video (lecture) for offline viewing, from stream.sfu.ca/Media/Play/*

Bookmarklet

javascript:const file=window.location.pathname.split("/")[3];fetch("https://stream.sfu.ca/Media/PlayerService/PlayerService.svc/json/GetPlayerOptions",{credentials:"include",headers:{"User-Agent":window.navigator.userAgent,Accept:"application/json, text/javascript, */*; q=0.01","Accept-Language":"en-US,en;q=0.5","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},referrer:window.location.toString(),body:JSON.stringify({getPlayerOptionsRequest:{ResourceId:file,QueryString:"",UseScreenReader:false,UrlReferrer:""}}),method:"POST",mode:"cors"}).then(response=>response.json()).then(function(data){for(const stream of data["d"]["Presentation"]["Streams"]){for(const url of stream["VideoUrls"]){if(url["MimeType"]!=null&&url["MimeType"].includes("x-mpegurl"))continue;if(url["Location"]!=null){window.open(url["Location"]);return}}}alert("Unable to find video URL.")}).catch(error=>{alert("Unable to find the video URL due to error.")});

Installation

  1. Copy the Bookmarklet
  2. In your browser create a bookmark to the current page. Doen't matter what said page is.
  3. Edit the said bookmark's URL property/attribute, paste in the contents of the bookmarklet. ๐Ÿ“Œ
    • Replacing the original URL. CTRL + d, More.., Pasting in the Bookmarklet
  4. Go to the lecture, click the title to view at the webpage that has the URL stream.sfu.ca/Media/Play/*, rather than canvas.sfu.ca/courses/*/modules/items/*. Note: if there is no title, the should be a button on the bottom right for a pop-up. Looks like a little box with a arrow pointing top-right
  5. Click the Bookmarklet
    • Be sure to allow popups
  6. On the new tab, right-click, save-as, ... ๐Ÿคฏ
  7. [optional] run something akin to for i in *.mp4; do ffmpeg -i "$i" -vcodec libx265 -crf 30 "$i_compressed.mp4"; done to use ffmpeg to compress for long term storage. See the docs for -crf 30. see this site Enjoy ๐Ÿ˜‡

Click here:

Or the pop-out button on the bottom-right corner

You go to the site and click the Bookmarklet

then,right-click, save-as, ...


stream.sfu.ca-media-downloader's People

Contributors

alik604 avatar eth-p avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

eth-p

stream.sfu.ca-media-downloader's Issues

Always alert 'Unable to get the video URL.'

Hello @alik604,

Thanks for this useful script and I used it for many of my classes already. But it doesn't work recently. I don't know if sfu changed the stream security or sth. This script doesn't work for any of my class now.

Let me know if you know how to fix.
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.