diff options
author | nnoboa <90611593+nnoboa@users.noreply.github.com> | 2023-07-28 14:52:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-28 18:52:07 +0000 |
commit | a15fcd299e767a510debd8dc1646fe863b96ce0e (patch) | |
tree | 1a73c2907aec301df7f36231fb55d925c2c6d616 | |
parent | c03a58ec9933e4a42c2d8fa80b8a0ddb2cde64e6 (diff) | |
download | hypervideo-pre-a15fcd299e767a510debd8dc1646fe863b96ce0e.tar.lz hypervideo-pre-a15fcd299e767a510debd8dc1646fe863b96ce0e.tar.xz hypervideo-pre-a15fcd299e767a510debd8dc1646fe863b96ce0e.zip |
[ie/Wimbledon] Add extractor (#7551)
Closes #7462
Authored by: nnoboa
-rw-r--r-- | yt_dlp/extractor/_extractors.py | 1 | ||||
-rw-r--r-- | yt_dlp/extractor/wimbledon.py | 61 |
2 files changed, 62 insertions, 0 deletions
diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index ae73a9f96..9d935a7d1 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -2363,6 +2363,7 @@ from .weyyak import WeyyakIE from .whyp import WhypIE from .wikimedia import WikimediaIE from .willow import WillowIE +from .wimbledon import WimbledonIE from .wimtv import WimTVIE from .whowatch import WhoWatchIE from .wistia import ( diff --git a/yt_dlp/extractor/wimbledon.py b/yt_dlp/extractor/wimbledon.py new file mode 100644 index 000000000..ee4872e88 --- /dev/null +++ b/yt_dlp/extractor/wimbledon.py @@ -0,0 +1,61 @@ +from .common import InfoExtractor +from ..utils import ( + parse_duration, + traverse_obj, +) + + +class WimbledonIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?wimbledon\.com/\w+/video/media/(?P<id>\d+).html' + _TESTS = [{ + 'url': 'https://www.wimbledon.com/en_GB/video/media/6330247525112.html', + 'info_dict': { + 'id': '6330247525112', + 'ext': 'mp4', + 'timestamp': 1687972186, + 'description': '', + 'thumbnail': r're:^https://[\w.-]+\.prod\.boltdns\.net/[^?#]+/image\.jpg', + 'upload_date': '20230628', + 'title': 'Coco Gauff | My Wimbledon Inspiration', + 'tags': ['features', 'trending', 'homepage'], + 'uploader_id': '3506358525001', + 'duration': 163072.0, + }, + }, { + 'url': 'https://www.wimbledon.com/en_GB/video/media/6308703111112.html', + 'info_dict': { + 'id': '6308703111112', + 'ext': 'mp4', + 'thumbnail': r're:^https://[\w.-]+\.prod\.boltdns\.net/[^?#]+/image\.jpg', + 'description': 'null', + 'upload_date': '20220629', + 'uploader_id': '3506358525001', + 'title': 'Roblox | WimbleWorld ', + 'duration': 101440.0, + 'tags': ['features', 'kids'], + 'timestamp': 1656500867, + }, + }, { + 'url': 'https://www.wimbledon.com/en_US/video/media/6309327106112.html', + 'only_matching': True, + }, { + 'url': 'https://www.wimbledon.com/es_Es/video/media/6308377909112.html', + 'only_matching': True, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + metadata = self._download_json( + f'https://www.wimbledon.com/relatedcontent/rest/v2/wim_v1/en/content/wim_v1_{video_id}_en', video_id) + + return { + '_type': 'url_transparent', + 'url': f'http://players.brightcove.net/3506358525001/default_default/index.html?videoId={video_id}', + 'ie_key': 'BrightcoveNew', + 'id': video_id, + **traverse_obj(metadata, { + 'title': 'title', + 'description': 'description', + 'duration': ('metadata', 'duration', {parse_duration}), + }), + } |