Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Ubuntu 11.10 & want to download Stanford Open Classroom videos..basically for offline viewing,

Ex: http://openclassroom.stanford.edu/MainFolder/CoursePage.php?course=WebApplications

thanx in advance

share|improve this question

Use Firefox with Video DownloadHelper addon.

share|improve this answer
  1. Copy the following code in a new document and save it in a new directory as downloader.py.

    #!/usr/bin/env python
    
    import urllib
    from BeautifulSoup import BeautifulSoup
    
    
    COURSE_URL = 'http://openclassroom.stanford.edu/MainFolder/CoursePage.php?course=WebApplications'
    
    def download_video(video_name):
        course_name = COURSE_URL.split('course=')[1]
        request = urllib.urlopen('http://openclassroom.stanford.edu/MainFolder/'\
                                 'courses/{0}/videos/{1}.xml'.format(course_name,
                                                                     video_name))
        response = request.read()
    
        flv_name = response.split('<videoFile>')[1].split('</videoFile>')[0]
        print 'Downloading: %s' % flv_name
        urllib.urlretrieve('http://openclassroom.stanford.edu/MainFolder/courses/'\
                           '{0}/videos/{1}'.format(course_name, flv_name),
                            flv_name)
    
    def main():
        request = urllib.urlopen(COURSE_URL)
        response = request.read()
        soup = BeautifulSoup(response)
    
        results = soup.findAll('div', {'class': 'results-list'})
        for result in results:
            lists = result.findAll('li')
            for li in lists:
                urls = li.findAll('a')
                for url in urls:
                    video_name = str(url).split('video=')[1].split('&')[0]
                    download_video(video_name)
    
    if __name__ == '__main__':
        main()
    
  2. Open a new terminal (press Alt+F2 and enter 'terminal') and make sure you have the python-beautifulsoup package installed by entering:

    sudo apt-get install python-beautifulsoup
    
  3. Navigate to the directory where the downloader.py file is located (using the 'cd' command).

  4. Run the file using the python command:

    python downloader.py
    
  5. Wait until all the video files are downloaded. They should appear in the same directory where the downloader.py file is located.

  6. If you want to download other course, you would have to change the 'COURSE_URL' variable in the downloader.py file with the URL address of the course you want to download.

share|improve this answer
    
I parallelized this to download 10 videos at a time, and changed it to ask for a directory to save in and to ask for the course url. See here: github.com/mdenton8/Openclassroom-Downloader – mdenton8 Mar 26 '15 at 21:26
    
I wrote another one and now see your post. Mine works on python 3.5 and is very simple and similar to yours github.com/AlmogCohen/open_classroom_downloader – Almog Cohen Feb 5 at 17:22

I just wrote my own simple downloader based on python 3.5 and the simple requests library. No magic there. Check it out

just run python downloader.py, select your course and enjoy the parallel download :)

The script will first fetch the full course list and will let you choose. Then after you choose it will fetch the course description and will download all of it's videos into a folder named as the course name.

share|improve this answer
    
This answer solves the problem, but it could be improved with a description of what the script does, any dependencies it may have, and example usages. – The Brown One Feb 6 at 18:41
    
Added more description, thanks – Almog Cohen Feb 7 at 19:11
    
Thank you. Added an upvote, great code! :) – The Brown One Feb 7 at 19:30

This works for me:

sudo apt-get install youtube-dl
youtube-dl 'SOMEURL'

e.g.

youtube-dl 'http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=ufldl&video=03.1-NeuralNetworks-Representation&speed=100' 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.