]>
Commit | Line | Data |
---|---|---|
a15fcd29 | 1 | from .common import InfoExtractor |
2 | from ..utils import ( | |
3 | parse_duration, | |
4 | traverse_obj, | |
5 | ) | |
6 | ||
7 | ||
8 | class WimbledonIE(InfoExtractor): | |
6148833f | 9 | _VALID_URL = r'https?://(?:www\.)?wimbledon\.com/\w+/video/media/(?P<id>\d+)\.html' |
a15fcd29 | 10 | _TESTS = [{ |
11 | 'url': 'https://www.wimbledon.com/en_GB/video/media/6330247525112.html', | |
12 | 'info_dict': { | |
13 | 'id': '6330247525112', | |
14 | 'ext': 'mp4', | |
15 | 'timestamp': 1687972186, | |
16 | 'description': '', | |
17 | 'thumbnail': r're:^https://[\w.-]+\.prod\.boltdns\.net/[^?#]+/image\.jpg', | |
18 | 'upload_date': '20230628', | |
19 | 'title': 'Coco Gauff | My Wimbledon Inspiration', | |
20 | 'tags': ['features', 'trending', 'homepage'], | |
21 | 'uploader_id': '3506358525001', | |
22 | 'duration': 163072.0, | |
23 | }, | |
24 | }, { | |
25 | 'url': 'https://www.wimbledon.com/en_GB/video/media/6308703111112.html', | |
26 | 'info_dict': { | |
27 | 'id': '6308703111112', | |
28 | 'ext': 'mp4', | |
29 | 'thumbnail': r're:^https://[\w.-]+\.prod\.boltdns\.net/[^?#]+/image\.jpg', | |
30 | 'description': 'null', | |
31 | 'upload_date': '20220629', | |
32 | 'uploader_id': '3506358525001', | |
33 | 'title': 'Roblox | WimbleWorld ', | |
34 | 'duration': 101440.0, | |
35 | 'tags': ['features', 'kids'], | |
36 | 'timestamp': 1656500867, | |
37 | }, | |
38 | }, { | |
39 | 'url': 'https://www.wimbledon.com/en_US/video/media/6309327106112.html', | |
40 | 'only_matching': True, | |
41 | }, { | |
42 | 'url': 'https://www.wimbledon.com/es_Es/video/media/6308377909112.html', | |
43 | 'only_matching': True, | |
44 | }] | |
45 | ||
46 | def _real_extract(self, url): | |
47 | video_id = self._match_id(url) | |
48 | metadata = self._download_json( | |
49 | f'https://www.wimbledon.com/relatedcontent/rest/v2/wim_v1/en/content/wim_v1_{video_id}_en', video_id) | |
50 | ||
51 | return { | |
52 | '_type': 'url_transparent', | |
53 | 'url': f'http://players.brightcove.net/3506358525001/default_default/index.html?videoId={video_id}', | |
54 | 'ie_key': 'BrightcoveNew', | |
55 | 'id': video_id, | |
56 | **traverse_obj(metadata, { | |
57 | 'title': 'title', | |
58 | 'description': 'description', | |
59 | 'duration': ('metadata', 'duration', {parse_duration}), | |
60 | }), | |
61 | } |