[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / unistra.py
blobedc1f8554449dddce6e4e6463badc390b3e4eb45
1 import re
3 from .common import InfoExtractor
4 from ..utils import qualities
7 class UnistraIE(InfoExtractor):
8 _VALID_URL = r'https?://utv\.unistra\.fr/(?:index|video)\.php\?id_video\=(?P<id>\d+)'
10 _TESTS = [
12 'url': 'http://utv.unistra.fr/video.php?id_video=154',
13 'md5': '736f605cfdc96724d55bb543ab3ced24',
14 'info_dict': {
15 'id': '154',
16 'ext': 'mp4',
17 'title': 'M!ss Yella',
18 'description': 'md5:104892c71bd48e55d70b902736b81bbf',
22 'url': 'http://utv.unistra.fr/index.php?id_video=437',
23 'md5': '1ddddd6cccaae76f622ce29b8779636d',
24 'info_dict': {
25 'id': '437',
26 'ext': 'mp4',
27 'title': 'Prix Louise Weiss 2014',
28 'description': 'md5:cc3a8735f079f4fb6b0b570fc10c135a',
33 def _real_extract(self, url):
34 mobj = self._match_valid_url(url)
35 video_id = mobj.group('id')
37 webpage = self._download_webpage(url, video_id)
39 files = set(re.findall(r'file\s*:\s*"(/[^"]+)"', webpage))
41 quality = qualities(['SD', 'HD'])
42 formats = []
43 for file_path in files:
44 format_id = 'HD' if file_path.endswith('-HD.mp4') else 'SD'
45 formats.append({
46 'url': f'http://vod-flash.u-strasbg.fr:8080{file_path}',
47 'format_id': format_id,
48 'quality': quality(format_id),
51 title = self._html_search_regex(
52 r'<title>UTV - (.*?)</', webpage, 'title')
53 description = self._html_search_regex(
54 r'<meta name="Description" content="(.*?)"', webpage, 'description', flags=re.DOTALL)
55 thumbnail = self._search_regex(
56 r'image: "(.*?)"', webpage, 'thumbnail')
58 return {
59 'id': video_id,
60 'title': title,
61 'description': description,
62 'thumbnail': thumbnail,
63 'formats': formats,