]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rds.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class RDSIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?rds\.ca/vid(?:[eé]|%C3%A9)os/(?:[^/]+/)*(?P<display_id>[^/]+)-(?P<id>\d+\.\d+)'
18 'url': 'http://www.rds.ca/videos/football/nfl/fowler-jr-prend-la-direction-de-jacksonville-3.1132799',
21 'display_id': 'fowler-jr-prend-la-direction-de-jacksonville',
23 'title': 'Fowler Jr. prend la direction de Jacksonville',
24 'description': 'Dante Fowler Jr. est le troisième choix du repêchage 2015 de la NFL. ',
25 'timestamp': 1430397346,
26 'upload_date': '20150430',
31 'url': 'http://www.rds.ca/vid%C3%A9os/un-voyage-positif-3.877934',
32 'only_matching': True,
35 def _real_extract(self
, url
):
36 mobj
= re
.match(self
._VALID
_URL
, url
)
37 video_id
= mobj
.group('id')
38 display_id
= mobj
.group('display_id')
40 webpage
= self
._download
_webpage
(url
, display_id
)
42 # TODO: extract f4m from 9c9media.com
43 video_url
= self
._search
_regex
(
44 r
'<span[^>]+itemprop="contentURL"[^>]+content="([^"]+)"',
47 title
= self
._og
_search
_title
(webpage
) or self
._html
_search
_meta
(
48 'title', webpage
, 'title', fatal
=True)
49 description
= self
._og
_search
_description
(webpage
) or self
._html
_search
_meta
(
50 'description', webpage
, 'description')
51 thumbnail
= self
._og
_search
_thumbnail
(webpage
) or self
._search
_regex
(
52 [r
'<link[^>]+itemprop="thumbnailUrl"[^>]+href="([^"]+)"',
53 r
'<span[^>]+itemprop="thumbnailUrl"[^>]+content="([^"]+)"'],
54 webpage
, 'thumbnail', fatal
=False)
55 timestamp
= parse_iso8601(self
._search
_regex
(
56 r
'<span[^>]+itemprop="uploadDate"[^>]+content="([^"]+)"',
57 webpage
, 'upload date', fatal
=False))
58 duration
= parse_duration(self
._search
_regex
(
59 r
'<span[^>]+itemprop="duration"[^>]+content="([^"]+)"',
60 webpage
, 'duration', fatal
=False))
61 age_limit
= self
._family
_friendly
_search
(webpage
)
65 'display_id': display_id
,
68 'description': description
,
69 'thumbnail': thumbnail
,
70 'timestamp': timestamp
,
72 'age_limit': age_limit
,