Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

2 Answers

Use Firefox with Video DownloadHelper addon.

share|improve this answer
    
thanks for nice website –  Deepak Rajput Oct 19 '11 at 8:57
add comment
  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
add comment

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.