aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/crunchyroll.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-09-19 02:50:06 +0700
committerSergey M․ <dstftw@gmail.com>2016-09-19 02:50:06 +0700
commit70b4cf9b1b8a2c2935ca7384d7545463cfd4ea16 (patch)
tree09c88ccacb5a7584e46e976dfe64f61ce099a1f3 /youtube_dl/extractor/crunchyroll.py
parentcc764a6da8530248f9810397a22b20c972877a97 (diff)
[crunchyroll] Check if already logged in (Closes #10700)
Diffstat (limited to 'youtube_dl/extractor/crunchyroll.py')
-rw-r--r--youtube_dl/extractor/crunchyroll.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/youtube_dl/extractor/crunchyroll.py b/youtube_dl/extractor/crunchyroll.py
index 1b69bd0b6..e4c10ad24 100644
--- a/youtube_dl/extractor/crunchyroll.py
+++ b/youtube_dl/extractor/crunchyroll.py
@@ -46,6 +46,13 @@ class CrunchyrollBaseIE(InfoExtractor):
login_page = self._download_webpage(
self._LOGIN_URL, None, 'Downloading login page')
+ def is_logged(webpage):
+ return '<title>Redirecting' in webpage
+
+ # Already logged in
+ if is_logged(login_page):
+ return
+
login_form_str = self._search_regex(
r'(?P<form><form[^>]+?id=(["\'])%s\2[^>]*>)' % self._LOGIN_FORM,
login_page, 'login form', group='form')
@@ -69,7 +76,7 @@ class CrunchyrollBaseIE(InfoExtractor):
headers={'Content-Type': 'application/x-www-form-urlencoded'})
# Successful login
- if '<title>Redirecting' in response:
+ if is_logged(response):
return
error = self._html_search_regex(