1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

Applied fix from @skittheslicer and @ParadoxGBB to fix Verizon Adobe Pass, fixes #14586 and #14363

This commit is contained in:
Keith Herrington 2019-02-04 15:42:51 -05:00
parent 48fb963b2f
commit 886c54c36b
2 changed files with 32 additions and 5 deletions

View File

@ -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<url>.+?)\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<url>.+?)\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<url>.+?)\1',
saml_login_page, 'SAML Login URL', group='url')

View File

@ -16,7 +16,7 @@ from ..utils import (
class TBSIE(TurnerBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?P<site>tbs|tntdrama)\.com(?P<path>/(?:movies|shows/[^/]+/(?:clips|season-\d+/episode-\d+))/(?P<id>[^/?#]+))'
_VALID_URL = r'https?://(?:www\.)?(?P<site>tbs|tntdrama)\.com/(?:movies|shows/[^/]+/(?:clips|season-\d+/episode-\d+))/(?P<id>[^/?#]+)'
_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'<script[^>]+?data-drupal-selector="drupal-settings-json"[^>]*?>({.+?})</script>',
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\.)?(?P<site>tbs|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']