-
-
Save deepakjois/e2e75d3eabae3dc71253 to your computer and use it in GitHub Desktop.
FutureLearn Video downloader (with aria2c and resume support)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Usage: | |
# > futurelearn_dl.sh [email protected] password course-name week-id | |
# Where *[email protected]* and *password* - your credentials | |
# ,*course-name* is the name from URL | |
# and *week-id* is the ID from the URL | |
# | |
# E.g. To download all videos from the page: https://www.futurelearn.com/courses/corpus-linguistics/todo/238 | |
# Execute following command: | |
# > futurelearn_dl.sh [email protected] password corpus-linguistics 238 | |
# | |
email=$1 | |
password=$2 | |
course=$3 | |
weekid=$4 | |
HD=/hd | |
# Pulls the login page and strips out the auth token | |
authToken=`curl -s -L -c cookies.txt 'https://www.futurelearn.com/sign-in' | \ | |
ggrep -Po "(?<=authenticity_token\" value=\")([^\"]+)"` | |
function dlvid { | |
vzid=`curl -s -b cookies.txt $1 | ggrep -Po '(?<=video-)[0-9]+'` | |
vzurl=https://view.vzaar.com/${vzid}/download${HD} | |
aria2c -c $vzurl | |
} | |
# Posts all the pre-URI-encoded stuff and appends the URI-encoded auth token | |
curl -X POST -s -L -e 'https://www.futurelearn.com/sign-in' -c cookies.txt -b cookies.txt \ | |
--data-urlencode email=$email \ | |
--data-urlencode password=$password \ | |
--data-urlencode authenticity_token=$authToken 'https://www.futurelearn.com/sign-in' > /dev/null | |
# Download Course page | |
curl -s -L -b cookies.txt https://www.futurelearn.com/courses/${course}/todo/${weekid} | \ | |
ggrep -B8 'headline.*video' | ggrep -o '/courses[^"]*' | \ | |
while read -r line; do | |
url=https://www.futurelearn.com${line} | |
dlvid $url | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how i use this