From 0b14e0b367f1ee280fc97e853922758b07d2c742 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Thu, 8 Dec 2011 20:36:00 +0100 Subject: [PATCH] OpenClassRoom IE (Closes: #234) --- youtube_dl/__init__.py | 102 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 78 insertions(+), 24 deletions(-) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 96e2f0f..fe0fe98 100755 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -282,6 +282,14 @@ def _simplify_title(title): expr = re.compile(ur'[^\w\d_\-]+', flags=re.UNICODE) return expr.sub(u'_', title).strip(u'_') +def _orderedSet(iterable): + """ Remove all duplicates from the input iterable """ + res = [] + for el in iterable: + if el not in res: + res.append(el) + return res + class DownloadError(Exception): """Download Error exception. @@ -711,25 +719,6 @@ 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.""" @@ -3766,9 +3755,13 @@ class MixcloudIE(InfoExtractor): 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