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