Friday, March 9, 2012

Firefox and Chrome Extensions for Downloading Lectures from Echo360

 By now, we've probably all discovered UWA's new "Echo360" Lecture Capture System is a POS.  By which I mean "Piece of Shit", and not "Public Open Space" / "Point of Sale".  

In particular, most lectures are not available for downloading.  Which is unfortunate, as it means having to watch lecture recordings at 1x speed and putting up with irritating "buffering" screens.
Annoyingly, you still get the buffering screen even when you skip back to parts of the lecture that have already loaded.  Truly the developers of Echo360 are wonderful and competent people.




 Fear not! I've created some browser extensions for Firefox and Chrome to allow the lectures to be downloaded.  The Firefox extension is actually pretty trivial, but getting things running on Chrome is much more fiddly.  I haven't done an enormous amount of testing, but everything seems to work, at least on the two machines I've tried it on.  Hopefully someone else will find this stuff useful too.

For Firefox:
Click on the link below to install the firefox extension:
http://dl.dropbox.com/u/1614464/echo_script/echodownloader.xpi

Restart firefox; that's it!  Now whenever you view a lecture, you'll be presented with a (rather ugly looking) link to download the lecture at the top of the screen.
 Echo Downloader on Firefox 10

I've only tested the extension on firefox 10 (Linux and OSX).  YMMV, but it should run fine on firefox > 2.  If you have NoScript installed, and try using Echo360 "normally", it may warn about a potential "clickjacking" attack.  It's perfectly safe to ignore this warning (ie it's the extension that's "potentially clickjacking" you).

For Chrome:
Downloading the lectures on Chrome is quite a bit more difficult.  The reasons for this are technical; basically, UWA's server sends a non-standard response when you try to download any lectures, and chrome freaks out about it.

I'll go into the details in another post; for now suffice it to say that a good way to get around this issue is to run a proxy server.  This sounds more complicated than it actually is; from the user's perspective all you'll need to do is install and run one additional piece of software on your computer (in addition to a browser extension).  I'll give the instructions on how to get things working first, before I discuss how it works, firewalls, security, etc.

First, click on the link below to install the browser extension:
http://dl.dropbox.com/u/1614464/echo_script/Echo_Downloader_chrome.user.js

Next, download the proxy server:
http://dl.dropbox.com/u/1614464/echo_script/echo_proxy.jar

Before you can download any lectures, you'll need to start the server.  It's written in Java, so hopefully it'll run fine on whatever Operating System you use.  For now, starting the server has to be done from the command line.  This is not really as user friendly as I'd like, and I'll possibly look at packaging things better in future (subject to time/enthusiasm).

Anyway, to start the server, do the following
On Windows:
Select Start->run.  Type "cmd" and press enter.  At the command prompt, execute the following

java.exe -jar "C:\Documents and Settings\username\Downloads\echo_proxy.jar"

Where obviously, you replace C:\Documents etc with the folder where you actually saved the code.

On OSX:
Run the "Terminal" application (you can do this by typing "Terminal" into spotlight).  Run the following command

java -jar Downloads/echo_proxy.jar

Where again, you replace Downloads/etc with the folder where you saved the code. If you want to stop the server, press Command-C.

On Linux:
I assume you know what you're doing.

Hopefully everything will work.  You should now be able to download the lectures - just click the link at the top of the screen (see below).

Echo Downloader running on Chromium, with aid of proxy server (note the URL in the status bar).


Further comments on the proxy server

1. Starting the server on login

The server must be running before you can download lectures, but starting the server is a little annoying.  It would be quite easy to set things up so that the server runs whenever you start your computer (so you could just set and forget). I'll  possibly write a howto on doing that in another post (this one's starting to get long and unwieldy).

2. Security
The proxy server will only accept requests from the machine on which it is running (ie no remote requests), and will only download files from the domain prod.lcs.uwa.edu.au.  This is for various security reasons; I'll explain the detail in another post. The point I'm trying to make is that although I hacked these extensions together quite quickly, and some of the code is a bit crap, it should be quite safe to run.

