]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/rds.py
1 from .common
import InfoExtractor
7 from ..compat
import compat_str
10 class RDSIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?rds\.ca/vid(?:[eé]|%C3%A9)os/(?:[^/]+/)*(?P<id>[^/]+)-\d+\.\d+'
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',
20 'display_id': 'forum-du-5-a-7-jesperi-kotkaniemi-de-retour-de-finlande',
22 'title': 'Forum du 5 à 7 : Kotkaniemi de retour de Finlande',
23 'description': 'md5:83fa38ecc4a79b19e433433254077f25',
24 'timestamp': 1606129030,
25 'upload_date': '20201123',
29 'url': 'http://www.rds.ca/vid%C3%A9os/un-voyage-positif-3.877934',
30 'only_matching': True,
33 def _real_extract(self
, url
):
34 display_id
= self
._match
_id
(url
)
36 webpage
= self
._download
_webpage
(url
, display_id
)
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
)
57 '_type': 'url_transparent',
59 'display_id': display_id
,
60 'url': '9c9media:rds_web:%s' % video_id
,
62 'description': description
,
63 'thumbnail': thumbnail
,
64 'timestamp': timestamp
,
66 'age_limit': age_limit
,
67 'ie_key': 'NineCNineMedia',