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 = {
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')
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')
'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
'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)