[pluralsight] Use raise_login_required
[youtube-dl] / youtube_dl / extractor / pluralsight.py
index 1bdcacbaa9b342f4229bbfe82aa5f8aa0fde529a..fd32836ccaf61b171f9dcafbbfce24c7764b18c1 100644 (file)
@@ -21,7 +21,6 @@ class PluralsightIE(InfoExtractor):
     IE_NAME = 'pluralsight'
     _VALID_URL = r'https?://(?:www\.)?pluralsight\.com/training/player\?author=(?P<author>[^&]+)&name=(?P<name>[^&]+)(?:&mode=live)?&clip=(?P<clip>\d+)&course=(?P<course>[^&]+)'
     _LOGIN_URL = 'https://www.pluralsight.com/id/'
-    _ACCOUNT_CREDENTIALS_HINT = 'Use --username and --password options to provide lynda.com account credentials.'
     _NETRC_MACHINE = 'pluralsight'
 
     _TEST = {
@@ -42,9 +41,7 @@ class PluralsightIE(InfoExtractor):
     def _login(self):
         (username, password) = self._get_login_info()
         if username is None:
-            raise ExtractorError(
-                'Pluralsight account is required, use --username and --password options to provide account credentials.',
-                expected=True)
+            self.raise_login_required('Pluralsight account is required')
 
         login_page = self._download_webpage(
             self._LOGIN_URL, None, 'Downloading login page')
@@ -184,6 +181,8 @@ class PluralsightCourseIE(InfoExtractor):
     def _real_extract(self, url):
         course_id = self._match_id(url)
 
+        # TODO: PSM cookie
+
         course = self._download_json(
             'http://www.pluralsight.com/data/course/%s' % course_id,
             course_id, 'Downloading course JSON')
@@ -195,14 +194,9 @@ class PluralsightCourseIE(InfoExtractor):
             'http://www.pluralsight.com/data/course/content/%s' % course_id,
             course_id, 'Downloading course data JSON')
 
-        may_not_view = 0
-
         entries = []
         for module in course_data:
             for clip in module.get('clips', []):
-                if clip.get('userMayViewClip') is False:
-                    may_not_view += 1
-                    continue
                 player_parameters = clip.get('playerParameters')
                 if not player_parameters:
                     continue
@@ -210,9 +204,4 @@ class PluralsightCourseIE(InfoExtractor):
                     'http://www.pluralsight.com/training/player?%s' % player_parameters,
                     'Pluralsight'))
 
-        if may_not_view > 0:
-            self._downloader.report_warning(
-                'There are %d videos in this course that are not available for you. '
-                'Upgrade your account to get access to these videos.' % may_not_view)
-
         return self.playlist_result(entries, course_id, title, description)