3. Firewalls
The proxy server listens on port 49152 (as this is an unreserved port).  Why not use port 8080 or 80? Because I already have servers running on those ports, and I wrote this stuff for my own benefit.  The proxy will also use port 8080 when it downloads the lecture from UWA's server.  If you have a firewall running, and it complains about traffic on port 49152 or 8080, then there's nothing wrong - you can allow the traffic.

4. Source
If you'd like to download the source code for the proxy server (to modify/check I'm not sniffing your bank account details), you can get it here:
http://dl.dropbox.com/u/1614464/echo_script/echo-proxy_source_0.1.tar.gz
There's really not much to it, it's less than 100 lines of code.  All the hard bits are done by Jetty.

Other browsers/platforms:
I originally developed the Firefox extension using Greasemonkey.  If you already have Greasemonkey installed, you may as well just use this script
http://dl.dropbox.com/u/1614464/echo_script/Echo_Downloader_firefox.user.js
Rather than downloading and installing the extension.

 If for some bizarre reason you still use Internet Explorer, I believe there's software available on the tubes that allows you to run Greasemonkey scripts in IE.  Similar comments apply for Safari.  Opera users (all 10 of you), should be able to run the Greasemonkey scripts out of the box.  Here's the first result I got when googling how to do these things - it appears to be helpful.
http://techie-buzz.com/tips-and-tricks/greasemonkey-alternatives-for-ie-opera-and-safari.html

I have no idea whether everything will work correctly or not; my guess is probably not.  You're welcome to try and get things running, but I have no intention to support browsers other than firefox and chrome.

Finally:
 I may make some improvements, depending on how much time and/or motivation I have.  Feedback is welcome, although it may be ignored.  You're also welcome to modify/redistribute any of the code I've posted.


Any updates will be posted here. I'm currently looking at integrating the download links with the screen in LMS that shows the list of available lectures.  In theory it should be very easy.  Sadly, the Echo360 developers have decided that placing iframes within iframes within iframes and not giving any DOM elements an id is a good idea; this is making the job quite a bit more fiddly.




