]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/cbs.py
[ie/generic] Add `key_query` extractor-arg
[yt-dlp.git] / yt_dlp / extractor / cbs.py
index 1c0dbdea9444c370bf8d5b7811ad39ccc9905cf9..e8255889724a66d0b014250f55549e5ccd588091 100644 (file)
@@ -5,14 +5,14 @@
 from ..utils import (
     ExtractorError,
     extract_attributes,
+    find_xpath_attr,
     get_element_html_by_id,
     int_or_none,
-    find_xpath_attr,
     smuggle_url,
-    xpath_element,
-    xpath_text,
     update_url_query,
     url_or_none,
+    xpath_element,
+    xpath_text,
 )
 
 
@@ -31,7 +31,7 @@ def _parse_smil_subtitles(self, smil, namespace=None, subtitles_lang='en'):
         return subtitles
 
     def _extract_common_video_info(self, content_id, asset_types, mpx_acc, extra_info):
-        tp_path = 'dJ5BDC/media/guid/%d/%s' % (mpx_acc, content_id)
+        tp_path = f'dJ5BDC/media/guid/{mpx_acc}/{content_id}'
         tp_release_url = f'https://link.theplatform.com/s/{tp_path}'
         info = self._extract_theplatform_metadata(tp_path, content_id)
 
@@ -41,7 +41,7 @@ def _extract_common_video_info(self, content_id, asset_types, mpx_acc, extra_inf
             try:
                 tp_formats, tp_subtitles = self._extract_theplatform_smil(
                     update_url_query(tp_release_url, query), content_id,
-                    'Downloading %s SMIL data' % asset_type)
+                    f'Downloading {asset_type} SMIL data')
             except ExtractorError as e:
                 last_e = e
                 if asset_type != 'fallback':
@@ -50,7 +50,7 @@ def _extract_common_video_info(self, content_id, asset_types, mpx_acc, extra_inf
                 try:
                     tp_formats, tp_subtitles = self._extract_theplatform_smil(
                         update_url_query(tp_release_url, query), content_id,
-                        'Downloading %s SMIL data, trying again with another format' % asset_type)
+                        f'Downloading {asset_type} SMIL data, trying again with another format')
                 except ExtractorError as e:
                     last_e = e
                     continue
@@ -76,6 +76,7 @@ def _real_extract(self, url):
 
 
 class CBSIE(CBSBaseIE):
+    _WORKING = False
     _VALID_URL = r'''(?x)
         (?:
             cbs:|
@@ -101,6 +102,7 @@ class CBSIE(CBSBaseIE):
             # m3u8 download
             'skip_download': True,
         },
+        'skip': 'Subscription required',
     }, {
         'url': 'https://www.cbs.com/shows/video/sZH1MGgomIosZgxGJ1l263MFq16oMtW1/',
         'info_dict': {
@@ -117,6 +119,7 @@ class CBSIE(CBSBaseIE):
         },
         'expected_warnings': [
             'This content expired on', 'No video formats found', 'Requested format is not available'],
+        'skip': '404 Not Found',
     }, {
         'url': 'http://colbertlateshow.com/video/8GmB0oY0McANFvp2aEffk9jZZZ2YyXxy/the-colbeard/',
         'only_matching': True,