From 48d4f2cb31d2b22dbf7d3d967e6df4be2b5b321c Mon Sep 17 00:00:00 2001 From: jgilf Date: Mon, 25 May 2020 19:02:09 +1000 Subject: [PATCH] [adobepass] Add support for Cox Communications (closes #11396) --- youtube_dl/extractor/adobepass.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/adobepass.py b/youtube_dl/extractor/adobepass.py index 38dca1b0a..eefed00df 100644 --- a/youtube_dl/extractor/adobepass.py +++ b/youtube_dl/extractor/adobepass.py @@ -392,6 +392,9 @@ MSO_INFO = { 'coo080': { 'name': 'Cooperative Telephone Company' }, + 'Cox': { + 'name': 'Cox Communications' + }, 'cpt010': { 'name': 'CP-TEL' }, @@ -1360,9 +1363,11 @@ class AdobePassIE(InfoExtractor): token_expires = unified_timestamp(re.sub(r'[_ ]GMT', '', xml_text(token, date_ele))) return token_expires and token_expires <= int(time.time()) - def post_form(form_page_res, note, data={}): + def post_form(form_page_res, note, data={}, form_regex=None): + if not form_regex: + form_regex = r']+action=(["\'])(?P.+?)\1' form_page, urlh = form_page_res - post_url = self._html_search_regex(r']+action=(["\'])(?P.+?)\1', form_page, 'post url', group='url') + post_url = self._html_search_regex(form_regex, form_page, 'post url', group='url') if not re.match(r'https?://', post_url): post_url = compat_urlparse.urljoin(urlh.geturl(), post_url) form_data = self._hidden_inputs(form_page) @@ -1506,12 +1511,15 @@ class AdobePassIE(InfoExtractor): provider_redirect_page_res = self._download_webpage_handle( provider_refresh_redirect_url, video_id, 'Downloading Provider Redirect Page (meta refresh)') + form_regex = None + if mso_id == 'Cox': + form_regex = r']+id="pf-signin-form"[^>]+action=(["\'])(?P.+?)\1' provider_login_page_res = post_form( - provider_redirect_page_res, self._DOWNLOADING_LOGIN_PAGE) + provider_redirect_page_res, self._DOWNLOADING_LOGIN_PAGE, form_regex=form_regex) 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, - }) + }, form_regex=form_regex) if mso_id != 'Rogers': post_form(mvpd_confirm_page_res, 'Confirming Login')