41 comments:

  1. Only just realised that the proxy server build (ie echo_proxy.jar) I provided doesn't actually run properly (mad a mistake in the build process, code was fine).

    Should be fixed now. All the links above will still work, except that they now point to non-buggy versions of the proxy.

    Detailed explanation of the bug available at http://98percentidle.blogspot.com.au/2012/03/echo-proxy-build-that-actually-works.html

    ReplyDelete
  2. Ugh, UWA updates have broken echo-proxy (stupid login page). Currently working on a fix.

    More info:
    http://98percentidle.blogspot.com.au/2012/03/uwa-changes-its-echo360-configuration.html

    ReplyDelete
  3. thank you so much for this! been sharing the love with my friends & we all appreciate it tremendously!

    ReplyDelete
  4. Will this fix work only for UWA?

    ReplyDelete
  5. does this firefox extension still work? it seems to download a tiny mp4 file (371 bytes) that can't play :(

    ReplyDelete
  6. anyway you can do this for other schools? specifically mine? haha UIC

    ReplyDelete
  7. Thanks Mel, Nhi and Unknown!

    @Nat - hmm, don't know what the issue is there, it still works fine for me. Sorry I can't be more helpful. What units were you trying to download lectures for? Does the extension fail for all the lectures in that unit, or only some?

    @Pgayed2 - If you want to get things working at UIC, then
    1. Download the greasemonkey script at http://dl.dropbox.com/u/1614464/echo_script/Echo_Downloader_firefox.user.js

    2. Open the code in a text editor. On line 5, there's code that looks like
    // @include http://prod.lcs.uwa.edu.au:8080/ess/echo/presentation/*

    3. Change the url so that it matches whatever UIC is using. Don't forget to keep the final "/*"

    4. If you don't have greasemonkey installed, you can turn the greasemonkey script into a firefox extension using this site: https://arantius.com/misc/greasemonkey/script-compiler.php

    Similar comments apply if you wanted to change the chrome extensions - just open the code, and wherever you see urls for UWA, change them to urls for UIC. No other change should be necessary.

    YMMV - UIC may use a different version of Echo than UWA. Let me know if you have problems.

    ReplyDelete
    Replies
    1. Hi Rob,
      I was so so excited when I found your post & potential solution for the awful change my uni has made to Echo360 (from Lectopia, which was great).. however, it doesn't seem to work. I'm using Firefox but it seems to be version 19?! Can't believe it's come that far in the short time since you created the add-on, but I guess it must have..
      Are you still using the add-on or another method that works? I mainly want to be able to speed up the lectures as I watch them but actually downloading a copy would be really useful for revision / watching on my iPod touch etc too..

      Hope you can help!

      Thanks,
      Sass

      Delete
    2. I'm having the same exact issue at Wesleyan University... downloaded an older version of firefox, version 10 (its on 13 right now) and still didn't work. Maybe its because Echo has updated?

      Delete
    3. Hi Sass and Matankg,

      Could you be more specific about what "doesn't work" means? Do you see the download link at the top of the page? Are there any error messages? Do you end up downloading a small file that you can't play? Describe what happens when you try to download a lecture.

      As far as I'm aware, the extension still works, and the version of firefox you use really shouldn't make a difference. The source of the troubles is most likely different configurations of Echo at different universities and for different units. In particular, if you're not at the University of Western Australia, it will be difficult for me to assist you (since I do not know how echo is configured for you, and I can't test the extension against your configuration).

      If you are unable to get the extension working, there is a workaround you can try in firefox: navigate to the lecture you want to download (not the actual video, but the page with the "launch echo" button, where you select the bandwidth, etc). Modify the address in the URL bar by adding "/mediacontent.m4v" and press enter - you may be able to download the lecture this way.

      Best of luck, let me know how you go!

      Delete
  8. Actually, Nat, could you try changing the extension of the small mp4 file to ".htm" and opening the file in a browser? What do you see?

    I'm guessing that it might be a 404 or 403 page.

    ReplyDelete
  9. This is the best.
    My fiances school recently switched from just posting FTP links, to using Echo360 and it is just such an awful platform.
    Now she can view lectures on tablets that aren't made by Apple, and flash doesn't crash the browser on the laptop.
    faster than 1X playback works now too.
    Thanks for the workaround, flash players are the worst!

    ReplyDelete
  10. Good job bro. Too bad it takes some random student with some spare time on his hands to provide functionality to that software rather than the devs themselves..

    ReplyDelete
  11. Hi Rob, I'm from USYD and I tried running your extension on Chrome and Firefox but ran into some problems for both. (By the way, I THINK I managed to correctly modify the url in the script according to my uni and start the proxy server through cmd.)
    In Chrome, the download link appears but after I click on it nothing happens - the page remains the same except my cursor indicates that it's trying to load something (the "busy" circle icon for Windows 7 appears next to it), a Chrome pop-up tells me it's "Waiting for localhost...", but nothing new comes up in the downloads bar at the bottom of Chrome. The page stays like this indefinitely.
    As for Firefox, after the link appears and I click on it, I'm sent to a login page (same one as you described in http://98percentidle.blogspot.com.au/2012/03/uwa-changes-its-echo360-configuration.html). Since I've never had to log in directly to Echo360 to view their videos (I normally log in to Blackboard and just follow the links within each unit), I didn't have any login details to access the videos for downloading. Nevertheless, I tried putting in my Blackboard username and password (it was a long shot) and thought I got lucky when a dialog box popped up allowing me to open/save "media.m4v". This turned out to be a tiny 369-byte file that did strange flashy things when I tried running it in VLC.
    Do you know of any way of getting around that login screen? Or...would anyone be kind enough to give me a legit username and password for Echo360?! =P (Don't even know if that would when my uni [and the associated units] would be different to the login ones...)

    ReplyDelete
  12. Hi Phuong, thanks for the details, sorry you couldn't get things working.

    It sounds like the proxy server isn't receiving your request at all, since it should send some kind of response in all cases. A few possible reasons:

    1)
    When you started the proxy in cmd, did you keep the terminal window open? I didn't bother getting the server to detach from the terminal, so if you close it the server will stop. If you did keep the terminal open, do you see any messages appear when you attempt to download the lectures in chrome?

    2)
    Does your firewall allow connections on port 49152? Perhaps the windows firewall doesn't allow this by default?

    3)
    Does windows resolve localhost into 127.0.0.1? What happens if you copy the download link, paste it into the address bar, and manually change localhost to 127.0.0.1?

    (As you can possibly tell, it's been a while since I used windows, haha)

    As for the login page issue, I can't tell you specifically how to solve it, since UWA has removed theirs (and in any case, there may be significant differences between UWA and USYD's configurations). However, as general advice on how to solve this problem, you would need to modify the proxy server to perform the login (and you would also need to use a proxy with firefox, as well as chrome).

    The modifications needed would be to the "handle" method of the EchoProxy class. You would need to
    1. Make A POST request to the login page url, with the username and password as post data.
    2. Get the session cookie from the returned headers
    3. Send the session cookie to USYD when downloading the media.m4v file

    Best of luck, let me know if you have any success (or not) :)

    ReplyDelete
  13. Hi, I'd really appreciate your help if this could work... I could never stay away in classes nor while watching videos at x1 because I usually do it at x1.5 - x2 ...

    I'm from Monash, I can login but the thing is I don't see a DL link. I tried adding /mediacontent.m4v to the link with the launch echo button, which think should be something like this:

    http://echosystem.lib.monash.edu:8080/ess/echo/presentation/9142f040-11fc-4b19-9055-29cd52f5bec6/mediacontent.m4v

    but I got a 404 error

    Sad thing is other video downloaders don't seem to work either T_T

    I have this problem with being bored quicky and I'd really appreciate your help, thanks a lot

    ReplyDelete
    Replies
    1. Yeah, that url would have worked on UWAs setup, perhaps Monash is using a different version of echo?

      Try changing "mediacontent.m4v" to "media.m4v", that may work. Otherwise, I don't know, sorry.

      Delete
    2. Ah, I see the download button now, by using media.m4v

      However I get an internal server error when I click it and using "save target as" doesn't work, because the "Download media file button" basically leads to /mediacontent.m4v

      =(

      Delete
    3. hmm, that's interesting. You could probably get hold of the audio of the presentation by appending /media.mp3, although that may not be very useful.

      If you have the firebug extension, you can check what media formats are available; start firebug, then browse to the list of lectures, then select Net->XHR, and look for queries to a resource called "details.json". If you then view the json response, you'll see a couple of urls listed as "podcast", "vodcast", "richMedia", stuff like that. Perhaps you'll be able to find one you can download (this is how I originally found mediacontent.m4v). I will write a post about how to do this sometime over the next few weeks.

      If that doesn't work, there is potentially another way to get hold of the lectures (they can also be downloaded from a folder called /echocontent), but it's a bit fiddly, and I haven't figured out all the details of how it works yet. I also strongly suspect that this method might be UWA specific (I only learned about it because I think the IT people misconfigured their webserver). But the basics of it is as follows:
      1. find the host on which /echocontent is stored (it might not be echosystem.lib.monash.edu, UWA has it on a different domain). You do this by looking at the response from details.json, there is a parameter returned called "host"
      2. point your browser to {host}/echocontent. At UWA you get a directory listing, but I think that's just because the server is misconfigured. So this step may fail
      3. The difficult bit is finding what you want, because you can actually access any lecture recorded for any unit. The folders are all organised as /echocontent/#1/#2/uuid/{lecture content and resources}
      where uuid is an id for the lecture (128 bit string as hex, no idea how to predict it)
      #2 is a small number (I suspect it refers to a day of the week)
      #1 is a slightly bigger number (~1000), I have no idea what it means
      Anyway, it should be possible to write some kind of bot to index all the lectures. But this is really a method of last resort.

      Delete
    4. I couldn't find anything using that because the only link that worked was the thumbnails.

      "thumbnails":["http://silvan.lib.monash.edu.au/echocontent/1333/4/0a98f078-752d-410a-9c43-e0ac3b74230b/synopsis/low/02555050.jpg","http://silvan (and so on)

      I guess the null values should explain why I get a 500 error when trying to access media.mp3 and mediacontent.m4v?

      richMedia lead me to to where I'd go to if I were to click around normally.

      "podcast":null,"vodcast":null,"richMedia":"http://echosystem.lib.monash.edu:8080/ess/echo/presentation/0a98f078-752d-410a-9c43-e0ac3b74230b"

      ====================================================

      I found the host of details.json and added /echohost to it as such:

      echosystem.lib.monash.edu:8080/echohost

      But I got a 403 =(

      ----------------------------------------
      HTTP ERROR 403

      Problem accessing /echocontent/. Reason:

      FORBIDDEN
      Powered by Jetty://
      ----------------------------------------

      Delete
    5. btw I used chrome's developer tools because my FF can't access to certain sites (echo360, part of monash and google) and I've been trying to fix it for almost a week by getting from from mozilla support to no avail

      Delete
    6. haha, clearly Monash's admins are more competent than UWA's if you're getting a 403 instead of a directory listing

      The video of the lectures is available in /echocontent/#1/#2/uuid under the filename audio-vga.m4v. Try requesting
      http://silvan.lib.monash.edu.au/echocontent/1333/4/0a98f078-752d-410a-9c43-e0ac3b74230b/audio-vga.m4v

      Delete
    7. It only just occurred to me that I can actually test things myself, now that you've given me the urls.

      So, some good news and some bad news.
      Bad news: requesting audio-vga.m4v doesn't work

      (Somewhat) Good news:
      You can download the video, but you have to download many short files separately, then stitch them together (easy enough), but they don't have audio (I'm working on this). I have just downloaded your lecture on 3 phase transformers, so I can confirm that this works.

      The video urls are of the form /echocontent/#1/#2/uuid/slide/n.swf

      Where the parameters #1, #2, uuid are as discussed previously, and n is a multiple of 15000, formatted as an 8 digit decimal number. The first video segment is 00000000.swf, the next is 00015000.swf, then 00030000.swf, 00045000.swf, etc. Each of the video segments is about a minute long (to give you an idea of how many there are), but you just keep downloading until you get a 404.

      From memory, when you use the flash echo360 player in the browser, the swf files are downloaded over http (hence why you can just download them directly from the /echocontent), and the audio is transmitted separately over rtmp. Possibly you can get the audio using rtmpdump or similar. If you run wireshark or similar while using the flash player, you might be able to work it out. I never worked out all the details, since I had an easier way to download things at UWA.

      I will investigate further when time allows (have too many assignments due atm!), but hopefully one of us can get something working - should be a challenge.

      Best of luck!

      Delete
    8. oops, sorry, that should be
      /echocontent/#1/#2/uuid/slides/n.swf

      *slides plural, not singular as above

      Delete
    9. ok, got it, got, got it, including audio!

      You still need to download many files and join them together, but the audio is there. I've tested this on your three phase transformer lecture, and it works!

      urls have the form
      http://silvan.lib.monash.edu.au:1935/echo/_definst_/#1/#2/uuid/mp4:audio-vga-streamable.m4v/media_1.ts

      for the first 15 or so second segment, then media_2.ts, media_3.ts, etc, until you get a 404. You still need to work out the numbers #1, #2 and uuid as before, but all this could be automated easily enough (by parsing response from request to details.json).

      (for interest, I found this one by changing my user agent to iphone and then digging a bit)

      Delete
  14. I have updated the extsnsions slightly to work with the new UWA echo360 layout:
    http://98percentidle.blogspot.com.au/2013/08/updated-echo360-download-script.html

    ReplyDelete
  15. Hello, I was wondering if you had any idea why I wouldn't be getting the pop-up to download? Here's the link if it helps: https://lecturecapture.mtu.edu/ess/echo/presentation/eb350049-9ec9-4d2d-a13b-2f614234649f

    ReplyDelete
    Replies
    1. Hi,

      You need to make sure that you
      a) Modify the extension to make it specific to your university, as described in the post, and
      b) Modify the most recent version of the extension (which you can download from http://98percentidle.blogspot.com.au/2013/08/updated-echo360-download-script.html, note that the version linked from this post is an old version, and doesn't work on more recent version of Echo360).

      I have modified the extension to work at Michigan Tech. Please download and install either
      Firefox extension: https://dl.dropboxusercontent.com/u/1614464/echo_script/michigan/echodownloader_mtu.xpi
      or Chrome extension: https://dl.dropboxusercontent.com/u/1614464/echo_script/michigan/Echo_Downloader_chrome2_mtu.user.js

      I can confirm that the extension works correctly on firefox. Here is a screen shot of it working: https://dl.dropboxusercontent.com/u/1614464/echo_script/michigan/Screenshot.png

      Delete
  16. I have installed it on Firefox and the link for downloading doesn't pop-up to download either, any idea why? I'm using Firefox 24.0

    ReplyDelete
    Replies
    1. Hi Rosario,

      Please see my reply to the comment above yours. If the link isn't showing, then most likely you need to download the most recent version of the extension (not the old version linked from this post), and modify it to make it work at your university/institution (instructions are provided in some of the previous comments on this post, just scroll up a bit).

      Hope you get it working!

      Delete
  17. This was very helpful. Thanks for the post , mate.

    ReplyDelete
  18. Hi Rob,
    I am trying to follow your previous posts where you said that we should edit the script in line 5 (should line 6 also be edited?) with the appropriate URL from your institution in ECHO 360 platform.
    I am trying to download a bunch of lectures, and the problem is you have to login in Echo360 with your user name and pass. Therefore, my URL has some credentials, for example:
    http://lecturecontent.georgetown.edu/ess/echo/presentation/c4d15467-c52a-4007-8a9b-8fd750222d18?instructor=false&firstname=M*****&lastname=S***&email=*****@georgetown.edu&bbrole=blackboard.data.course.CourseMembership$Role:STUDENT

    Note: The asterisks would represent my username and email@Georgetown Univ.
    So, kindly, do you think there could be any solution? This is the same URL when i take it to Chrome,and am not logged in:
    https://lecturecontent.georgetown.edu:8443/ess/login.jsp

    Thank you,
    Lolzoronold

    ReplyDelete
  19. Hey, don't know if you're still monitoring this but any help would be appreciated!

    I've tried running this on chrome and firefox (I'm at Sydney Uni) and can't get either working.

    With firefox, I changed the url to match the Sydney Uni one. I tried this both through greasemonkey and by opening in a text editor and converting to a firefox add on. Either way, I don't get a download link - instead, echo loads as normal with the error message "[Javascript Application] Error: main is null"

    With Chrome, also altered the url to match the Usyd one which made the download lik appear (yay!). But when I click on it I get a 404 error which says something to the effect that there was no response from the server prod.lcs.uwa.edu.au. Is this because the proxy server code also has to be altered to include the USyd url? Cause if so, I have noooo idea how to do this.

    Sorry to bug you but seriously... you're a champion if you can get this running!

    ReplyDelete
  20. I just wrote an entire post, and when I signed in, I lost it all....

    The main gist of my post:
    I wasn't sure if you are still available on this blog and am still able to help me. I can download some videos fine, however those with downloads disabled, I can only get the .mp3 but not the video file (which is what I want). Any ideas?

    ReplyDelete
  21. Does this download both echo360 screens?

    ReplyDelete
  22. Hey, if anyone is still trying to download from EchoCenter but can't get it with this method, I found a workaround using a different method. It involves tricking your web browser into thinking you're streaming from a mobile device (smartphone) instead of from a computer. The end result is that a video player comes up (instead of the dumb embedded Echo360 Player). You can right-click on the video player and select "Save Video As". Works like a charm. Still need to use firefox though. Here's the link:

    http://baitisj.blogspot.com/2014/08/how-to-download-echo360-videos.html

    ReplyDelete
  23. Great work rob and thanks for sharing.

    For all the University of Sydney people out there I've written a quick guide on how to download recordings by using a web browser (Chrome) to find the necessary links and VLC player to capture and export the stream. Not sure if this method works with other university streaming systems though.

    It's a little involved but works well at the moment.

    Find the guide here: https://github.com/austynguo/echo360-downloader

    ReplyDelete