Sunday, October 25, 2015

At last a FutureLearn downloader ...

I try to be less of a freeloader these days but there's still a temptation when you need a tool to just wait for someone else to provide it.

As coursera-dl and edx-dl have existed for a while I just assumed that a futurelearn-dl would be created soon ... real soon ... real soon now ...

But it didn't happen.
I signed up for FutureLearn courses, as you do, and I didn't follow them all as I couldn't carry the videos around with me on my tablet (I have a 45 min commute morning and evening, will also be mainly "offline" in Chile soon).

I would search occasionally for the fabled futurelearn-dl ... with no luck.

Then a year ago there was hope when someone posted a gist of a, see here.
So I tried that, I modified it a bit and I managed to semi-automatically download some videos from an FL course, but it was semi-manual ... no good.

Anyway, yesterday I tried again with my modified bash script but I couldn't get it to work, couldn't get it to login anymore.  But as some people had requested that I post my modified version I decided to swallow my pride and create a repo in the hope that someone else would get it working.

But the shame of that badly coded, unworking bash script was too much so I thought well we'll see how far I get with a Python3 version ...

Surprise, less than 24 hours later I have a less than 600-line Python3 script which does the job ... mostly ...

Basically I do myaccount mypassword data-to-insight 2

to download all available material from run 1 of  the currently running 'data-to-insight' course,
or myaccount mypassword data-to-insight 2 1

to download just week 1.

You can obtain the course id 'data-to-insight' and the course run number '2'  in this case by logging
into the site and navigating to the appropriate course page:

From the URL we can see the course_id and the run number.

The repo I created is here:

Let me know if it's any use, and file issues for any problems (I won't have much time until December I'm afraid).

Time to do my homework ... well, maybe I'll just head outdoors instead ... it's healthier !


Anonymous said...

Thank you! I used it and it works perfectly!

Mark Cunningham said...

Hey Mike. I realize it's 4 years forward :)

...however, would you offer some help, please? I installed this on a Mac inside a virtual environment but it says the following:
#File "", line 247
# print(type + ": ", end='')
#SyntaxError: invalid syntax

Is this a bug or something i messed up? Sorry, i am new at this Python game.

Michael Bright said...

Hi Mark,

Sorry to reply so late ! I just came across this unmoderated comment.

It looks like you're using python2, but this script requires python3.
I guess you're invoking the script as
python ….
try rather
python3 ….

In more detail in python2, print is a keyword, and so takes no arguments (like 'end' here).
In python3 print is defined as a function and has named arguments such as end.

Here is an explanation:

and here references to print for python 2.7 and 3.5:

[Conference -] Developing Micro-services on Kubernetes

In April I had the chance to present at , first in Warsaw on Apr 24th, and then in Wroclaw ("wroslof" was my best at...