]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
add support for Adobe Pass auth in tbs,tnt and trutv extractors(fixes #10642)(closes...
authorRemita Amine <remitamine@gmail.com>
Tue, 20 Sep 2016 10:55:30 +0000 (11:55 +0100)
committerRemita Amine <remitamine@gmail.com>
Tue, 20 Sep 2016 10:55:30 +0000 (11:55 +0100)
youtube_dl/extractor/adobepass.py
youtube_dl/extractor/tbs.py
youtube_dl/extractor/trutv.py
youtube_dl/extractor/turner.py

index 01932e5e6c55579f0147e5d60a60e1c2a8f549f6..c787e096273d64b845ad347d8b5f17adea6a6b8c 100644 (file)
@@ -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 {}
index 0c351e045369e4c4dcf17eb2dcd3a05a0e017c69..bf93eb8682e1f7424216ebd08438dbb6a3a9b955 100644 (file)
@@ -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',
             })
index e60d8a18164b9c7d3f918728e8de7639461d4241..3a5782525ec0d47343e126f6872ca0319d8ddeb0 100644 (file)
@@ -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,
             })
index 4228c1ccc6839409738b8185261b038daee64a13..57ffedb87f815d4aef87065a235a89871001be41 100644 (file)
@@ -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)