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