diff options
author | Daniel Twardowski <[email protected]> | 2017-04-12 01:18:57 -0400 |
---|---|---|
committer | Daniel Twardowski <[email protected]> | 2017-04-12 01:18:57 -0400 |
commit | a9a346535bd855f4dd01aa32e54345cc741769c4 (patch) | |
tree | 74e9533a61bb42a6d25b2f916cbb66c15f0714f4 /youtube_dl/extractor/adobepass.py | |
parent | 89beedd31f8a00a811787b651a506001833da0e1 (diff) | |
download | youtube-dl-a9a346535bd855f4dd01aa32e54345cc741769c4.tar.gz youtube-dl-a9a346535bd855f4dd01aa32e54345cc741769c4.zip |
[adobepass] Add Verizon support (#10803)
Diffstat (limited to 'youtube_dl/extractor/adobepass.py')
-rw-r--r-- | youtube_dl/extractor/adobepass.py | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/youtube_dl/extractor/adobepass.py b/youtube_dl/extractor/adobepass.py index 1b2d364ca..a15843315 100644 --- a/youtube_dl/extractor/adobepass.py +++ b/youtube_dl/extractor/adobepass.py @@ -41,6 +41,11 @@ MSO_INFO = { 'username_field': 'IDToken1', 'password_field': 'IDToken2', }, + 'Verizon': { + 'name': 'Verizon FiOS', + 'username_field': 'IDToken1', + 'password_field': 'IDToken2', + }, 'thr030': { 'name': '3 Rivers Communications' }, @@ -1416,6 +1421,72 @@ class AdobePassIE(InfoExtractor): if '<button class="submit" value="Resume">Resume</button>' in mvpd_confirm_page: post_form(mvpd_confirm_page_res, 'Confirming Login') + elif mso_id == 'Verizon': + # In general, if you're connecting from a Verizon-assigned IP, + # you will not actually pass your credentials. + 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: + # print('[debug] SAML Auto-Login is TRUE') # GO, + saml_redirect_url = self._html_search_regex( + r'self\.parent\.location=(["\'])(?P<url>.+?)\1', + provider_redirect_page, 'Extracting 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_redirect_url, video_id, 'Downloading SAML Login Page' + ) + else: + if 'Please try again.' in provider_redirect_page: + # print('[debug] SAML Auto-Login is FALSE') # NBC, + provider_login_page_res = provider_redirect_page_res + else: + 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 + if 'Please try again.' in saml_login_page: + print("[error] We're sorry, but either the User ID or Password entered is not correct.") + import sys + sys.exit(1) + # elif 'Please wait - we are verifying your account...' in saml_login_page: + # print('saml_login_page_url', urlh.geturl()) + # 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_login_url, video_id, 'Downloading SAML Response', + headers={'Content-Type': 'text/xml'} + ) + saml_target_url = saml_response_json['targetValue'] + saml_response = saml_response_json['SAMLResponse'] + saml_relay_state = saml_response_json['RelayState'] + # print('saml_target_url', saml_target_url) + # https://sp.auth.adobe.com/sp/saml/SAMLAssertionConsumer + form_data = { + '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: # Normal, non-Comcast flow provider_login_page_res = post_form( |