Created
May 26, 2014 03:20
-
-
Save sarathsp06/976a1bf6f10a8d7112fe to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python | |
import re | |
import urllib2 | |
from os import system | |
from sys import argv | |
if len(argv) != 2: | |
print "The format is incorrect" | |
exit(0) | |
lecture=argv[1] | |
coursename=re.match(r'https://class.coursera.org/([a-z]+-[0-9]+)/lecture',lecture) | |
if coursename is None: | |
print 'Check the course url %s' %lecture | |
exit(0) | |
coursename=coursename.group(1) | |
content=urllib2.urlopen(lecture).read() | |
sub=re.compile(r'https://class\.coursera\.org/%s/lecture/subtitles\?q=[0-9]+_en\&format=srt' % (coursename)) | |
vid=re.compile(r'https://class\.coursera\.org/%s/lecture/download\.mp4\?lecture_id=[0-9]+' % (coursename)) | |
print content | |
print sub.pattern | |
print coursename | |
for i in sub.findall(content): | |
print 'Downloading %s' %i | |
system('wget '+i) | |
for i in vid.findall(content): | |
print 'Downloading %s' %i | |
system('wget '+i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Program to download all the videos from coursera with address to the course as input
usage:
get_course_vids.py
Eg:
./get_vids_generic.py https://class.coursera.org/android-001/lecture
Requirements:
wget and python 2.7 should be installed