[lynda:course] Force log out (Closes #7361)
authorSergey M․ <dstftw@gmail.com>
Fri, 6 Nov 2015 17:06:13 +0000 (23:06 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 6 Nov 2015 17:06:13 +0000 (23:06 +0600)
youtube_dl/extractor/lynda.py

index 5c973e75ccf630c71b50dcc590e93185f3a5c5ea..67f2025de8b0f2aa01108456da9e2443aa03f637 100644 (file)
@@ -82,6 +82,11 @@ class LyndaBaseIE(InfoExtractor):
                         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'
@@ -210,6 +215,8 @@ class LyndaCourseIE(LyndaBaseIE):
             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)