]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/rds.py
bf200ea4d3f8b17f171bcce01c930b5d183fcc2e
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
10 from ..compat
import compat_str
13 class RDSIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?rds\.ca/vid(?:[eé]|%C3%A9)os/(?:[^/]+/)*(?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 display_id
= self
._match
_id
(url
)
38 webpage
= self
._download
_webpage
(url
, display_id
)
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
(
43 'title', webpage
, 'title', fatal
=True)
44 description
= self
._og
_search
_description
(webpage
) or self
._html
_search
_meta
(
45 'description', webpage
, 'description')
46 thumbnail
= item
.get('urlImageBig') or self
._og
_search
_thumbnail
(webpage
) or self
._search
_regex
(
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
)
59 '_type': 'url_transparent',
61 'display_id': display_id
,
62 'url': '9c9media:rds_web:%s' % video_id
,
64 'description': description
,
65 'thumbnail': thumbnail
,
66 'timestamp': timestamp
,
68 'age_limit': age_limit
,
69 'ie_key': 'NineCNineMedia',