From 4b7bec66d8100978b82bb24110ed44e2a7749931 Mon Sep 17 00:00:00 2001 From: kclauhk <78251477+kclauhk@users.noreply.github.com> Date: Tue, 8 Oct 2024 07:24:31 +0800 Subject: [PATCH] [ie/cwtv] Fix extractor (#11135) Closes #11131 Authored by: kclauhk --- yt_dlp/extractor/cwtv.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/cwtv.py b/yt_dlp/extractor/cwtv.py index 870d4f39e..4559d3cd6 100644 --- a/yt_dlp/extractor/cwtv.py +++ b/yt_dlp/extractor/cwtv.py @@ -12,6 +12,30 @@ 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', + 'info_dict': { + 'id': 'd848488f-f62a-40fd-af1f-6440b1821aab', + '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, + 'uploader': 'CWTV', + 'chapters': 'count:6', + 'series': 'All American: Homecoming', + 'season_number': 3, + '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', @@ -69,13 +93,12 @@ class CWTVIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) data = self._download_json( - 'http://images.cwtv.com/feed/mobileapp/video-meta/apiversion_8/guid_' + video_id, - video_id) + 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) video_data = data['video'] title = video_data['title'] - mpx_url = video_data.get('mpx_url') or f'http://link.theplatform.com/s/cwtv/media/guid/2703454149/{video_id}?formats=M3U' + mpx_url = video_data.get('mpx_url') or f'https://link.theplatform.com/s/cwtv/media/guid/2703454149/{video_id}?formats=M3U' season = str_or_none(video_data.get('season')) episode = str_or_none(video_data.get('episode'))