[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / telemb.py
blob664464844c83becb4ffe6275d8cc1f216928f458
1 import re
3 from .common import InfoExtractor
4 from ..utils import remove_start
7 class TeleMBIE(InfoExtractor):
8 _WORKING = False
9 _VALID_URL = r'https?://(?:www\.)?telemb\.be/(?P<display_id>.+?)_d_(?P<id>\d+)\.html'
10 _TESTS = [
12 'url': 'http://www.telemb.be/mons-cook-with-danielle-des-cours-de-cuisine-en-anglais-_d_13466.html',
13 'md5': 'f45ea69878516ba039835794e0f8f783',
14 'info_dict': {
15 'id': '13466',
16 'display_id': 'mons-cook-with-danielle-des-cours-de-cuisine-en-anglais-',
17 'ext': 'mp4',
18 'title': 'Mons - Cook with Danielle : des cours de cuisine en anglais ! - Les reportages',
19 'description': 'md5:bc5225f47b17c309761c856ad4776265',
20 'thumbnail': r're:^http://.*\.(?:jpg|png)$',
24 # non-ASCII characters in download URL
25 'url': 'http://telemb.be/les-reportages-havre-incendie-mortel_d_13514.html',
26 'md5': '6e9682736e5ccd4eab7f21e855350733',
27 'info_dict': {
28 'id': '13514',
29 'display_id': 'les-reportages-havre-incendie-mortel',
30 'ext': 'mp4',
31 'title': 'Havré - Incendie mortel - Les reportages',
32 'description': 'md5:5e54cb449acb029c2b7734e2d946bd4a',
33 'thumbnail': r're:^http://.*\.(?:jpg|png)$',
38 def _real_extract(self, url):
39 mobj = self._match_valid_url(url)
40 video_id = mobj.group('id')
41 display_id = mobj.group('display_id')
43 webpage = self._download_webpage(url, display_id)
45 formats = []
46 for video_url in re.findall(r'file\s*:\s*"([^"]+)"', webpage):
47 fmt = {
48 'url': video_url,
49 'format_id': video_url.split(':')[0],
51 rtmp = re.search(r'^(?P<url>rtmp://[^/]+/(?P<app>.+))/(?P<playpath>mp4:.+)$', video_url)
52 if rtmp:
53 fmt.update({
54 'play_path': rtmp.group('playpath'),
55 'app': rtmp.group('app'),
56 'player_url': 'http://p.jwpcdn.com/6/10/jwplayer.flash.swf',
57 'page_url': 'http://www.telemb.be',
58 'preference': -10,
60 formats.append(fmt)
62 title = remove_start(self._og_search_title(webpage), 'TéléMB : ')
63 description = self._html_search_regex(
64 r'<meta property="og:description" content="(.+?)" />',
65 webpage, 'description', fatal=False)
66 thumbnail = self._og_search_thumbnail(webpage)
68 return {
69 'id': video_id,
70 'display_id': display_id,
71 'title': title,
72 'description': description,
73 'thumbnail': thumbnail,
74 'formats': formats,