[adobepass] improve comcast and verison login code(closes #10803)
This commit is contained in:
parent
a9a346535b
commit
79a51069e5
|
@ -1389,106 +1389,72 @@ class AdobePassIE(InfoExtractor):
|
||||||
# Comcast page flow varies by video site and whether you
|
# Comcast page flow varies by video site and whether you
|
||||||
# are on Comcast's network.
|
# are on Comcast's network.
|
||||||
provider_redirect_page, urlh = provider_redirect_page_res
|
provider_redirect_page, urlh = provider_redirect_page_res
|
||||||
# Check for Comcast auto login
|
|
||||||
if 'automatically signing you in' in provider_redirect_page:
|
if 'automatically signing you in' in provider_redirect_page:
|
||||||
oauth_redirect_url = self._html_search_regex(
|
oauth_redirect_url = self._html_search_regex(
|
||||||
r'window\.location\s*=\s*[\'"]([^\'"]+)',
|
r'window\.location\s*=\s*[\'"]([^\'"]+)',
|
||||||
provider_redirect_page, 'oauth redirect')
|
provider_redirect_page, 'oauth redirect')
|
||||||
# Just need to process the request. No useful data comes back
|
|
||||||
self._download_webpage(
|
self._download_webpage(
|
||||||
oauth_redirect_url, video_id, 'Confirming auto login')
|
oauth_redirect_url, video_id, 'Confirming auto login')
|
||||||
else:
|
else:
|
||||||
if '<form name="signin"' in provider_redirect_page:
|
if '<form name="signin"' in provider_redirect_page:
|
||||||
# already have the form, just fill it
|
|
||||||
provider_login_page_res = provider_redirect_page_res
|
provider_login_page_res = provider_redirect_page_res
|
||||||
elif 'http-equiv="refresh"' in provider_redirect_page:
|
elif 'http-equiv="refresh"' in provider_redirect_page:
|
||||||
# redirects to the login page
|
|
||||||
oauth_redirect_url = self._html_search_regex(
|
oauth_redirect_url = self._html_search_regex(
|
||||||
r'content="0;\s*url=([^\'"]+)',
|
r'content="0;\s*url=([^\'"]+)',
|
||||||
provider_redirect_page, 'meta refresh redirect')
|
provider_redirect_page, 'meta refresh redirect')
|
||||||
provider_login_page_res = self._download_webpage_handle(
|
provider_login_page_res = self._download_webpage_handle(
|
||||||
oauth_redirect_url,
|
oauth_redirect_url, video_id,
|
||||||
video_id, 'Downloading Provider Login Page')
|
'Downloading Provider Login Page')
|
||||||
else:
|
else:
|
||||||
provider_login_page_res = post_form(
|
provider_login_page_res = post_form(
|
||||||
provider_redirect_page_res, 'Downloading Provider Login Page')
|
provider_redirect_page_res,
|
||||||
|
'Downloading Provider Login Page')
|
||||||
|
|
||||||
mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', {
|
mvpd_confirm_page_res = post_form(
|
||||||
mso_info.get('username_field', 'username'): username,
|
provider_login_page_res, 'Logging in', {
|
||||||
mso_info.get('password_field', 'password'): password,
|
mso_info['username_field']: username,
|
||||||
})
|
mso_info['password_field']: password,
|
||||||
|
})
|
||||||
mvpd_confirm_page, urlh = mvpd_confirm_page_res
|
mvpd_confirm_page, urlh = mvpd_confirm_page_res
|
||||||
if '<button class="submit" value="Resume">Resume</button>' in mvpd_confirm_page:
|
if '<button class="submit" value="Resume">Resume</button>' in mvpd_confirm_page:
|
||||||
post_form(mvpd_confirm_page_res, 'Confirming Login')
|
post_form(mvpd_confirm_page_res, 'Confirming Login')
|
||||||
|
|
||||||
elif mso_id == 'Verizon':
|
elif mso_id == 'Verizon':
|
||||||
# In general, if you're connecting from a Verizon-assigned IP,
|
# In general, if you're connecting from a Verizon-assigned IP,
|
||||||
# you will not actually pass your credentials.
|
# you will not actually pass your credentials.
|
||||||
provider_redirect_page, urlh = provider_redirect_page_res
|
provider_redirect_page, urlh = provider_redirect_page_res
|
||||||
# print('provider_redirect_page_url', urlh.geturl())
|
|
||||||
# https://signin.verizon.com/sso/VOLPortalLogin?SAMLRequest=<snip>
|
|
||||||
if 'Please wait ...' in provider_redirect_page:
|
if 'Please wait ...' in provider_redirect_page:
|
||||||
# print('[debug] SAML Auto-Login is TRUE') # GO,
|
|
||||||
saml_redirect_url = self._html_search_regex(
|
saml_redirect_url = self._html_search_regex(
|
||||||
r'self\.parent\.location=(["\'])(?P<url>.+?)\1',
|
r'self\.parent\.location=(["\'])(?P<url>.+?)\1',
|
||||||
provider_redirect_page, 'Extracting SAML Redirect URL', group='url'
|
provider_redirect_page,
|
||||||
)
|
'SAML Redirect URL', group='url')
|
||||||
# print('saml_redirect_url', saml_redirect_url)
|
|
||||||
# https://signin.verizon.com/sso/choice/tvpHandler.jsp?loginType=vzRedirect&partner=<snip>
|
|
||||||
saml_login_page = self._download_webpage(
|
saml_login_page = self._download_webpage(
|
||||||
saml_redirect_url, video_id, 'Downloading SAML Login Page'
|
saml_redirect_url, video_id,
|
||||||
)
|
'Downloading SAML Login Page')
|
||||||
else:
|
else:
|
||||||
if 'Please try again.' in provider_redirect_page:
|
saml_login_page_res = post_form(
|
||||||
# print('[debug] SAML Auto-Login is FALSE') # NBC,
|
provider_redirect_page_res, 'Logging in', {
|
||||||
provider_login_page_res = provider_redirect_page_res
|
mso_info['username_field']: username,
|
||||||
else:
|
mso_info['password_field']: password,
|
||||||
print('[error] SAML Auto-Login is UNKNOWN')
|
})
|
||||||
import sys
|
|
||||||
sys.exit(1)
|
|
||||||
provider_login_page, urlh = provider_login_page_res
|
|
||||||
# print('provider_login_page_url', urlh.geturl())
|
|
||||||
# https://signin.verizon.com/sso/VOLPortalLogin?SAMLRequest=<snip>
|
|
||||||
saml_login_page_res = post_form(provider_login_page_res, 'Logging in', {
|
|
||||||
mso_info.get('username_field', 'username'): username,
|
|
||||||
mso_info.get('password_field', 'password'): password,
|
|
||||||
})
|
|
||||||
saml_login_page, urlh = saml_login_page_res
|
saml_login_page, urlh = saml_login_page_res
|
||||||
if 'Please try again.' in saml_login_page:
|
if 'Please try again.' in saml_login_page:
|
||||||
print("[error] We're sorry, but either the User ID or Password entered is not correct.")
|
raise ExtractorError(
|
||||||
import sys
|
'We\'re sorry, but either the User ID or Password entered is not correct.')
|
||||||
sys.exit(1)
|
saml_login_url = self._search_regex(
|
||||||
# elif 'Please wait - we are verifying your account...' in saml_login_page:
|
r'xmlHttp\.open\("POST"\s*,\s*(["\'])(?P<url>.+?)\1',
|
||||||
# print('saml_login_page_url', urlh.geturl())
|
saml_login_page, 'SAML Login URL', group='url')
|
||||||
# https://signin.verizon.com/sso/choice/tvpHandler.jsp?loginType=vzRedirect&partner=<snip>
|
|
||||||
saml_login_url = self._html_search_regex(
|
|
||||||
r'xmlHttp\.open\(\"POST\",\s(["\'])(?P<url>.+?)\1',
|
|
||||||
saml_login_page, 'Extracting SAML Login URL', group='url')
|
|
||||||
# print('saml_login_url', saml_login_url)
|
|
||||||
# https://signin.verizon.com/sso/TVPHandlerServlet?loginType=vzRedirect&partner=<snip>
|
|
||||||
saml_response_json = self._download_json(
|
saml_response_json = self._download_json(
|
||||||
saml_login_url, video_id, 'Downloading SAML Response',
|
saml_login_url, video_id, 'Downloading SAML Response',
|
||||||
headers={'Content-Type': 'text/xml'}
|
headers={'Content-Type': 'text/xml'})
|
||||||
)
|
self._download_webpage(
|
||||||
saml_target_url = saml_response_json['targetValue']
|
saml_response_json['targetValue'], video_id,
|
||||||
saml_response = saml_response_json['SAMLResponse']
|
'Confirming Login', data=urlencode_postdata({
|
||||||
saml_relay_state = saml_response_json['RelayState']
|
'SAMLResponse': saml_response_json['SAMLResponse'],
|
||||||
# print('saml_target_url', saml_target_url)
|
'RelayState': saml_response_json['RelayState']
|
||||||
# https://sp.auth.adobe.com/sp/saml/SAMLAssertionConsumer
|
}), headers={
|
||||||
form_data = {
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
'SAMLResponse': saml_response,
|
})
|
||||||
'RelayState': saml_relay_state
|
|
||||||
}
|
|
||||||
saml_autologin_res = self._download_webpage_handle(
|
|
||||||
saml_target_url, video_id,
|
|
||||||
'Auto-Login', data=urlencode_postdata(form_data),
|
|
||||||
headers={'Content-Type': 'application/x-www-form-urlencoded'}
|
|
||||||
)
|
|
||||||
original_page, urlh = saml_autologin_res
|
|
||||||
# print('original_page_url', urlh.geturl())
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Normal, non-Comcast flow
|
|
||||||
provider_login_page_res = post_form(
|
provider_login_page_res = post_form(
|
||||||
provider_redirect_page_res, 'Downloading Provider Login Page')
|
provider_redirect_page_res, 'Downloading Provider Login Page')
|
||||||
mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', {
|
mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', {
|
||||||
|
|
Loading…
Reference in New Issue