mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-20 03:54:01 +00:00
add support for Adobe Pass auth in tbs,tnt and trutv extractors(fixes #10642)(closes #10222)(closes #10519)
This commit is contained in:
parent
cb57386873
commit
c38f06818d
@ -83,7 +83,7 @@ class AdobePassIE(InfoExtractor):
|
||||
'User-Agent': self._USER_AGENT,
|
||||
}
|
||||
|
||||
guid = xml_text(resource, 'guid')
|
||||
guid = xml_text(resource, 'guid') if '<' in resource else resource
|
||||
count = 0
|
||||
while count < 2:
|
||||
requestor_info = self._downloader.cache.load(self._MVPD_CACHE, requestor_id) or {}
|
||||
|
@ -4,10 +4,7 @@ from __future__ import unicode_literals
|
||||
import re
|
||||
|
||||
from .turner import TurnerBaseIE
|
||||
from ..utils import (
|
||||
extract_attributes,
|
||||
ExtractorError,
|
||||
)
|
||||
from ..utils import extract_attributes
|
||||
|
||||
|
||||
class TBSIE(TurnerBaseIE):
|
||||
@ -37,10 +34,6 @@ class TBSIE(TurnerBaseIE):
|
||||
site = domain[:3]
|
||||
webpage = self._download_webpage(url, display_id)
|
||||
video_params = extract_attributes(self._search_regex(r'(<[^>]+id="page-video"[^>]*>)', webpage, 'video params'))
|
||||
if video_params.get('isAuthRequired') == 'true':
|
||||
raise ExtractorError(
|
||||
'This video is only available via cable service provider subscription that'
|
||||
' is not currently supported.', expected=True)
|
||||
query = None
|
||||
clip_id = video_params.get('clipid')
|
||||
if clip_id:
|
||||
@ -56,4 +49,8 @@ class TBSIE(TurnerBaseIE):
|
||||
'media_src': 'http://androidhls-secure.cdn.turner.com/%s/big' % site,
|
||||
'tokenizer_src': 'http://www.%s.com/video/processors/services/token_ipadAdobe.do' % domain,
|
||||
},
|
||||
}, {
|
||||
'url': url,
|
||||
'site_name': site.upper(),
|
||||
'auth_required': video_params.get('isAuthRequired') != 'false',
|
||||
})
|
||||
|
@ -22,9 +22,17 @@ class TruTVIE(TurnerBaseIE):
|
||||
|
||||
def _real_extract(self, url):
|
||||
path, video_id = re.match(self._VALID_URL, url).groups()
|
||||
auth_required = False
|
||||
if path:
|
||||
data_src = 'http://www.trutv.com/video/cvp/v2/xml/content.xml?id=%s.xml' % path
|
||||
else:
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
video_id = self._search_regex(
|
||||
r"TTV\.TVE\.episodeId\s*=\s*'([^']+)';",
|
||||
webpage, 'video id', default=video_id)
|
||||
auth_required = self._search_regex(
|
||||
r'TTV\.TVE\.authRequired\s*=\s*(true|false);',
|
||||
webpage, 'auth required', default='false') == 'true'
|
||||
data_src = 'http://www.trutv.com/tveverywhere/services/cvpXML.do?titleId=' + video_id
|
||||
return self._extract_cvp_info(
|
||||
data_src, path, {
|
||||
@ -32,4 +40,8 @@ class TruTVIE(TurnerBaseIE):
|
||||
'media_src': 'http://androidhls-secure.cdn.turner.com/trutv/big',
|
||||
'tokenizer_src': 'http://www.trutv.com/tveverywhere/processors/services/token_ipadAdobe.do',
|
||||
},
|
||||
}, {
|
||||
'url': url,
|
||||
'site_name': 'truTV',
|
||||
'auth_required': auth_required,
|
||||
})
|
||||
|
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from .adobepass import AdobePassIE
|
||||
from ..compat import compat_str
|
||||
from ..utils import (
|
||||
xpath_text,
|
||||
@ -16,11 +16,11 @@ from ..utils import (
|
||||
)
|
||||
|
||||
|
||||
class TurnerBaseIE(InfoExtractor):
|
||||
class TurnerBaseIE(AdobePassIE):
|
||||
def _extract_timestamp(self, video_data):
|
||||
return int_or_none(xpath_attr(video_data, 'dateCreated', 'uts'))
|
||||
|
||||
def _extract_cvp_info(self, data_src, video_id, path_data={}):
|
||||
def _extract_cvp_info(self, data_src, video_id, path_data={}, ap_data={}):
|
||||
video_data = self._download_xml(data_src, video_id)
|
||||
video_id = video_data.attrib['id']
|
||||
title = xpath_text(video_data, 'headline', fatal=True)
|
||||
@ -70,11 +70,14 @@ class TurnerBaseIE(InfoExtractor):
|
||||
secure_path = self._search_regex(r'https?://[^/]+(.+/)', video_url, 'secure path') + '*'
|
||||
token = tokens.get(secure_path)
|
||||
if not token:
|
||||
query = {
|
||||
'path': secure_path,
|
||||
'videoId': content_id,
|
||||
}
|
||||
if ap_data.get('auth_required'):
|
||||
query['accessToken'] = self._extract_mvpd_auth(ap_data['url'], video_id, ap_data['site_name'], ap_data['site_name'])
|
||||
auth = self._download_xml(
|
||||
secure_path_data['tokenizer_src'], video_id, query={
|
||||
'path': secure_path,
|
||||
'videoId': content_id,
|
||||
})
|
||||
secure_path_data['tokenizer_src'], video_id, query=query)
|
||||
error_msg = xpath_text(auth, 'error/msg')
|
||||
if error_msg:
|
||||
raise ExtractorError(error_msg, expected=True)
|
||||
|
Loading…
Reference in New Issue
Block a user