1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-12-02 05:07:55 +01:00

Update Authentication for Directv Now

This commit is contained in:
SpeakerEnder 2019-03-31 00:01:17 -04:00
parent 93bb6b1bae
commit db4976186c

View File

@ -27,8 +27,8 @@ MSO_INFO = {
}, },
'ATTOTT': { 'ATTOTT': {
'name': 'DIRECTV NOW', 'name': 'DIRECTV NOW',
'username_field': 'email', 'username_field': 'userid',
'password_field': 'loginpassword', 'password_field': 'password',
}, },
'Rogers': { 'Rogers': {
'name': 'Rogers', 'name': 'Rogers',
@ -1491,31 +1491,64 @@ class AdobePassIE(InfoExtractor):
}), headers={ }), headers={
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}) })
elif mso_id == 'ATTOTT':
provider_login_page, urlTest = post_form(provider_redirect_page_res,'Pressing Continuing', {'submit': 'Continue'})
login_widget_data_json = self._html_search_regex(
"var LoginWidgetAdditionalAttr = (.*)//-->",
provider_login_page,
'login form data json',
flags=re.DOTALL)
login_widget_data = self._parse_json(login_widget_data_json, 'login form data')
login_widget_data = login_widget_data['LoginWidgetSetting']
post_url = login_widget_data['TGuardAuthPostUrl']
if not re.match(r'https?://', post_url):
post_url = compat_urlparse.urljoin(urlTest.geturl(), post_url)
form_data = login_widget_data['formSubmitParams']
form_data.update({
mso_info.get('username_field', 'username'): username,
mso_info.get('password_field', 'password'): password,
'remember_me': 'Y',
})
mvpd_confirm_page_res = self._download_webpage_handle(
post_url, video_id, 'Submit User/Password', data=urlencode_postdata(form_data), headers={
'Content-Type': 'application/x-www-form-urlencoded',
})
mvpd_auth_page = post_form(mvpd_confirm_page_res,'Authenticate')
post_form(mvpd_auth_page,'Call SAMLAssert')
else: else:
# Some providers (e.g. DIRECTV NOW) have another meta refresh # Some providers have another meta refresh
# based redirect that should be followed. # based redirect that should be followed.
provider_redirect_page, urlh = provider_redirect_page_res provider_redirect_page, urlh = provider_redirect_page_res
provider_refresh_redirect_url = extract_redirect_url( provider_refresh_redirect_url = extract_redirect_url(
provider_redirect_page, url=urlh.geturl()) provider_redirect_page, url=urlh.geturl())
if provider_refresh_redirect_url: if provider_refresh_redirect_url:
provider_redirect_page_res = self._download_webpage_handle( provider_redirect_page_res = self._download_webpage_handle(
provider_refresh_redirect_url, video_id, provider_refresh_redirect_url, video_id,
'Downloading Provider Redirect Page (meta refresh)') 'Downloading Provider Redirect Page (meta refresh)')
provider_login_page_res = post_form( provider_login_page_res = post_form(
provider_redirect_page_res, self._DOWNLOADING_LOGIN_PAGE) provider_redirect_page_res, self._DOWNLOADING_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', {
mso_info.get('username_field', 'username'): username, mso_info.get('username_field', 'username'): username,
mso_info.get('password_field', 'password'): password, mso_info.get('password_field', 'password'): password,
}) })
if mso_id != 'Rogers': if mso_id != 'Rogers':
post_form(mvpd_confirm_page_res, 'Confirming Login') post_form(mvpd_confirm_page_res, 'Confirming Login')
session = self._download_webpage( session = self._download_webpage(
self._SERVICE_PROVIDER_TEMPLATE % 'session', video_id, self._SERVICE_PROVIDER_TEMPLATE % 'session', video_id,
'Retrieving Session', data=urlencode_postdata({ 'Retrieving Session', data=urlencode_postdata({
'_method': 'GET', '_method': 'GET',
'requestor_id': requestor_id, 'requestor_id': requestor_id,
}), headers=mvpd_headers) }), headers=mvpd_headers)
if '<pendingLogout' in session: if '<pendingLogout' in session:
self._downloader.cache.store(self._MVPD_CACHE, requestor_id, {}) self._downloader.cache.store(self._MVPD_CACHE, requestor_id, {})
count += 1 count += 1