mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 16:06:49 +00:00
Merge f9d0a8cdcd
into c5098961b0
This commit is contained in:
commit
48f2cb8146
@ -1,6 +1,7 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import json
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import xml.etree.ElementTree as etree
|
import xml.etree.ElementTree as etree
|
||||||
@ -60,6 +61,11 @@ MSO_INFO = {
|
|||||||
'username_field': 'IDToken1',
|
'username_field': 'IDToken1',
|
||||||
'password_field': 'IDToken2',
|
'password_field': 'IDToken2',
|
||||||
},
|
},
|
||||||
|
'Spectrum': {
|
||||||
|
'name': 'Spectrum',
|
||||||
|
'username_field': 'IDToken1',
|
||||||
|
'password_field': 'IDToken2',
|
||||||
|
},
|
||||||
'Verizon': {
|
'Verizon': {
|
||||||
'name': 'Verizon FiOS',
|
'name': 'Verizon FiOS',
|
||||||
'username_field': 'IDToken1',
|
'username_field': 'IDToken1',
|
||||||
@ -1496,6 +1502,41 @@ class AdobePassIE(InfoExtractor):
|
|||||||
}), headers={
|
}), headers={
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
})
|
})
|
||||||
|
elif mso_id == 'Spectrum':
|
||||||
|
# Spectrum's login for is dynamically loaded via JS so we need to hardcode the flow
|
||||||
|
# as a one-off implementation.
|
||||||
|
provider_redirect_page, urlh = provider_redirect_page_res
|
||||||
|
provider_login_page_res = post_form(
|
||||||
|
provider_redirect_page_res, self._DOWNLOADING_LOGIN_PAGE)
|
||||||
|
saml_login_page, urlh = provider_login_page_res
|
||||||
|
relay_state = self._search_regex(
|
||||||
|
r'RelayState\s*=\s*"(?P<relay>.+?)";',
|
||||||
|
saml_login_page, 'RelayState', group='relay')
|
||||||
|
saml_request = self._search_regex(
|
||||||
|
r'SAMLRequest\s*=\s*"(?P<saml_request>.+?)";',
|
||||||
|
saml_login_page, 'SAMLRequest', group='saml_request')
|
||||||
|
login_json = {
|
||||||
|
mso_info['username_field']: username,
|
||||||
|
mso_info['password_field']: password,
|
||||||
|
'RelayState': relay_state,
|
||||||
|
'SAMLRequest': saml_request,
|
||||||
|
}
|
||||||
|
saml_response_json = self._download_json(
|
||||||
|
'https://tveauthn.spectrum.net/tveauthentication/api/v1/manualAuth', video_id,
|
||||||
|
'Downloading SAML Response',
|
||||||
|
data=json.dumps(login_json).encode(),
|
||||||
|
headers={
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
})
|
||||||
|
self._download_webpage(
|
||||||
|
saml_response_json['SAMLRedirectUri'], video_id,
|
||||||
|
'Confirming Login', data=urlencode_postdata({
|
||||||
|
'SAMLResponse': saml_response_json['SAMLResponse'],
|
||||||
|
'RelayState': relay_state,
|
||||||
|
}), headers={
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
})
|
||||||
else:
|
else:
|
||||||
# Some providers (e.g. DIRECTV NOW) have another meta refresh
|
# Some providers (e.g. DIRECTV NOW) have another meta refresh
|
||||||
# based redirect that should be followed.
|
# based redirect that should be followed.
|
||||||
|
Loading…
Reference in New Issue
Block a user