]>
Commit | Line | Data |
---|---|---|
f4ea5015 | 1 | from .common import InfoExtractor |
2 | from ..utils import parse_age_limit, parse_duration, traverse_obj | |
3 | ||
4 | ||
5 | class MagellanTVIE(InfoExtractor): | |
6 | _VALID_URL = r'https?://(?:www\.)?magellantv\.com/(?:watch|video)/(?P<id>[\w-]+)' | |
7 | _TESTS = [{ | |
8 | 'url': 'https://www.magellantv.com/watch/my-dads-on-death-row?type=v', | |
9 | 'info_dict': { | |
10 | 'id': 'my-dads-on-death-row', | |
11 | 'ext': 'mp4', | |
12 | 'title': 'My Dad\'s On Death Row', | |
13 | 'description': 'md5:33ba23b9f0651fc4537ed19b1d5b0d7a', | |
14 | 'duration': 3780.0, | |
15 | 'age_limit': 14, | |
16 | 'tags': ['Justice', 'Reality', 'United States', 'True Crime'], | |
17 | }, | |
18 | 'params': {'skip_download': 'm3u8'}, | |
19 | }, { | |
20 | 'url': 'https://www.magellantv.com/video/james-bulger-the-new-revelations', | |
21 | 'info_dict': { | |
22 | 'id': 'james-bulger-the-new-revelations', | |
23 | 'ext': 'mp4', | |
24 | 'title': 'James Bulger: The New Revelations', | |
25 | 'description': 'md5:7b97922038bad1d0fe8d0470d8a189f2', | |
26 | 'duration': 2640.0, | |
27 | 'age_limit': 0, | |
28 | 'tags': ['Investigation', 'True Crime', 'Justice', 'Europe'], | |
29 | }, | |
30 | 'params': {'skip_download': 'm3u8'}, | |
31 | }] | |
32 | ||
33 | def _real_extract(self, url): | |
34 | video_id = self._match_id(url) | |
35 | webpage = self._download_webpage(url, video_id) | |
36 | data = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['reactContext']['video']['detail'] | |
37 | formats, subtitles = self._extract_m3u8_formats_and_subtitles(data['jwpVideoUrl'], video_id) | |
38 | ||
39 | return { | |
40 | 'id': video_id, | |
41 | 'formats': formats, | |
42 | 'subtitles': subtitles, | |
43 | **traverse_obj(data, { | |
44 | 'title': ('title', {str}), | |
45 | 'description': ('metadata', 'description', {str}), | |
46 | 'duration': ('duration', {parse_duration}), | |
47 | 'age_limit': ('ratingCategory', {parse_age_limit}), | |
48 | 'tags': ('tags', ..., {str}), | |
49 | }), | |
50 | } |