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 futurelearn_dl.sh, 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
    futurelearn-dl.py myaccount mypassword data-to-insight 2

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

    futurelearn-dl.py 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:
    https://www.futurelearn.com/courses/data-to-insight/2/todo/3004

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

The repo I created is here:
    https://github.com/mjbright/futurelearn-dl

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 !

Comments

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 "futurelearn-dl.py", 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.
thanks
Mark
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 futurelearn-dl.py ….
try rather
python3 futurelearn-dl.py ….

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:
https://stackoverflow.com/questions/12162629/using-print-the-function-version-in-python2-x

and here references to print for python 2.7 and 3.5:
https://docs.python.org/2.7/reference/simple_stmts.html#the-print-statement
https://docs.python.org/3.5/tutorial/inputoutput.html


Popular Posts