diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-08-14 22:07:02 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-08-14 22:07:02 +0600 |
commit | 41dbc50f9c7dfaad4084fbeac77192c7ac37daca (patch) | |
tree | 6b964e5bd2910f3b2b909ad16977b3f3e53d3d47 /youtube_dl/extractor/lynda.py | |
parent | 4d2ad866f347086d3a1cf4cb7e0a8cadd3c87748 (diff) |
[lynda] Capture and output login error (Closes #6556)
Diffstat (limited to 'youtube_dl/extractor/lynda.py')
-rw-r--r-- | youtube_dl/extractor/lynda.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/youtube_dl/extractor/lynda.py b/youtube_dl/extractor/lynda.py index deead220a..5b9157ed4 100644 --- a/youtube_dl/extractor/lynda.py +++ b/youtube_dl/extractor/lynda.py @@ -11,6 +11,7 @@ from ..compat import ( ) from ..utils import ( ExtractorError, + clean_html, int_or_none, ) @@ -70,6 +71,15 @@ class LyndaBaseIE(InfoExtractor): 'Confirming log in and log out from another device') if all(not re.search(p, login_page) for p in ('isLoggedIn\s*:\s*true', r'logout\.aspx', r'>Log out<')): + if 'login error' in login_page: + mobj = re.search( + r'(?s)<h1[^>]+class="topmost">(?P<title>[^<]+)</h1>\s*<div>(?P<description>.+?)</div>', + login_page) + if mobj: + raise ExtractorError( + 'lynda returned error: %s - %s' + % (mobj.group('title'), clean_html(mobj.group('description'))), + expected=True) raise ExtractorError('Unable to log in') |