1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-11-27 08:46:48 +01:00

Merge pull request #10819 from raleeper/adobepass

[adobepass] Add Comcast
This commit is contained in:
remitamine 2016-10-19 20:16:24 +01:00 committed by GitHub
commit 9218a6b4f5

View File

@ -26,6 +26,11 @@ MSO_INFO = {
'username_field': 'UserName', 'username_field': 'UserName',
'password_field': 'UserPassword', 'password_field': 'UserPassword',
}, },
'Comcast_SSO': {
'name': 'Comcast XFINITY',
'username_field': 'user',
'password_field': 'passwd',
},
'thr030': { 'thr030': {
'name': '3 Rivers Communications' 'name': '3 Rivers Communications'
}, },
@ -1364,14 +1369,49 @@ class AdobePassIE(InfoExtractor):
'domain_name': 'adobe.com', 'domain_name': 'adobe.com',
'redirect_url': url, 'redirect_url': url,
}) })
provider_login_page_res = post_form(
provider_redirect_page_res, 'Downloading Provider Login Page') if mso_id == 'Comcast_SSO':
mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', { # Comcast page flow varies by video site and whether you
mso_info.get('username_field', 'username'): username, # are on Comcast's network.
mso_info.get('password_field', 'password'): password, provider_redirect_page, urlh = provider_redirect_page_res
}) # Check for Comcast auto login
if mso_id != 'Rogers': if 'automatically signing you in' in provider_redirect_page:
post_form(mvpd_confirm_page_res, 'Confirming Login') oauth_redirect_url = self._html_search_regex(r'window\.location\s*=\s*[\'"]([^\'"]+)',
provider_redirect_page, 'oauth redirect')
# Just need to process the request. No useful data comes back
self._download_webpage(oauth_redirect_url, video_id, 'Confirming auto login')
else:
if '<form name="signin"' in provider_redirect_page:
# already have the form, just fill it
provider_login_page_res = provider_redirect_page_res
elif 'http-equiv="refresh"' in provider_redirect_page:
# redirects to the login page
oauth_redirect_url = self._html_search_regex(r'content="0;\s*url=([^\'"]+)',
provider_redirect_page, 'meta refresh redirect')
provider_login_page_res = self._download_webpage_handle(oauth_redirect_url,
video_id, 'Downloading Provider Login Page')
else:
provider_login_page_res = post_form(
provider_redirect_page_res, 'Downloading Provider Login Page')
mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', {
mso_info.get('username_field', 'username'): username,
mso_info.get('password_field', 'password'): password,
})
mvpd_confirm_page, urlh = mvpd_confirm_page_res
if '<button class="submit" value="Resume">Resume</button>' in mvpd_confirm_page:
post_form(mvpd_confirm_page_res, 'Confirming Login')
else:
# Normal, non-Comcast flow
provider_login_page_res = post_form(
provider_redirect_page_res, 'Downloading Provider Login Page')
mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', {
mso_info.get('username_field', 'username'): username,
mso_info.get('password_field', 'password'): password,
})
if mso_id != 'Rogers':
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,