4 from .common import InfoExtractor
11 class TouTvIE(InfoExtractor):
13 _VALID_URL = r'https?://www\.tou\.tv/(?P<id>[a-zA-Z0-9_-]+(?:/(?P<episode>S[0-9]+E[0-9]+)))'
16 u'url': u'http://www.tou.tv/30-vies/S04E41',
17 u'file': u'30-vies_S04E41.mp4',
19 u'title': u'30 vies Saison 4 / Épisode 41',
20 u'description': u'md5:da363002db82ccbe4dafeb9cab039b09',
22 u'uploader': u'Groupe des Nouveaux Médias',
24 u'upload_date': u'20131118',
25 u'thumbnail': u'http://static.tou.tv/medias/images/2013-11-18_19_00_00_30VIES_0341_01_L.jpeg',
28 u'skip_download': True, # Requires rtmpdump
30 u'skip': 'Only available in Canada'
33 def _real_extract(self, url):
34 mobj = re.match(self._VALID_URL, url)
35 video_id = mobj.group('id')
36 webpage = self._download_webpage(url, video_id)
38 mediaId = self._search_regex(
39 r'"idMedia":\s*"([^"]+)"', webpage, u'media ID')
41 streams_url = u'http://release.theplatform.com/content.select?pid=' + mediaId
42 streams_doc = self._download_xml(
43 streams_url, video_id, note=u'Downloading stream list')
45 video_url = next(n.text
46 for n in streams_doc.findall('.//choice/url')
47 if u'//ad.doubleclick' not in n.text)
48 if video_url.endswith('/Unavailable.flv'):
50 u'Access to this video is blocked from outside of Canada',
53 duration_str = self._html_search_meta(
54 'video:duration', webpage, u'duration')
55 duration = int(duration_str) if duration_str else None
56 upload_date_str = self._html_search_meta(
57 'video:release_date', webpage, u'upload date')
58 upload_date = unified_strdate(upload_date_str) if upload_date_str else None
62 'title': self._og_search_title(webpage),
64 'description': self._og_search_description(webpage),
65 'uploader': self._dc_search_uploader(webpage),
66 'thumbnail': self._og_search_thumbnail(webpage),
67 'age_limit': self._media_rating_search(webpage),
69 'upload_date': upload_date,