[pluralsight] Improve authentication (closes #17762)
authorSergey M․ <dstftw@gmail.com>
Thu, 4 Oct 2018 19:27:14 +0000 (02:27 +0700)
committerSergey M․ <dstftw@gmail.com>
Thu, 4 Oct 2018 19:27:14 +0000 (02:27 +0700)
youtube_dl/extractor/pluralsight.py

index daf1725702a3fe3002c35d8490226b6ad533a11b..eafe56897dde68c8dcb44d2c315d8c63dd2c805d 100644 (file)
@@ -4,6 +4,7 @@ import collections
 import json
 import os
 import random
+import re
 
 from .common import InfoExtractor
 from ..compat import (
@@ -196,7 +197,10 @@ query viewClip {
         if error:
             raise ExtractorError('Unable to login: %s' % error, expected=True)
 
-        if all(p not in response for p in ('__INITIAL_STATE__', '"currentUser"')):
+        if all(not re.search(p, response) for p in (
+                r'__INITIAL_STATE__', r'["\']currentUser["\']',
+                # new layout?
+                r'>\s*Sign out\s*<')):
             BLOCKED = 'Your account has been blocked due to suspicious activity'
             if BLOCKED in response:
                 raise ExtractorError(