From: Philipp Hagemeister Date: Wed, 30 Nov 2011 09:52:04 +0000 (+0100) Subject: OpenClassRoom videos (#234) X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=dd17922afc3f005129e8c8bad2f4104169a14348;p=youtube-dl OpenClassRoom videos (#234) --- diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 042b85267..96e2f0f89 100755 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -711,6 +711,25 @@ class FileDownloader(object): return u'"' + title + '" title matched reject pattern "' + rejecttitle + '"' return None + def process_dict(self, info_dict): + """ Download and handle the extracted information. + For details on the specification of the various types of content, refer to the _process_* functions. """ + if info_dict['type'] == 'playlist': + self._process_playlist(info_dict) + elif info_dict['type'] == 'legacy-video': + self.process_info(info_dict) + else: + raise ValueError('Invalid item type') + + def _process_playlist(self, info_dict): + assert info_dict['type'] == 'playlist' + assert 'title' in info_dict + assert 'stitle' in info_dict + entries = info_dict['list'] + + for e in entries: + self.process_dict(e) + def process_info(self, info_dict): """Process a single dictionary returned by an InfoExtractor.""" @@ -3744,6 +3763,59 @@ class MixcloudIE(InfoExtractor): except UnavailableVideoError, err: self._downloader.trouble(u'ERROR: unable to download file') +class StanfordOpenClassroomIE(InfoExtractor): + """Information extractor for Stanford's Open ClassRoom""" + + _VALID_URL = r'^(?:https?://)?openclassroom.stanford.edu(?P/|(/MainFolder/(?:HomePage|CoursePage|VideoPage)\.php([?]course=(?P[^&]+)(&video=(?P