-
Notifications
You must be signed in to change notification settings - Fork 1
/
DownloadCourses.sh
48 lines (42 loc) · 1.29 KB
/
DownloadCourses.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
####################################### START
echo "Coursera or Edx?"
echo -n "1-Coursera"
echo " 2-Edx"
read choice
echo ""
######################################## Coursera
if [[ choice -eq 1 ]]
then
FILE=$HOME"/.coursesc"
echo -n "Enter your username: "
read username
echo -n "Enter your password: "
read password
coursera-dl -u $username -p $password --list-courses 2> $FILE
length=$(wc -l $FILE | cut -d ' ' -f 1)
sed -n 4p $FILE
for a in `seq 1 $(($length-4))`
do
echo -n "$a - "
sed -n $(($a + 4))"p" $FILE
done
echo ""; echo -n "Enter the number of the course to download: "
read x
name=$(sed -n $(($x + 4))"p" $FILE)
coursera-dl -u $username -p $password -sl "en" --path $HOME"/Downloads/Coursera" --download-quizzes --download-notebooks $name
######################################## Edx
elif [[ choice -eq 2 ]]
then
FILE=$HOME"/.courses"
echo -n "Enter your username: "
read username
echo -n "Enter your password: "
read password
edx-dl -u $username -p $password --list-courses 2> $FILE
tail -n +7 $FILE
echo ""; echo -n "Enter the number of the course to download: "
read x
URL=$(cat $FILE | grep -iw -A1 "$x -" | grep https)
edx-dl -u $username -p $password --output-dir $HOME"/Downloads/Edx" -s $URL
fi
######################################## FINISH