Skip to content

Commit

Permalink
Applied fix from @skittheslicer and @ParadoxGBB to fix Verizon Adobe …
Browse files Browse the repository at this point in the history
…Pass, fixes #14586 and #14363
  • Loading branch information
keithah committed Feb 4, 2019
1 parent 48fb963 commit 886c54c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
28 changes: 26 additions & 2 deletions youtube_dl/extractor/adobepass.py
Original file line number Diff line number Diff line change
Expand Up @@ -1459,15 +1459,17 @@ def extract_redirect_url(html, url=None, fatal=False):
# 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,
'SAML Redirect URL', group='url')
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,
Expand All @@ -1477,6 +1479,28 @@ def extract_redirect_url(html, url=None, fatal=False):
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')
Expand Down
9 changes: 6 additions & 3 deletions youtube_dl/extractor/tbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


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': {
Expand All @@ -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']
Expand Down

0 comments on commit 886c54c

Please sign in to comment.