expected=True)
raise ExtractorError('Unable to log in')
+ def _logout(self):
+ self._download_webpage(
+ 'http://www.lynda.com/ajax/logout.aspx', None,
+ 'Logging out', 'Unable to log out', fatal=False)
+
class LyndaIE(LyndaBaseIE):
IE_NAME = 'lynda'
prioritized_streams = video_json.get('PrioritizedStreams')
if prioritized_streams:
- formats.extend([
- {
- 'url': video_url,
- 'width': int_or_none(format_id),
- 'format_id': format_id,
- } for format_id, video_url in prioritized_streams['0'].items()
- ])
+ for prioritized_stream_id, prioritized_stream in prioritized_streams.items():
+ formats.extend([
+ {
+ 'url': video_url,
+ 'width': int_or_none(format_id),
+ 'format_id': '%s-%s' % (prioritized_stream_id, format_id),
+ } for format_id, video_url in prioritized_stream.items()
+ ])
self._check_formats(formats, video_id)
self._sort_formats(formats)
course_id, 'Downloading course JSON')
course_json = json.loads(page)
+ self._logout()
+
if 'Status' in course_json and course_json['Status'] == 'NotFound':
raise ExtractorError(
'Course %s does not exist' % course_id, expected=True)