]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/scrippsnetworks.py
[ie/mlbtv] Fix extraction (#10296)
[yt-dlp.git] / yt_dlp / extractor / scrippsnetworks.py
index adfd7e5f297e5d53997d9a42f7e3c9fe81fabd8b..d770368a7feeba783ada7a64b3efebc17e9b90e1 100644 (file)
@@ -1,8 +1,8 @@
-import json
 import hashlib
+import json
 
-from .aws import AWSIE
 from .anvato import AnvatoIE
+from .aws import AWSIE
 from .common import InfoExtractor
 from ..utils import (
     smuggle_url,
@@ -39,6 +39,7 @@ class ScrippsNetworksWatchIE(AWSIE):
             'skip_download': True,
         },
         'add_ie': [AnvatoIE.ie_key()],
+        'skip': '404 Not Found',
     }]
 
     _SNI_TABLE = {
@@ -55,10 +56,10 @@ def _real_extract(self, url):
         site_id, video_id = mobj.group('site', 'id')
 
         aws_identity_id_json = json.dumps({
-            'IdentityId': '%s:7655847c-0ae7-4d9b-80d6-56c062927eb3' % self._AWS_REGION
-        }).encode('utf-8')
+            'IdentityId': f'{self._AWS_REGION}:7655847c-0ae7-4d9b-80d6-56c062927eb3',
+        }).encode()
         token = self._download_json(
-            'https://cognito-identity.%s.amazonaws.com/' % self._AWS_REGION, video_id,
+            f'https://cognito-identity.{self._AWS_REGION}.amazonaws.com/', video_id,
             data=aws_identity_id_json,
             headers={
                 'Accept': '*/*',
@@ -84,11 +85,11 @@ def _real_extract(self, url):
 
         def get(key):
             return xpath_text(
-                sts, './/{https://sts.amazonaws.com/doc/2011-06-15/}%s' % key,
+                sts, f'.//{{https://sts.amazonaws.com/doc/2011-06-15/}}{key}',
                 fatal=True)
 
         mcp_id = self._aws_execute_api({
-            'uri': '/1/web/brands/%s/episodes/scrid/%s' % (self._SNI_TABLE[site_id], video_id),
+            'uri': f'/1/web/brands/{self._SNI_TABLE[site_id]}/episodes/scrid/{video_id}',
             'access_key': get('AccessKeyId'),
             'secret_key': get('SecretAccessKey'),
             'session_token': get('SessionToken'),
@@ -96,7 +97,7 @@ def get(key):
 
         return self.url_result(
             smuggle_url(
-                'anvato:anvato_scripps_app_web_prod_0837996dbe373629133857ae9eb72e740424d80a:%s' % mcp_id,
+                f'anvato:anvato_scripps_app_web_prod_0837996dbe373629133857ae9eb72e740424d80a:{mcp_id}',
                 {'geo_countries': ['US']}),
             AnvatoIE.ie_key(), video_id=mcp_id)
 
@@ -113,6 +114,11 @@ class ScrippsNetworksIE(InfoExtractor):
             'timestamp': 1475678834,
             'upload_date': '20161005',
             'uploader': 'SCNI-SCND',
+            'tags': 'count:10',
+            'creator': 'Cooking Channel',
+            'duration': 29.995,
+            'chapters': [{'start_time': 0.0, 'end_time': 29.995, 'title': '<Untitled Chapter 1>'}],
+            'thumbnail': 'https://images.dds.discovery.com/up/tp/Scripps_-_Food_Category_Prod/122/987/0260338_630x355.jpg',
         },
         'add_ie': ['ThePlatform'],
         'expected_warnings': ['No HLS formats found'],