diff --git a/youtube_dl/extractor/adobepass.py b/youtube_dl/extractor/adobepass.py index 1cf2dcbf3..312f7a993 100644 --- a/youtube_dl/extractor/adobepass.py +++ b/youtube_dl/extractor/adobepass.py @@ -1459,7 +1459,8 @@ class AdobePassIE(InfoExtractor): # 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 - if 'Please wait ...' in provider_redirect_page: + # From non-Verizon IP, still gave 'Please wait', but noticed N==Y; will need to try on Verizon IP + if 'Please wait ...' in provider_redirect_page and "'N'== \"Y\"" not in provider_redirect_page: saml_redirect_url = self._html_search_regex( r'self\.parent\.location=(["\'])(?P.+?)\1', provider_redirect_page, @@ -1467,7 +1468,8 @@ class AdobePassIE(InfoExtractor): saml_login_page = self._download_webpage( saml_redirect_url, video_id, 'Downloading SAML Login Page') - else: + elif 'Verizon FiOS - sign in' in provider_redirect_page: + # FXNetworks from non-Verizon IP saml_login_page_res = post_form( provider_redirect_page_res, 'Logging in', { mso_info['username_field']: username, @@ -1477,6 +1479,28 @@ class AdobePassIE(InfoExtractor): if 'Please try again.' in saml_login_page: raise ExtractorError( 'We\'re sorry, but either the User ID or Password entered is not correct.') + else: + # elif 'Please wait ...' in provider_redirect_page and "'N'== \"Y\"" in provider_redirect_page: + # ABC from non-Verizon IP + saml_redirect_url = self._html_search_regex( + r'var\surl\s*=\s*(["\'])(?P.+?)\1', + provider_redirect_page, + 'SAML Redirect URL', group='url') + saml_redirect_url = saml_redirect_url.replace(r'\/','/') + saml_redirect_url = saml_redirect_url.replace(r'\-','-') + saml_redirect_url = saml_redirect_url.replace(r'\x26','&') + saml_login_page = self._download_webpage( + saml_redirect_url, video_id, + 'Downloading SAML Login Page') + saml_login_page_res = post_form( + [saml_login_page, saml_redirect_url] , 'Logging in', { + mso_info['username_field']: username, + mso_info['password_field']: password, + }) + saml_login_page, urlh = saml_login_page_res + if 'Please try again.' in saml_login_page: + raise ExtractorError( + 'We\'re sorry, but either the User ID or Password entered is not correct.') saml_login_url = self._search_regex( r'xmlHttp\.open\("POST"\s*,\s*(["\'])(?P.+?)\1', saml_login_page, 'SAML Login URL', group='url') diff --git a/youtube_dl/extractor/tbs.py b/youtube_dl/extractor/tbs.py index e8a7c65e0..51435b75a 100644 --- a/youtube_dl/extractor/tbs.py +++ b/youtube_dl/extractor/tbs.py @@ -16,7 +16,7 @@ from ..utils import ( class TBSIE(TurnerBaseIE): - _VALID_URL = r'https?://(?:www\.)?(?Ptbs|tntdrama)\.com(?P/(?:movies|shows/[^/]+/(?:clips|season-\d+/episode-\d+))/(?P[^/?#]+))' + _VALID_URL = r'https?://(?:www\.)?(?Ptbs|tntdrama)\.com/(?:movies|shows/[^/]+/(?:clips|season-\d+/episode-\d+))/(?P[^/?#]+)' _TESTS = [{ 'url': 'http://www.tntdrama.com/shows/the-alienist/clips/monster', 'info_dict': { @@ -40,12 +40,15 @@ class TBSIE(TurnerBaseIE): }] def _real_extract(self, url): - site, path, display_id = re.match(self._VALID_URL, url).groups() + site, display_id = re.match(self._VALID_URL, url).groups() webpage = self._download_webpage(url, display_id) drupal_settings = self._parse_json(self._search_regex( r']+?data-drupal-selector="drupal-settings-json"[^>]*?>({.+?})', webpage, 'drupal setting'), display_id) - video_data = next(v for v in drupal_settings['turner_playlist'] if v.get('url') == path) + playlistUrl = re.sub(r'https?://(?:www\.)?(?Ptbs|tntdrama)\.com', '', url) + for index in range(len(drupal_settings['turner_playlist'])): + if drupal_settings['turner_playlist'][index]['url'] == playlistUrl: + video_data = drupal_settings['turner_playlist'][index] media_id = video_data['mediaID'] title = video_data['title']