]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/toutv.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class TouTvIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://www\.tou\.tv/(?P<id>[a-zA-Z0-9_-]+(?:/(?P<episode>S[0-9]+E[0-9]+)))'
18 'url': 'http://www.tou.tv/30-vies/S04E41',
19 'file': '30-vies_S04E41.mp4',
21 'title': '30 vies Saison 4 / Épisode 41',
22 'description': 'md5:da363002db82ccbe4dafeb9cab039b09',
24 'uploader': 'Groupe des Nouveaux Médias',
26 'upload_date': '20131118',
27 'thumbnail': 'http://static.tou.tv/medias/images/2013-11-18_19_00_00_30VIES_0341_01_L.jpeg',
30 'skip_download': True, # Requires rtmpdump
32 'skip': 'Only available in Canada'
35 def _real_extract(self
, url
):
36 mobj
= re
.match(self
._VALID
_URL
, url
)
37 video_id
= mobj
.group('id')
38 webpage
= self
._download
_webpage
(url
, video_id
)
40 mediaId
= self
._search
_regex
(
41 r
'"idMedia":\s*"([^"]+)"', webpage
, 'media ID')
43 streams_url
= 'http://release.theplatform.com/content.select?pid=' + mediaId
44 streams_doc
= self
._download
_xml
(
45 streams_url
, video_id
, note
='Downloading stream list')
47 video_url
= next(n
.text
48 for n
in streams_doc
.findall('.//choice/url')
49 if '//ad.doubleclick' not in n
.text
)
50 if video_url
.endswith('/Unavailable.flv'):
52 'Access to this video is blocked from outside of Canada',
55 duration_str
= self
._html
_search
_meta
(
56 'video:duration', webpage
, 'duration')
57 duration
= int(duration_str
) if duration_str
else None
58 upload_date_str
= self
._html
_search
_meta
(
59 'video:release_date', webpage
, 'upload date')
60 upload_date
= unified_strdate(upload_date_str
) if upload_date_str
else None
64 'title': self
._og
_search
_title
(webpage
),
66 'description': self
._og
_search
_description
(webpage
),
67 'uploader': self
._dc
_search
_uploader
(webpage
),
68 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
69 'age_limit': self
._media
_rating
_search
(webpage
),
71 'upload_date': upload_date
,