projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[chirbit] Fix extraction (Closes #10296)
[youtube-dl]
/
youtube_dl
/
extractor
/
lynda.py
diff --git
a/youtube_dl/extractor/lynda.py
b/youtube_dl/extractor/lynda.py
index c2678652e7b6dd0feaa68945238030a93073c244..a98c4c530ec4d62a18b437d5c17275daec5c3dfb 100644
(file)
--- a/
youtube_dl/extractor/lynda.py
+++ b/
youtube_dl/extractor/lynda.py
@@
-71,6
+71,11
@@
class LyndaBaseIE(InfoExtractor):
signin_page = self._download_webpage(
self._SIGNIN_URL, None, 'Downloading signin page')
signin_page = self._download_webpage(
self._SIGNIN_URL, None, 'Downloading signin page')
+ # Already logged in
+ if any(re.search(p, signin_page) for p in (
+ 'isLoggedIn\s*:\s*true', r'logout\.aspx', r'>Log out<')):
+ return
+
# Step 2: submit email
signin_form = self._search_regex(
r'(?s)(<form[^>]+data-form-name=["\']signin["\'][^>]*>.+?</form>)',
# Step 2: submit email
signin_form = self._search_regex(
r'(?s)(<form[^>]+data-form-name=["\']signin["\'][^>]*>.+?</form>)',
@@
-85,27
+90,17
@@
class LyndaBaseIE(InfoExtractor):
password_form, self._USER_URL, {'email': username, 'password': password},
'Submitting password', signin_url)
password_form, self._USER_URL, {'email': username, 'password': password},
'Submitting password', signin_url)
- def _logout(self):
- username, _ = self._get_login_info()
- if username is None:
- return
-
- 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'
IE_DESC = 'lynda.com videos'
_VALID_URL = r'https?://www\.lynda\.com/(?:[^/]+/[^/]+/\d+|player/embed)/(?P<id>\d+)'
class LyndaIE(LyndaBaseIE):
IE_NAME = 'lynda'
IE_DESC = 'lynda.com videos'
_VALID_URL = r'https?://www\.lynda\.com/(?:[^/]+/[^/]+/\d+|player/embed)/(?P<id>\d+)'
- _NETRC_MACHINE = 'lynda'
_TIMECODE_REGEX = r'\[(?P<timecode>\d+:\d+:\d+[\.,]\d+)\]'
_TESTS = [{
'url': 'http://www.lynda.com/Bootstrap-tutorials/Using-exercise-files/110885/114408-4.html',
_TIMECODE_REGEX = r'\[(?P<timecode>\d+:\d+:\d+[\.,]\d+)\]'
_TESTS = [{
'url': 'http://www.lynda.com/Bootstrap-tutorials/Using-exercise-files/110885/114408-4.html',
- 'md5': 'ecfc6862da89489161fb9cd5f5a6fac1',
+ # md5 is unstable
'info_dict': {
'id': '114408',
'ext': 'mp4',
'info_dict': {
'id': '114408',
'ext': 'mp4',
@@
-217,8
+212,6
@@
class LyndaCourseIE(LyndaBaseIE):
'http://www.lynda.com/ajax/player?courseId=%s&type=course' % course_id,
course_id, 'Downloading course JSON')
'http://www.lynda.com/ajax/player?courseId=%s&type=course' % course_id,
course_id, 'Downloading course JSON')
- self._logout()
-
if course.get('Status') == 'NotFound':
raise ExtractorError(
'Course %s does not exist' % course_id, expected=True)
if course.get('Status') == 'NotFound':
raise ExtractorError(
'Course %s does not exist' % course_id, expected=True)
@@
-251,5
+244,6
@@
class LyndaCourseIE(LyndaBaseIE):
% unaccessible_videos + self._ACCOUNT_CREDENTIALS_HINT)
course_title = course.get('Title')
% unaccessible_videos + self._ACCOUNT_CREDENTIALS_HINT)
course_title = course.get('Title')
+ course_description = course.get('Description')
- return self.playlist_result(entries, course_id, course_title)
+ return self.playlist_result(entries, course_id, course_title
, course_description
)