Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,20 @@ Only support single thread to download right now.
Run as: 'python coursera_downloader.py' will download to CWD.
Run as: 'python coursera_downloader.py <dir>' will download to path <dir>.

For download contents selection input, already handled common intuition from the beginning.
Valid input: 3, 5, 7-18 or 3,5,7-18 or 3 5 7-18 or multiple space or comma seperated.
Range input supports 7-18 or 7:18.
This fork downloads all resources for a given course.
In addition, it appends the sections and subsections to the course resource:
Downloading 01.1-intro - Course Overview (11 min).mp4
Downloading 01.1-intro - Course Overview (11 min).srt
Downloading 01.1-intro - Course Overview (11 min).txt
Downloading 01.2-intro - What is cryptography - (15 min).mp4
Downloading 01.2-intro - What is cryptography - (15 min).srt
Downloading 01.2-intro - What is cryptography - (15 min).txt
Downloading 01.3-intro - History of cryptography (19 min).mp4
Downloading 01.3-intro - History of cryptography (19 min).srt
Downloading 01.3-intro - History of cryptography (19 min).txt
Downloading 01.4-intro - Discrete probability (16 min).mp4
Downloading 01.4-intro - Discrete probability (16 min).srt
Downloading 01.4-intro - Discrete probability (16 min).txt

Version 1.1 Update:

Expand Down
38 changes: 23 additions & 15 deletions coursera_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,31 @@ def resolve_resources(br, path, course):

def downloader(video, srt, txt, pdf, pptx, br, path):
# Only single download thread supported right now.
print
print 'Videos can be downloaded:'
v = choose_download(video)
print 'srt subtitles can be downloaded:'
s = choose_download(srt)
print 'txt subtitles can be downloaded:'
t = choose_download(txt)
print 'PDF slides can be downloaded:'
f = choose_download(pdf)
print 'PPT slides can be downloaded:'
x = choose_download(pptx)

v = video
s = srt
t = txt
f = pdf
x = pptx

# Combine all to be downloaded together for multiple downloading threads later
all = v + s + t + f + x
for r in all:
filename = os.path.join(path, r[0])
print 'Downloading', r[0]
sub = v
for i,r in enumerate(sub):
comp = x[i][0].replace("-annotated.pptx", " - ").replace(".pptx", " - ")
v_filename = os.path.join(path, comp + r[0])
s_filename = os.path.join(path, comp + s[i][0])
t_filename = os.path.join(path, comp + t[i][0])
print 'Downloading', comp + r[0]
print 'Downloading', comp + s[i][0]
print 'Downloading', comp + t[i][0]
br.retrieve(r[1], v_filename)
br.retrieve(r[1], s_filename)
br.retrieve(r[1], t_filename)

nosub = f + x
for r in nosub:
filename = os.path.join(path, comp + r[0])
print 'Downloading', comp + r[0]
br.retrieve(r[1], filename)

def choose_course(course):
Expand Down