]>
Commit | Line | Data |
---|---|---|
1 | from .common import InfoExtractor | |
2 | from ..utils import ( | |
3 | parse_duration, | |
4 | parse_iso8601, | |
5 | js_to_json, | |
6 | ) | |
7 | from ..compat import compat_str | |
8 | ||
9 | ||
10 | class RDSIE(InfoExtractor): | |
11 | _WORKING = False | |
12 | IE_DESC = 'RDS.ca' | |
13 | _VALID_URL = r'https?://(?:www\.)?rds\.ca/vid(?:[eé]|%C3%A9)os/(?:[^/]+/)*(?P<id>[^/]+)-\d+\.\d+' | |
14 | ||
15 | _TESTS = [{ | |
16 | # has two 9c9media ContentPackages, the web player selects the first ContentPackage | |
17 | 'url': 'https://www.rds.ca/videos/Hockey/NationalHockeyLeague/teams/9/forum-du-5-a-7-jesperi-kotkaniemi-de-retour-de-finlande-3.1377606', | |
18 | 'info_dict': { | |
19 | 'id': '2083309', | |
20 | 'display_id': 'forum-du-5-a-7-jesperi-kotkaniemi-de-retour-de-finlande', | |
21 | 'ext': 'flv', | |
22 | 'title': 'Forum du 5 à 7 : Kotkaniemi de retour de Finlande', | |
23 | 'description': 'md5:83fa38ecc4a79b19e433433254077f25', | |
24 | 'timestamp': 1606129030, | |
25 | 'upload_date': '20201123', | |
26 | 'duration': 773.039, | |
27 | } | |
28 | }, { | |
29 | 'url': 'http://www.rds.ca/vid%C3%A9os/un-voyage-positif-3.877934', | |
30 | 'only_matching': True, | |
31 | }] | |
32 | ||
33 | def _real_extract(self, url): | |
34 | display_id = self._match_id(url) | |
35 | ||
36 | webpage = self._download_webpage(url, display_id) | |
37 | ||
38 | item = self._parse_json(self._search_regex(r'(?s)itemToPush\s*=\s*({.+?});', webpage, 'item'), display_id, js_to_json) | |
39 | video_id = compat_str(item['id']) | |
40 | title = item.get('title') or self._og_search_title(webpage) or self._html_search_meta( | |
41 | 'title', webpage, 'title', fatal=True) | |
42 | description = self._og_search_description(webpage) or self._html_search_meta( | |
43 | 'description', webpage, 'description') | |
44 | thumbnail = item.get('urlImageBig') or self._og_search_thumbnail(webpage) or self._search_regex( | |
45 | [r'<link[^>]+itemprop="thumbnailUrl"[^>]+href="([^"]+)"', | |
46 | r'<span[^>]+itemprop="thumbnailUrl"[^>]+content="([^"]+)"'], | |
47 | webpage, 'thumbnail', fatal=False) | |
48 | timestamp = parse_iso8601(self._search_regex( | |
49 | r'<span[^>]+itemprop="uploadDate"[^>]+content="([^"]+)"', | |
50 | webpage, 'upload date', fatal=False)) | |
51 | duration = parse_duration(self._search_regex( | |
52 | r'<span[^>]+itemprop="duration"[^>]+content="([^"]+)"', | |
53 | webpage, 'duration', fatal=False)) | |
54 | age_limit = self._family_friendly_search(webpage) | |
55 | ||
56 | return { | |
57 | '_type': 'url_transparent', | |
58 | 'id': video_id, | |
59 | 'display_id': display_id, | |
60 | 'url': '9c9media:rds_web:%s' % video_id, | |
61 | 'title': title, | |
62 | 'description': description, | |
63 | 'thumbnail': thumbnail, | |
64 | 'timestamp': timestamp, | |
65 | 'duration': duration, | |
66 | 'age_limit': age_limit, | |
67 | 'ie_key': 'NineCNineMedia', | |
68 | } |