A feature-rich command-line audio/video downloader
[ie/cwtv] Fix extractor (#12207)
arantius18a28514e306
diff --git a/yt_dlp/extractor/cwtv.py b/yt_dlp/extractor/cwtv.pyindex cb432e6160..24a8d676a0 100644--- a/yt_dlp/extractor/cwtv.py+++ b/yt_dlp/extractor/cwtv.py@@ -8,28 +8,29 @@ from ..utils import (str_or_none,update_url_query,)+from ..utils.traversal import traverse_objclass CWTVIE(InfoExtractor):_VALID_URL = r'https?://(?:www\.)?cw(?:tv(?:pr)?|seed)\.com/(?:shows/)?(?:[^/]+/)+[^?]*\?.*\b(?:play|watch)=(?P<id>[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})'_TESTS = [{- 'url': 'https://www.cwtv.com/shows/all-american-homecoming/ready-or-not/?play=d848488f-f62a-40fd-af1f-6440b1821aab',+ 'url': 'https://www.cwtv.com/shows/continuum/a-stitch-in-time/?play=9149a1e1-4cb2-46d7-81b2-47d35bbd332b','info_dict': {- 'id': 'd848488f-f62a-40fd-af1f-6440b1821aab',+ 'id': '9149a1e1-4cb2-46d7-81b2-47d35bbd332b','ext': 'mp4',- 'title': 'Ready Or Not',- 'description': 'Simone is concerned about changes taking place at Bringston; JR makes a decision about his future.',- 'thumbnail': r're:^https?://.*\.jpe?g$',- 'duration': 2547,- 'timestamp': 1720519200,+ 'title': 'A Stitch in Time',+ 'description': r're:(?s)City Protective Services officer Kiera Cameron is transported from 2077.+',+ 'thumbnail': r're:https?://.+\.jpe?g',+ 'duration': 2632,+ 'timestamp': 1736928000,'uploader': 'CWTV',- 'chapters': 'count:6',- 'series': 'All American: Homecoming',- 'season_number': 3,+ 'chapters': 'count:5',+ 'series': 'Continuum',+ 'season_number': 1,'episode_number': 1,- 'age_limit': 0,- 'upload_date': '20240709',- 'season': 'Season 3',+ 'age_limit': 14,+ 'upload_date': '20250115',+ 'season': 'Season 1','episode': 'Episode 1',},'params': {@@ -42,7 +43,7 @@ class CWTVIE(InfoExtractor):'id': '6b15e985-9345-4f60-baf8-56e96be57c63','ext': 'mp4','title': 'Legends of Yesterday',- 'description': 'Oliver and Barry Allen take Kendra Saunders and Carter Hall to a remote location to keep them hidden from Vandal Savage while they figure out how to defeat him.',+ 'description': r're:(?s)Oliver and Barry Allen take Kendra Saunders and Carter Hall to a remote.+','duration': 2665,'series': 'Arrow','season_number': 4,@@ -71,7 +72,7 @@ class CWTVIE(InfoExtractor):'timestamp': 1444107300,'age_limit': 14,'uploader': 'CWTV',- 'thumbnail': r're:^https?://.*\.jpe?g$',+ 'thumbnail': r're:https?://.+\.jpe?g','chapters': 'count:4','episode': 'Episode 20','season': 'Season 11',@@ -94,9 +95,9 @@ class CWTVIE(InfoExtractor):def _real_extract(self, url):video_id = self._match_id(url)data = self._download_json(- f'https://images.cwtv.com/feed/mobileapp/video-meta/apiversion_12/guid_{video_id}', video_id)- if data.get('result') != 'ok':- raise ExtractorError(data['msg'], expected=True)+ f'https://images.cwtv.com/feed/app-2/video-meta/apiversion_22/device_android/guid_{video_id}', video_id)+ if traverse_obj(data, 'result') != 'ok':+ raise ExtractorError(traverse_obj(data, (('error_msg', 'msg'), {str}, any)), expected=True)video_data = data['video']title = video_data['title']mpx_url = update_url_query(diff --git a/yt_dlp/extractor/theplatform.py b/yt_dlp/extractor/theplatform.pyindex 7c1769c2df..b73bea18fd 100644--- a/yt_dlp/extractor/theplatform.py+++ b/yt_dlp/extractor/theplatform.py@@ -118,8 +118,9 @@ class ThePlatformBaseIE(OnceIE):'categories', lambda _, v: v.get('label') in ('category', None), 'name', {str})) or None,'tags': traverse_obj(info, ('keywords', {lambda x: re.split(r'[;,]\s?', x) if x else None})),'location': extract_site_specific_field('region'),- 'series': extract_site_specific_field('show'),+ 'series': extract_site_specific_field('show') or extract_site_specific_field('seriesTitle'),'season_number': int_or_none(extract_site_specific_field('seasonNumber')),+ 'episode_number': int_or_none(extract_site_specific_field('episodeNumber')),'media_type': extract_site_specific_field('programmingType') or extract_site_specific_field('type'),}