From 310248965c662d98856ac687d4b5f87ddc9b3f7c Mon Sep 17 00:00:00 2001 From: Anthony Lieuallen Date: Sun, 26 Jan 2025 21:09:23 -0500 Subject: [PATCH] Repair metadata extraction for cwtv. See #12108 . This is a "one line" change, except for the tests. It seems like "all" the existing tests were failing, because they rely on downloading live data which is no longer served. So I've fixed the first test to reference currently live data, and deleted the others (which rely on no-longer-extant downloads). --- yt_dlp/extractor/cwtv.py | 70 ++++++++-------------------------------- 1 file changed, 13 insertions(+), 57 deletions(-) diff --git a/yt_dlp/extractor/cwtv.py b/yt_dlp/extractor/cwtv.py index cb432e616..cb4e6fdeb 100644 --- a/yt_dlp/extractor/cwtv.py +++ b/yt_dlp/extractor/cwtv.py @@ -13,68 +13,24 @@ from ..utils import ( class CWTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?cw(?:tv(?:pr)?|seed)\.com/(?:shows/)?(?:[^/]+/)+[^?]*\?.*\b(?:play|watch)=(?P[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.', + 'title': 'A Stitch in Time', + 'description': 'City Protective Services officer Kiera Cameron is transported from 2077 to deal with eight of the world\'s deadliest terrorists.', 'thumbnail': r're:^https?://.*\.jpe?g$', - 'duration': 2547, - 'timestamp': 1720519200, + 'duration': 2632, + 'timestamp': parse_iso8601('2025-01-15T08:00:00+00:00'), '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', - 'episode': 'Episode 1', - }, - 'params': { - # m3u8 download - 'skip_download': True, - }, - }, { - 'url': 'http://cwtv.com/shows/arrow/legends-of-yesterday/?play=6b15e985-9345-4f60-baf8-56e96be57c63', - 'info_dict': { - '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.', - 'duration': 2665, - 'series': 'Arrow', - 'season_number': 4, - 'season': '4', - 'episode_number': 8, - 'upload_date': '20151203', - 'timestamp': 1449122100, - }, - 'params': { - # m3u8 download - 'skip_download': True, - }, - 'skip': 'redirect to http://cwtv.com/shows/arrow/', - }, { - 'url': 'http://www.cwseed.com/shows/whose-line-is-it-anyway/jeff-davis-4/?play=24282b12-ead2-42f2-95ad-26770c2c6088', - 'info_dict': { - 'id': '24282b12-ead2-42f2-95ad-26770c2c6088', - 'ext': 'mp4', - 'title': 'Jeff Davis 4', - 'description': 'Jeff Davis is back to make you laugh.', - 'duration': 1263, - 'series': 'Whose Line Is It Anyway?', - 'season_number': 11, - 'episode_number': 20, - 'upload_date': '20151006', - 'timestamp': 1444107300, 'age_limit': 14, - 'uploader': 'CWTV', - 'thumbnail': r're:^https?://.*\.jpe?g$', - 'chapters': 'count:4', - 'episode': 'Episode 20', - 'season': 'Season 11', + 'upload_date': '20250115', + 'season': 'Season 1', + 'episode': 'Episode 1', }, 'params': { # m3u8 download @@ -94,7 +50,7 @@ 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) + f'https://images.cwtv.com/feed/app-2/video-meta/apiversion_22/device_web/guid_{video_id}', video_id) if data.get('result') != 'ok': raise ExtractorError(data['msg'], expected=True) video_data = data['video']