1 from __future__ import unicode_literals
5 from .common import InfoExtractor
6 from ..utils import qualities
9 class UnistraIE(InfoExtractor):
10 _VALID_URL = r'https?://utv\.unistra\.fr/(?:index|video)\.php\?id_video\=(?P<id>\d+)'
14 'url': 'http://utv.unistra.fr/video.php?id_video=154',
15 'md5': '736f605cfdc96724d55bb543ab3ced24',
19 'title': 'M!ss Yella',
20 'description': 'md5:104892c71bd48e55d70b902736b81bbf',
24 'url': 'http://utv.unistra.fr/index.php?id_video=437',
25 'md5': '1ddddd6cccaae76f622ce29b8779636d',
29 'title': 'Prix Louise Weiss 2014',
30 'description': 'md5:cc3a8735f079f4fb6b0b570fc10c135a',
35 def _real_extract(self, url):
36 mobj = re.match(self._VALID_URL, url)
37 video_id = mobj.group('id')
39 webpage = self._download_webpage(url, video_id)
41 files = set(re.findall(r'file\s*:\s*"(/[^"]+)"', webpage))
43 quality = qualities(['SD', 'HD'])
45 for file_path in files:
46 format_id = 'HD' if file_path.endswith('-HD.mp4') else 'SD'
48 'url': 'http://vod-flash.u-strasbg.fr:8080%s' % file_path,
49 'format_id': format_id,
50 'quality': quality(format_id)
52 self._sort_formats(formats)
54 title = self._html_search_regex(
55 r'<title>UTV - (.*?)</', webpage, 'title')
56 description = self._html_search_regex(
57 r'<meta name="Description" content="(.*?)"', webpage, 'description', flags=re.DOTALL)
58 thumbnail = self._search_regex(
59 r'image: "(.*?)"', webpage, 'thumbnail')
64 'description': description,
65 'thumbnail': thumbnail,